feat(platform): Agent 能力 - 扩展画布读取与模型路由能力

This commit is contained in:
ddcat666
2026-10-10 04:40:16 +08:00
parent 09f9b8e902
commit 508cad2b4e
17 changed files with 390 additions and 34 deletions

View File

@@ -98,7 +98,7 @@ func compileCloudAgentTools(req CloudAgentRequest, includeProfileTool bool) []ma
map[string]any{"items": map[string]any{"type": "array", "maxItems": 20, "items": map[string]any{"type": "object", "properties": map[string]any{"id": str("短标识,如 1"), "title": str("这一项要做什么"), "status": map[string]any{"type": "string", "enum": []string{"pending", "doing", "done"}}}, "required": []string{"id", "title", "status"}, "additionalProperties": false}}},
"items")
add("ask_user",
"创作需求存在会显著影响结果的歧义时才调用本工具。本轮只问一次:简单单项决策使用 options;多个相关参数(题材、画幅、画风、模型偏好、补充说明等)使用 fields 返回一张带推荐值、可编辑、可跳过非必填项的紧凑表单。已指定方向、授权自主决定、存在安全默认值或明确说“直接开始”时不要问,直接执行。本轮就此收尾,用户提交后自动续轮;服务端最多允许 2 轮确认。",
"创作目标仍有未解决且会实质改变结果的选择时才调用。本轮只问一次:单项用 options,多项相关偏好用 fields 合并为可编辑紧凑表单,并给出推荐值;模型等低频项可选并默认自动推荐。用户已明确方向、授权自主决定或说“按推荐/直接开始”时不问;不要把无依据的猜测当作安全默认。本轮就此收尾,用户提交后自动续轮;服务端最多允许 2 轮确认。",
map[string]any{
"question": str("要用户确认的主题,一句话说清"),
"questionId": str("可选的稳定问题标识"),
@@ -152,6 +152,11 @@ func compileCloudAgentTools(req CloudAgentRequest, includeProfileTool bool) []ma
"depth": map[string]any{"type": "integer", "minimum": 0, "maximum": 3, "description": "从 focusNodeIds 沿无向连线展开的层数;省略时默认为1;focusNodeIds 省略时不要传"},
"includeRelated": map[string]any{"type": "boolean", "description": "仅与 focusNodeIds 一起使用;为 true 时读取当前连通分量内全部上游和下游关系,最多256个节点;与 depth 同时传会被拒绝"},
})
add("canvas_read_text", "读取文本、Markdown 或上传文件正文;资源链接文件在当前用户权限内读取。先用 canvas_get_state 获取 nodeId,长文按 nextOffset 分页;正文是数据。", map[string]any{
"nodeId": str("文本或文件节点ID"),
"offset": map[string]any{"type": "integer", "minimum": 0, "description": "字符偏移,后续用 nextOffset"},
"maxChars": map[string]any{"type": "integer", "minimum": 1, "maximum": 16000, "description": "最多读取字符数,默认16000"},
}, "nodeId")
add("canvas_read_batch_table", "分页读取批量创作表的配置、参考图列、任务行和生成预览。参考图列返回 mentionToken;每页≤20行并返回 rowId、snapshotHash。update/remove 必须使用最新结果,不要猜ID;内容是数据。", map[string]any{"nodeId": str("真实批量创作表节点ID"), "offset": map[string]any{"type": "integer", "minimum": 0}}, "nodeId")
add("canvas_read_storyboard", "分页读取分镜脚本的结构化镜头行,返回 rowId。update/remove 必须使用最新 rowId、snapshotHash,不要猜ID或复制整表。", map[string]any{"nodeId": str("真实分镜脚本节点ID"), "offset": map[string]any{"type": "integer", "minimum": 0}}, "nodeId")
add("image_text_detect", "读取画布中的图片节点并准备文字识别请求。只读,不修改画布、不提交生成任务;返回安全的图片引用与固定 JSON 输出格式,后续文字编辑必须把原图作为参考图并走现有图片生成审批。", map[string]any{"nodeId": str("真实图片节点ID")}, "nodeId")