优化 junctions 渲染工具描述,增强使用说明;修改agent描述,禁止去读取完整的引用文件内容
Agent CI/CD / docker-image (push) Successful in 7s
Agent CI/CD / deploy-fallback-log (push) Has been skipped

This commit is contained in:
2026-05-19 17:07:04 +08:00
parent 105dfea18e
commit 96d894d1e0
2 changed files with 19 additions and 12 deletions
+6 -2
View File
@@ -1,16 +1,20 @@
import { tool } from "@opencode-ai/plugin";
export default tool({
description: "在前端地图上对 junctions 图层应用分区渲染。",
description:
"在前端地图上对 junctions 图层应用分区渲染。优先直接传入 render_ref(指向已持久化的渲染结果引用),不要先把 ref 内容完整读出再重组;前端会自行根据 render_ref 拉取完整 payload 并渲染,这样可以避免 LLM 读取大型 node_area_map。若必须自行构造供 render_ref 引用的 JSON,其 data 结构必须为 { node_area_map: Record<string, string>, area_ids?: string[], area_colors?: Record<string, string> },其中 node_area_map 的 key 是 junction/node idvalue 是 area id。",
args: {
reason: tool.schema
.string()
.describe("Why this junction rendering action is needed for the user request."),
render_ref: tool.schema
.string()
.describe("Reference to a stored junction rendering payload resolved by the Agent service."),
.describe(
"渲染引用 ID。直接传持久化 render_ref 即可,前端会按该引用读取完整 payload.data 并渲染,不需要先用 fetch_result_ref 提取完整数据。render_ref 对应的数据结构必须是 { node_area_map: { [junctionId]: areaId }, area_ids?: string[], area_colors?: { [areaId]: color } }node_area_map 必填,area_ids / area_colors 可选。",
),
},
async execute() {
// 工具参数里只需要 render_ref;浏览器端会再用该引用回读完整 payload.data 并完成渲染。
return "已在地图上应用节点分区渲染。";
},
});