tinet-agent-cli 0.1.0.dev36__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taco/__init__.py +1 -0
- taco/agent_openapi/__init__.py +1 -0
- taco/agent_openapi/catalog.py +198 -0
- taco/agent_openapi/models.py +47 -0
- taco/agent_openapi/parameters.py +111 -0
- taco/agent_openapi/service.py +73 -0
- taco/aikb/__init__.py +4 -0
- taco/aikb/catalog.py +380 -0
- taco/aikb/executors.py +157 -0
- taco/aikb/file_input.py +55 -0
- taco/aikb/models.py +42 -0
- taco/aikb/parameters.py +135 -0
- taco/aikb/service.py +68 -0
- taco/assets/__init__.py +1 -0
- taco/assets/agent_openapi/catalog.json +14 -0
- taco/assets/agent_openapi/operations/conversation/list-conversations.json +67 -0
- taco/assets/agent_openapi/operations/message/list-conversation-messages.json +80 -0
- taco/assets/agent_openapi/operations/trace/list-message-traces.json +72 -0
- taco/assets/aikb/catalog.json +41 -0
- taco/assets/aikb/operations/conversation/chat-conversation-on-open.json +99 -0
- taco/assets/aikb/operations/directory/delete-directory.json +81 -0
- taco/assets/aikb/operations/directory/edit-directory.json +97 -0
- taco/assets/aikb/operations/directory/list-directory-tree.json +106 -0
- taco/assets/aikb/operations/directory/save-directory.json +109 -0
- taco/assets/aikb/operations/faq/create-faq.json +193 -0
- taco/assets/aikb/operations/faq/delete-faq.json +81 -0
- taco/assets/aikb/operations/faq/describe-faq.json +82 -0
- taco/assets/aikb/operations/faq/edit-faq.json +193 -0
- taco/assets/aikb/operations/faq/list-faqs.json +136 -0
- taco/assets/aikb/operations/file/create-file.json +145 -0
- taco/assets/aikb/operations/file/delete-files.json +110 -0
- taco/assets/aikb/operations/file/describe-file.json +82 -0
- taco/assets/aikb/operations/file/get-file-upload-url.json +154 -0
- taco/assets/aikb/operations/file/list-files.json +146 -0
- taco/assets/aikb/operations/media/describe-faq-media-url.json +98 -0
- taco/assets/aikb/operations/media/describe-file-media-url.json +90 -0
- taco/assets/aikb/operations/oss/signature-for-upload.json +85 -0
- taco/assets/aikb/operations/recycle-bin/list-recycled-items.json +151 -0
- taco/assets/aikb/operations/repository/describe-bot-repository.json +71 -0
- taco/assets/aikb/operations/repository/list-private-repositories.json +75 -0
- taco/assets/aikb/operations/repository/list-public-repositories.json +75 -0
- taco/assets/aikb/operations/search/search-knowledge-on-open.json +180 -0
- taco/assets/examples/README.md +3 -0
- taco/assets/examples/agent-basic.json +16 -0
- taco/assets/examples/agent-builtin-tool.json +28 -0
- taco/assets/examples/agent-workflow-tool.json +30 -0
- taco/assets/examples/chatflow-basic.json +24 -0
- taco/assets/examples/workflow-http.json +34 -0
- taco/assets/manifest.json +12 -0
- taco/assets/scenarios/README.md +3 -0
- taco/assets/scenarios/agent-basic.json +80 -0
- taco/assets/scenarios/agent-builtin-tool.json +116 -0
- taco/assets/scenarios/agent-workflow-tool.json +277 -0
- taco/assets/schemas/README.md +3 -0
- taco/assets/schemas/agent-tool.json +71 -0
- taco/assets/schemas/agent.json +199 -0
- taco/assets/schemas/chatflow.json +1048 -0
- taco/assets/schemas/workflow.http.json +1052 -0
- taco/assets/schemas/workflow.json +1052 -0
- taco/assets/skills/README.md +3 -0
- taco/assets/skills/taco/SKILL.md +68 -0
- taco/assets/skills/taco/manifest.json +10 -0
- taco/cli.py +127 -0
- taco/commands/__init__.py +1 -0
- taco/commands/agent.py +760 -0
- taco/commands/aikb.py +132 -0
- taco/commands/app.py +151 -0
- taco/commands/category.py +37 -0
- taco/commands/chatflow.py +183 -0
- taco/commands/credential.py +222 -0
- taco/commands/discovery.py +409 -0
- taco/commands/model.py +55 -0
- taco/commands/profile.py +124 -0
- taco/commands/tool.py +61 -0
- taco/commands/workflow.py +714 -0
- taco/core/__init__.py +1 -0
- taco/core/access_token_manager.py +98 -0
- taco/core/api_client.py +263 -0
- taco/core/assets.py +81 -0
- taco/core/config_store.py +209 -0
- taco/core/context.py +19 -0
- taco/core/developer_center_client.py +165 -0
- taco/core/errors.py +19 -0
- taco/core/file_lock.py +80 -0
- taco/core/http_headers.py +21 -0
- taco/core/openapi_signer.py +221 -0
- taco/core/output.py +72 -0
- taco/core/profile_manager.py +217 -0
- taco/core/profile_resolver.py +151 -0
- taco/core/secure_file.py +76 -0
- taco/release.py +363 -0
- taco/services/__init__.py +1 -0
- taco/services/agent_service.py +314 -0
- taco/services/app_service.py +153 -0
- taco/services/category_service.py +57 -0
- taco/services/model_service.py +117 -0
- taco/services/tool_service.py +482 -0
- taco/services/workflow_compiler.py +1665 -0
- taco/services/workflow_service.py +652 -0
- taco/services/workflow_tool_service.py +439 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/METADATA +158 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/RECORD +104 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/WHEEL +4 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/entry_points.txt +2 -0
taco/aikb/parameters.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Mapping
|
|
6
|
+
|
|
7
|
+
from jsonschema import Draft202012Validator
|
|
8
|
+
|
|
9
|
+
from taco.aikb.models import AikbOperation
|
|
10
|
+
from taco.core.errors import TacoError
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
RESERVED = {"accesskeyid", "expires", "timestamp", "signature", "authorization"}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def parse_parameters(
|
|
17
|
+
operation: AikbOperation,
|
|
18
|
+
*,
|
|
19
|
+
params: list[str] | None = None,
|
|
20
|
+
params_file: Path | None = None,
|
|
21
|
+
body_file: Path | None = None,
|
|
22
|
+
has_file: bool = False,
|
|
23
|
+
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
24
|
+
query_schema = operation.http["query_schema"]
|
|
25
|
+
body_schema = operation.http["body_schema"]
|
|
26
|
+
query_fields = query_schema.get("properties", {})
|
|
27
|
+
body_fields = body_schema.get("properties", {})
|
|
28
|
+
values: dict[str, Any] = {}
|
|
29
|
+
for expression in params or []:
|
|
30
|
+
key, separator, raw = expression.partition("=")
|
|
31
|
+
if not separator or not key:
|
|
32
|
+
raise _parameter_error("--param 必须使用 key=value 格式。")
|
|
33
|
+
if key in values:
|
|
34
|
+
raise _parameter_error(f"参数重复:/{key}")
|
|
35
|
+
schema = query_fields.get(key) or body_fields.get(key)
|
|
36
|
+
if schema is None:
|
|
37
|
+
raise _parameter_error(f"未知参数:/{key}")
|
|
38
|
+
values[key] = _parse_value(raw, schema, key)
|
|
39
|
+
if params_file is not None:
|
|
40
|
+
file_values = _read_json_object(params_file)
|
|
41
|
+
conflicts = set(values) & set(file_values)
|
|
42
|
+
if conflicts:
|
|
43
|
+
raise _parameter_error(f"参数重复:/{sorted(conflicts)[0]}")
|
|
44
|
+
values.update(file_values)
|
|
45
|
+
if any(key.lower() in RESERVED for key in values):
|
|
46
|
+
raise _parameter_error("不能传入公共签名或认证参数。")
|
|
47
|
+
unknown = set(values) - set(query_fields) - set(body_fields)
|
|
48
|
+
if unknown:
|
|
49
|
+
raise _parameter_error(f"未知参数:/{sorted(unknown)[0]}")
|
|
50
|
+
|
|
51
|
+
query = {key: value for key, value in values.items() if key in query_fields}
|
|
52
|
+
body_values = {key: value for key, value in values.items() if key in body_fields}
|
|
53
|
+
if body_file is not None:
|
|
54
|
+
if body_values:
|
|
55
|
+
raise _parameter_error("--body-file 不能与映射到 body 的 --param 同时使用。")
|
|
56
|
+
body_values = _read_json_object(body_file)
|
|
57
|
+
bound_targets = {
|
|
58
|
+
binding["target"].removeprefix("/")
|
|
59
|
+
for binding in operation.execution.get("request_bindings", ())
|
|
60
|
+
}
|
|
61
|
+
if bound_targets & set(body_values):
|
|
62
|
+
raise _parameter_error("文件名和大小只能由 --file 自动生成。")
|
|
63
|
+
if operation.file_input is not None:
|
|
64
|
+
if not has_file:
|
|
65
|
+
raise _parameter_error("该 operation 必须传入 --file。")
|
|
66
|
+
if body_file is not None:
|
|
67
|
+
raise _parameter_error("文件 operation 不接受 --body-file。")
|
|
68
|
+
elif has_file:
|
|
69
|
+
raise _parameter_error("该 operation 不支持 --file。")
|
|
70
|
+
|
|
71
|
+
_validate(query_schema, query, ignore_required=set())
|
|
72
|
+
_validate(body_schema, body_values, ignore_required=bound_targets)
|
|
73
|
+
return query, body_values
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _parse_value(raw: str, schema: Mapping[str, Any], key: str) -> Any:
|
|
77
|
+
expected = schema.get("type")
|
|
78
|
+
try:
|
|
79
|
+
if expected == "string":
|
|
80
|
+
return raw
|
|
81
|
+
if expected == "integer":
|
|
82
|
+
return int(raw, 10)
|
|
83
|
+
if expected == "number":
|
|
84
|
+
return float(raw)
|
|
85
|
+
if expected == "boolean":
|
|
86
|
+
if raw.lower() in {"true", "1"}:
|
|
87
|
+
return True
|
|
88
|
+
if raw.lower() in {"false", "0"}:
|
|
89
|
+
return False
|
|
90
|
+
raise ValueError
|
|
91
|
+
if expected in {"array", "object"}:
|
|
92
|
+
return json.loads(raw)
|
|
93
|
+
except (ValueError, json.JSONDecodeError):
|
|
94
|
+
raise _parameter_error(f"参数 /{key} 类型错误,期望 {expected}。") from None
|
|
95
|
+
raise _parameter_error(f"参数 /{key} 使用了不支持的类型。")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _read_json_object(path: Path) -> dict[str, Any]:
|
|
99
|
+
try:
|
|
100
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
101
|
+
except (OSError, UnicodeError, json.JSONDecodeError):
|
|
102
|
+
raise _parameter_error(f"参数文件不是合法 UTF-8 JSON 对象:{path}") from None
|
|
103
|
+
if not isinstance(payload, dict):
|
|
104
|
+
raise _parameter_error(f"参数文件必须是 JSON 对象:{path}")
|
|
105
|
+
return payload
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _validate(schema: Mapping[str, Any], value: Any, *, ignore_required: set[str]) -> None:
|
|
109
|
+
mutable = _thaw(schema)
|
|
110
|
+
if ignore_required:
|
|
111
|
+
mutable["required"] = [
|
|
112
|
+
key for key in mutable.get("required", []) if key not in ignore_required
|
|
113
|
+
]
|
|
114
|
+
error = next(Draft202012Validator(mutable).iter_errors(value), None)
|
|
115
|
+
if error is not None:
|
|
116
|
+
pointer = "/" + "/".join(str(part) for part in error.absolute_path)
|
|
117
|
+
raise _parameter_error(
|
|
118
|
+
f"参数 {pointer or '/'} 校验失败,期望 {error.validator}。"
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def thaw(value: Any) -> Any:
|
|
123
|
+
return _thaw(value)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _thaw(value: Any) -> Any:
|
|
127
|
+
if isinstance(value, Mapping):
|
|
128
|
+
return {key: _thaw(item) for key, item in value.items()}
|
|
129
|
+
if isinstance(value, tuple):
|
|
130
|
+
return [_thaw(item) for item in value]
|
|
131
|
+
return value
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _parameter_error(message: str) -> TacoError:
|
|
135
|
+
return TacoError(code="AIKB_PARAMETER_INVALID", message=message, exit_code=2)
|
taco/aikb/service.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from taco.aikb.catalog import load_catalog
|
|
9
|
+
from taco.aikb.executors import execute_http, execute_presigned_put
|
|
10
|
+
from taco.aikb.file_input import OpenFileInput
|
|
11
|
+
from taco.core.config_store import ConfigStore
|
|
12
|
+
from taco.core.developer_center_client import DeveloperCenterClient
|
|
13
|
+
from taco.core.errors import TacoError
|
|
14
|
+
from taco.core.profile_resolver import ProfileResolver
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AikbService:
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
store: ConfigStore | None = None,
|
|
21
|
+
*,
|
|
22
|
+
profile_resolver: ProfileResolver | None = None,
|
|
23
|
+
developer_http_client: httpx.Client | None = None,
|
|
24
|
+
upload_http_client: httpx.Client | None = None,
|
|
25
|
+
) -> None:
|
|
26
|
+
self.store = store or ConfigStore()
|
|
27
|
+
self.profile_resolver = profile_resolver or ProfileResolver(self.store)
|
|
28
|
+
self.catalog = load_catalog()
|
|
29
|
+
self.developer_http_client = developer_http_client
|
|
30
|
+
self.upload_http_client = upload_http_client
|
|
31
|
+
|
|
32
|
+
def call(
|
|
33
|
+
self,
|
|
34
|
+
operation_id: str,
|
|
35
|
+
*,
|
|
36
|
+
query: dict[str, Any],
|
|
37
|
+
body: dict[str, Any],
|
|
38
|
+
profile: str | None = None,
|
|
39
|
+
file_path: Path | None = None,
|
|
40
|
+
upload_timeout: float | None = None,
|
|
41
|
+
) -> dict[str, Any]:
|
|
42
|
+
operation = self.catalog.by_id.get(operation_id)
|
|
43
|
+
if operation is None:
|
|
44
|
+
raise TacoError(code="AIKB_OPERATION_NOT_FOUND", message=f"未知 operation:{operation_id}", exit_code=2)
|
|
45
|
+
resolved = self.profile_resolver.resolve(profile)
|
|
46
|
+
client = DeveloperCenterClient(
|
|
47
|
+
endpoint=resolved.endpoint,
|
|
48
|
+
access_key_id=resolved.access_key_id,
|
|
49
|
+
access_key_secret=resolved.access_key_secret,
|
|
50
|
+
http_client=self.developer_http_client,
|
|
51
|
+
)
|
|
52
|
+
try:
|
|
53
|
+
if operation.execution["kind"] == "http":
|
|
54
|
+
return execute_http(operation, client, query=query, body=body)
|
|
55
|
+
if file_path is None:
|
|
56
|
+
raise TacoError(code="AIKB_FILE_REQUIRED", message="该 operation 必须传入 --file。", exit_code=2)
|
|
57
|
+
with OpenFileInput.open(file_path) as file:
|
|
58
|
+
return execute_presigned_put(
|
|
59
|
+
operation,
|
|
60
|
+
client,
|
|
61
|
+
query=query,
|
|
62
|
+
body=body,
|
|
63
|
+
file=file,
|
|
64
|
+
upload_http_client=self.upload_http_client,
|
|
65
|
+
upload_timeout=upload_timeout,
|
|
66
|
+
)
|
|
67
|
+
finally:
|
|
68
|
+
client.close()
|
taco/assets/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Packaged schemas, scenarios, examples, and Agent skills."""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"catalog_version": "1.0",
|
|
3
|
+
"json_schema_dialect": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"source": {
|
|
5
|
+
"name": "天润开发者中心智能体 API",
|
|
6
|
+
"url": "https://develop.clink.cn/develop/api/agent.html",
|
|
7
|
+
"snapshot_date": "2026-08-31"
|
|
8
|
+
},
|
|
9
|
+
"operations": [
|
|
10
|
+
"conversation/list-conversations",
|
|
11
|
+
"message/list-conversation-messages",
|
|
12
|
+
"trace/list-message-traces"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "1.0",
|
|
3
|
+
"id": "list-conversations",
|
|
4
|
+
"title": "查询会话记录",
|
|
5
|
+
"description": "按查询条件游标读取智能体会话记录,单次查询时间跨度最大为 90 天。",
|
|
6
|
+
"group": "conversation",
|
|
7
|
+
"keywords": ["查询会话记录", "会话记录", "conversation", "list-conversations", "list_conversations"],
|
|
8
|
+
"source": {"url": "https://develop.clink.cn/develop/api/agent.html", "anchor": "查询会话记录", "snapshot_date": "2026-08-31"},
|
|
9
|
+
"http": {
|
|
10
|
+
"method": "POST",
|
|
11
|
+
"path": "/agent/v1/data/list-conversations",
|
|
12
|
+
"content_type": "application/json",
|
|
13
|
+
"query_schema": {"type": "object", "properties": {}, "additionalProperties": false},
|
|
14
|
+
"body_schema": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"app_id": {"type": "string", "title": "智能体应用 ID", "description": "智能体应用 ID。", "minLength": 1},
|
|
18
|
+
"conversation_id": {"type": "string", "title": "会话 ID", "description": "可选,按指定会话 ID 查询。", "minLength": 1},
|
|
19
|
+
"created_at_start": {"type": "integer", "title": "创建开始时间", "description": "会话创建时间范围的开始时间,Unix 秒级正整数时间戳。", "minimum": 1},
|
|
20
|
+
"created_at_end": {"type": "integer", "title": "创建结束时间", "description": "会话创建时间范围的结束时间,Unix 秒级正整数时间戳,闭区间且跨度不超过 90 天。", "minimum": 1},
|
|
21
|
+
"invoke_from": {"type": "string", "title": "会话来源", "description": "会话来源,可选生产环境或调试环境。", "enum": ["PROD", "DEBUG"], "x-enum-descriptions": {"PROD": "生产环境", "DEBUG": "调试环境"}},
|
|
22
|
+
"is_transfer_human": {"type": "boolean", "title": "是否转人工", "description": "筛选是否发生过转人工。"},
|
|
23
|
+
"limit": {"type": "integer", "title": "每页条数", "description": "每次返回条数,范围 1 到 100,默认 10。", "minimum": 1, "maximum": 100, "default": 10},
|
|
24
|
+
"cursor": {"type": "string", "title": "下一页游标", "description": "首次请求不传;后续传入上次响应的 next_cursor,并保持其他参数不变。", "minLength": 1}
|
|
25
|
+
},
|
|
26
|
+
"required": ["app_id", "created_at_start", "created_at_end"],
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"response": {
|
|
31
|
+
"request_id_pointer": "/requestId",
|
|
32
|
+
"schema": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"required": ["data", "limit", "has_more", "next_cursor"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"requestId": {"type": ["string", "null"], "description": "开发者中心请求 ID,部分成功响应可能不返回。"},
|
|
37
|
+
"data": {
|
|
38
|
+
"type": "array", "description": "会话记录列表。",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "object", "description": "一条会话记录。",
|
|
41
|
+
"properties": {
|
|
42
|
+
"id": {"type": "string", "description": "会话 ID。"},
|
|
43
|
+
"main_unique_id": {"type": ["string", "null"], "description": "接入方的会话 ID。"},
|
|
44
|
+
"duration": {"type": "integer", "description": "会话持续时间,单位秒。"},
|
|
45
|
+
"dialogue_count": {"type": "integer", "description": "对话轮次。"},
|
|
46
|
+
"app_id": {"type": "string", "description": "智能体应用 ID。"},
|
|
47
|
+
"inputs": {"type": ["string", "null"], "description": "会话输入变量的 JSON 字符串。"},
|
|
48
|
+
"created_at": {"type": "integer", "description": "创建时间,Unix 秒级时间戳。"},
|
|
49
|
+
"updated_at": {"type": "integer", "description": "更新时间,Unix 秒级时间戳。"},
|
|
50
|
+
"invoke_from": {"type": "string", "description": "会话来源。"},
|
|
51
|
+
"is_transfer_human": {"type": "boolean", "description": "是否发生转人工。"}
|
|
52
|
+
},
|
|
53
|
+
"additionalProperties": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"limit": {"type": "integer", "description": "本次查询的每页条数。"},
|
|
57
|
+
"has_more": {"type": "boolean", "description": "是否还有下一页。"},
|
|
58
|
+
"next_cursor": {"type": ["string", "null"], "description": "下一页游标,无下一页时为 null。"}
|
|
59
|
+
},
|
|
60
|
+
"additionalProperties": true
|
|
61
|
+
},
|
|
62
|
+
"sensitive_pointers": []
|
|
63
|
+
},
|
|
64
|
+
"risk": {"level": "read", "requires_confirmation": false, "target_fields": []},
|
|
65
|
+
"execution": {"kind": "http"},
|
|
66
|
+
"examples": [{"title": "查询生产环境会话", "params": {"app_id": "1-407259aa-393c-4858-bc64-220a44d177e9", "created_at_start": 1782835200, "created_at_end": 1785168000, "invoke_from": "PROD", "limit": 10}}]
|
|
67
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "1.0",
|
|
3
|
+
"id": "list-conversation-messages",
|
|
4
|
+
"title": "查询会话消息",
|
|
5
|
+
"description": "按创建时间正序游标读取指定会话的消息列表。",
|
|
6
|
+
"group": "message",
|
|
7
|
+
"keywords": ["查询会话消息", "会话消息", "对话记录", "message", "list-conversation-messages", "list_conversation_messages"],
|
|
8
|
+
"source": {"url": "https://develop.clink.cn/develop/api/agent.html", "anchor": "查询会话消息", "snapshot_date": "2026-08-31"},
|
|
9
|
+
"http": {
|
|
10
|
+
"method": "POST",
|
|
11
|
+
"path": "/agent/v1/data/list-conversation-messages",
|
|
12
|
+
"content_type": "application/json",
|
|
13
|
+
"query_schema": {"type": "object", "properties": {}, "additionalProperties": false},
|
|
14
|
+
"body_schema": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"app_id": {"type": "string", "title": "智能体应用 ID", "description": "智能体应用 ID。", "minLength": 1},
|
|
18
|
+
"conversation_id": {"type": "string", "title": "会话 ID", "description": "需要查询的会话 ID。", "minLength": 1},
|
|
19
|
+
"conversation_created_at": {"type": "integer", "title": "会话创建时间", "description": "会话创建时间的 Unix 秒级正整数时间戳。", "minimum": 1},
|
|
20
|
+
"limit": {"type": "integer", "title": "每页条数", "description": "每次返回条数,范围 1 到 100,默认 10。", "minimum": 1, "maximum": 100, "default": 10},
|
|
21
|
+
"cursor": {"type": "string", "title": "下一页游标", "description": "首次请求不传;后续传入上次响应的 next_cursor,并保持其他参数不变。", "minLength": 1}
|
|
22
|
+
},
|
|
23
|
+
"required": ["app_id", "conversation_id", "conversation_created_at"],
|
|
24
|
+
"additionalProperties": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"response": {
|
|
28
|
+
"request_id_pointer": "/requestId",
|
|
29
|
+
"schema": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"required": ["data", "limit", "has_more", "next_cursor"],
|
|
32
|
+
"properties": {
|
|
33
|
+
"requestId": {"type": ["string", "null"], "description": "开发者中心请求 ID,部分成功响应可能不返回。"},
|
|
34
|
+
"data": {
|
|
35
|
+
"type": "array", "description": "消息列表,不包含系统内部记忆消息。",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object", "description": "一条会话消息。",
|
|
38
|
+
"properties": {
|
|
39
|
+
"conversation_id": {"type": "string", "description": "会话 ID。"},
|
|
40
|
+
"main_unique_id": {"type": ["string", "null"], "description": "接入方的会话 ID。"},
|
|
41
|
+
"id": {"type": "string", "description": "消息 ID。"},
|
|
42
|
+
"query": {"type": ["string", "null"], "description": "用户输入。"},
|
|
43
|
+
"answer": {"type": ["string", "null"], "description": "智能体回答。"},
|
|
44
|
+
"knowledge_sources": {
|
|
45
|
+
"type": "array", "description": "回答引用的知识来源。",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "object", "description": "一条知识来源。",
|
|
48
|
+
"properties": {
|
|
49
|
+
"name": {"type": "string", "description": "知识名称。"},
|
|
50
|
+
"type": {"type": "string", "description": "知识类型,如 FAQ、FILE 或 CONVERSATION。"}
|
|
51
|
+
},
|
|
52
|
+
"additionalProperties": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"answer_type": {"type": ["string", "null"], "description": "回复类型,如 EXACT、RECOMMEND 或 UNKNOWN。"},
|
|
56
|
+
"created_at": {"type": "integer", "description": "消息创建时间,Unix 秒级时间戳。"},
|
|
57
|
+
"first_token_latency": {"type": ["number", "null"], "description": "首 Token 生成时间,单位秒。"},
|
|
58
|
+
"total_latency": {"type": ["number", "null"], "description": "完整回复生成时间,单位秒。"},
|
|
59
|
+
"user_feedback": {"type": ["string", "null"], "description": "用户评价状态。"},
|
|
60
|
+
"user_feedback_tags": {"type": ["array", "null"], "description": "用户评价标签。", "items": {"type": "string", "description": "一条用户评价标签。"}},
|
|
61
|
+
"user_feedback_content": {"type": ["string", "null"], "description": "用户评价内容。"},
|
|
62
|
+
"manager_feedback": {"type": ["string", "null"], "description": "管理员评价状态。"},
|
|
63
|
+
"inputs": {"type": ["string", "null"], "description": "消息输入变量的 JSON 字符串。"},
|
|
64
|
+
"content_moderation_result": {"type": ["string", "null"], "description": "内容审查结果。"}
|
|
65
|
+
},
|
|
66
|
+
"additionalProperties": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"limit": {"type": "integer", "description": "本次查询的每页条数。"},
|
|
70
|
+
"has_more": {"type": "boolean", "description": "是否还有下一页。"},
|
|
71
|
+
"next_cursor": {"type": ["string", "null"], "description": "下一页游标,无下一页时为 null。"}
|
|
72
|
+
},
|
|
73
|
+
"additionalProperties": true
|
|
74
|
+
},
|
|
75
|
+
"sensitive_pointers": []
|
|
76
|
+
},
|
|
77
|
+
"risk": {"level": "read", "requires_confirmation": false, "target_fields": []},
|
|
78
|
+
"execution": {"kind": "http"},
|
|
79
|
+
"examples": [{"title": "查询指定会话消息", "params": {"app_id": "1-407259aa-393c-4858-bc64-220a44d177e9", "conversation_id": "0fcac847-ba6a-4d74-b9ac-02d35b9911b5", "conversation_created_at": 1785118530, "limit": 10}}]
|
|
80
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "1.0",
|
|
3
|
+
"id": "list-message-traces",
|
|
4
|
+
"title": "查询消息追踪",
|
|
5
|
+
"description": "游标读取指定消息的详细日志追踪。",
|
|
6
|
+
"group": "trace",
|
|
7
|
+
"keywords": ["查询消息追踪", "消息追踪", "节点日志", "trace", "list-message-traces", "list_message_traces"],
|
|
8
|
+
"source": {"url": "https://develop.clink.cn/develop/api/agent.html", "anchor": "查询消息追踪", "snapshot_date": "2026-08-31"},
|
|
9
|
+
"http": {
|
|
10
|
+
"method": "POST",
|
|
11
|
+
"path": "/agent/v1/data/list-message-traces",
|
|
12
|
+
"content_type": "application/json",
|
|
13
|
+
"query_schema": {"type": "object", "properties": {}, "additionalProperties": false},
|
|
14
|
+
"body_schema": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"app_id": {"type": "string", "title": "智能体应用 ID", "description": "智能体应用 ID。", "minLength": 1},
|
|
18
|
+
"conversation_id": {"type": "string", "title": "会话 ID", "description": "消息所属的会话 ID。", "minLength": 1},
|
|
19
|
+
"conversation_created_at": {"type": "integer", "title": "会话创建时间", "description": "会话创建时间的 Unix 秒级正整数时间戳,用于定位数据索引。", "minimum": 1},
|
|
20
|
+
"message_id": {"type": "string", "title": "消息 ID", "description": "需要查询追踪的消息 ID。", "minLength": 1},
|
|
21
|
+
"limit": {"type": "integer", "title": "每页条数", "description": "每次返回条数,范围 1 到 100,默认 10。", "minimum": 1, "maximum": 100, "default": 10},
|
|
22
|
+
"cursor": {"type": "string", "title": "下一页游标", "description": "首次请求不传;后续传入上次响应的 next_cursor,并保持其他参数不变。", "minLength": 1}
|
|
23
|
+
},
|
|
24
|
+
"required": ["app_id", "conversation_id", "conversation_created_at", "message_id"],
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"response": {
|
|
29
|
+
"request_id_pointer": "/requestId",
|
|
30
|
+
"schema": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": ["message_id", "traces", "limit", "has_more", "next_cursor"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"requestId": {"type": ["string", "null"], "description": "开发者中心请求 ID,部分成功响应可能不返回。"},
|
|
35
|
+
"message_id": {"type": "string", "description": "消息 ID。"},
|
|
36
|
+
"traces": {
|
|
37
|
+
"type": "array", "description": "详细日志追踪列表。",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "object", "description": "一条节点执行追踪。",
|
|
40
|
+
"properties": {
|
|
41
|
+
"id": {"type": "string", "description": "节点执行 ID。"},
|
|
42
|
+
"index": {"type": "integer", "description": "节点执行顺序。"},
|
|
43
|
+
"predecessor_node_id": {"type": ["string", "null"], "description": "前置节点 ID。"},
|
|
44
|
+
"node_id": {"type": "string", "description": "工作流节点 ID。"},
|
|
45
|
+
"node_type": {"type": "string", "description": "节点类型。"},
|
|
46
|
+
"title": {"type": "string", "description": "节点标题。"},
|
|
47
|
+
"inputs": {"description": "节点输入;JSON 内容返回对象,否则可能返回原始值。"},
|
|
48
|
+
"process_data": {"description": "节点处理过程数据。"},
|
|
49
|
+
"outputs": {"description": "节点输出;JSON 内容返回对象,否则可能返回原始值。"},
|
|
50
|
+
"status": {"type": "string", "description": "节点执行状态。"},
|
|
51
|
+
"error": {"type": ["string", "null"], "description": "节点执行错误信息。"},
|
|
52
|
+
"elapsed_time": {"type": ["number", "null"], "description": "节点执行耗时,单位秒。"},
|
|
53
|
+
"execution_metadata": {"type": ["object", "null"], "description": "节点执行元数据。", "additionalProperties": true},
|
|
54
|
+
"extras": {"type": ["object", "null"], "description": "节点额外信息。", "additionalProperties": true},
|
|
55
|
+
"created_at": {"type": "integer", "description": "节点开始执行的 Unix 秒级时间戳。"},
|
|
56
|
+
"finished_at": {"type": ["integer", "null"], "description": "节点完成执行的 Unix 秒级时间戳。"}
|
|
57
|
+
},
|
|
58
|
+
"additionalProperties": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"limit": {"type": "integer", "description": "本次查询的每页条数。"},
|
|
62
|
+
"has_more": {"type": "boolean", "description": "是否还有下一页。"},
|
|
63
|
+
"next_cursor": {"type": ["string", "null"], "description": "下一页游标,无下一页时为 null。"}
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": true
|
|
66
|
+
},
|
|
67
|
+
"sensitive_pointers": []
|
|
68
|
+
},
|
|
69
|
+
"risk": {"level": "read", "requires_confirmation": false, "target_fields": []},
|
|
70
|
+
"execution": {"kind": "http"},
|
|
71
|
+
"examples": [{"title": "查询指定消息追踪", "params": {"app_id": "1-407259aa-393c-4858-bc64-220a44d177e9", "conversation_id": "0fcac847-ba6a-4d74-b9ac-02d35b9911b5", "conversation_created_at": 1785118530, "message_id": "29831f179-ea7c-49d5-1257-69f15d1e4ed4", "limit": 10}}]
|
|
72
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"catalog_version": "1.0",
|
|
3
|
+
"json_schema_dialect": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"source": {
|
|
5
|
+
"name": "天润开发者中心 AIKB",
|
|
6
|
+
"url": "https://develop.clink.cn/develop/api/aikb.html",
|
|
7
|
+
"snapshot_date": "2026-08-14"
|
|
8
|
+
},
|
|
9
|
+
"defaults": {
|
|
10
|
+
"endpoint_scope": "/aikb/",
|
|
11
|
+
"content_type": "application/json",
|
|
12
|
+
"query_array_style": "indexed",
|
|
13
|
+
"additional_request_properties": false,
|
|
14
|
+
"additional_response_properties": true
|
|
15
|
+
},
|
|
16
|
+
"operations": [
|
|
17
|
+
"repository/list-public-repositories",
|
|
18
|
+
"repository/list-private-repositories",
|
|
19
|
+
"repository/describe-bot-repository",
|
|
20
|
+
"directory/list-directory-tree",
|
|
21
|
+
"directory/save-directory",
|
|
22
|
+
"directory/edit-directory",
|
|
23
|
+
"directory/delete-directory",
|
|
24
|
+
"faq/list-faqs",
|
|
25
|
+
"faq/create-faq",
|
|
26
|
+
"faq/edit-faq",
|
|
27
|
+
"faq/delete-faq",
|
|
28
|
+
"faq/describe-faq",
|
|
29
|
+
"file/list-files",
|
|
30
|
+
"file/describe-file",
|
|
31
|
+
"file/get-file-upload-url",
|
|
32
|
+
"file/create-file",
|
|
33
|
+
"file/delete-files",
|
|
34
|
+
"recycle-bin/list-recycled-items",
|
|
35
|
+
"conversation/chat-conversation-on-open",
|
|
36
|
+
"search/search-knowledge-on-open",
|
|
37
|
+
"media/describe-file-media-url",
|
|
38
|
+
"media/describe-faq-media-url",
|
|
39
|
+
"oss/signature-for-upload"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "1.0",
|
|
3
|
+
"id": "chat-conversation-on-open",
|
|
4
|
+
"title": "会话问答",
|
|
5
|
+
"description": "会话问答,参数和返回结构依据开发者中心 AIKB 文档快照。",
|
|
6
|
+
"group": "conversation",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"会话问答",
|
|
9
|
+
"chat-conversation-on-open",
|
|
10
|
+
"chat_conversation_on_open"
|
|
11
|
+
],
|
|
12
|
+
"source": {
|
|
13
|
+
"url": "https://develop.clink.cn/develop/api/aikb.html",
|
|
14
|
+
"anchor": "会话问答",
|
|
15
|
+
"snapshot_date": "2026-08-14"
|
|
16
|
+
},
|
|
17
|
+
"http": {
|
|
18
|
+
"method": "POST",
|
|
19
|
+
"path": "/aikb/chat_conversation_on_open",
|
|
20
|
+
"content_type": "application/json",
|
|
21
|
+
"query_schema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"username": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"title": "用户登录名",
|
|
27
|
+
"description": "发起提问的用户登录名。",
|
|
28
|
+
"minLength": 1
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": [
|
|
32
|
+
"username"
|
|
33
|
+
],
|
|
34
|
+
"additionalProperties": false
|
|
35
|
+
},
|
|
36
|
+
"body_schema": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"content": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"title": "消息内容",
|
|
42
|
+
"description": "本轮对话的提问内容。",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
},
|
|
45
|
+
"conversationId": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"title": "会话 ID",
|
|
48
|
+
"description": "新对话不传,后续消息传服务端返回的 ID。"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": [
|
|
52
|
+
"content"
|
|
53
|
+
],
|
|
54
|
+
"additionalProperties": false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"response": {
|
|
58
|
+
"request_id_pointer": "/requestId",
|
|
59
|
+
"schema": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": [
|
|
62
|
+
"result"
|
|
63
|
+
],
|
|
64
|
+
"properties": {
|
|
65
|
+
"requestId": {
|
|
66
|
+
"type": [
|
|
67
|
+
"string",
|
|
68
|
+
"null"
|
|
69
|
+
],
|
|
70
|
+
"description": "开发者中心请求 ID;部分接口可能返回 null。"
|
|
71
|
+
},
|
|
72
|
+
"result": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"description": "接口返回的业务结果。",
|
|
75
|
+
"additionalProperties": true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"additionalProperties": true
|
|
79
|
+
},
|
|
80
|
+
"sensitive_pointers": []
|
|
81
|
+
},
|
|
82
|
+
"risk": {
|
|
83
|
+
"level": "write",
|
|
84
|
+
"requires_confirmation": true,
|
|
85
|
+
"target_fields": []
|
|
86
|
+
},
|
|
87
|
+
"execution": {
|
|
88
|
+
"kind": "http"
|
|
89
|
+
},
|
|
90
|
+
"examples": [
|
|
91
|
+
{
|
|
92
|
+
"title": "发起新会话",
|
|
93
|
+
"params": {
|
|
94
|
+
"username": "agent-user",
|
|
95
|
+
"content": "呼叫中心是什么?"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|