新增应用样式 agent 工具
This commit is contained in:
@@ -25,6 +25,11 @@ import {
|
||||
type ChatToolAction,
|
||||
} from "@/store/chatToolStore";
|
||||
import type { ToolCall } from "./chatMessageSections";
|
||||
import {
|
||||
APPLY_LAYER_STYLE_TOOL,
|
||||
describeApplyLayerStyle,
|
||||
parseApplyLayerStylePayload,
|
||||
} from "./toolCallStyleHelpers";
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Interactive card rendered inside a chat bubble for tool actions */
|
||||
@@ -137,6 +142,12 @@ const TOOL_META: Record<string, ToolMeta> = {
|
||||
actionLabel: "应用渲染",
|
||||
color: "#3b82f6",
|
||||
},
|
||||
[APPLY_LAYER_STYLE_TOOL]: {
|
||||
label: "图层样式",
|
||||
icon: <LocationOnRounded sx={{ fontSize: 18 }} />,
|
||||
actionLabel: "应用样式",
|
||||
color: "#14b8a6",
|
||||
},
|
||||
};
|
||||
|
||||
/* ---------- helpers ---------- */
|
||||
@@ -270,6 +281,10 @@ function getToolDescription(toolCall: ToolCall): string {
|
||||
case "render_junctions": {
|
||||
return (params.render_ref as string | undefined) ?? "渲染引用";
|
||||
}
|
||||
case APPLY_LAYER_STYLE_TOOL: {
|
||||
const payload = parseApplyLayerStylePayload(params);
|
||||
return payload ? describeApplyLayerStyle(payload) : "图层样式";
|
||||
}
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -403,6 +418,18 @@ function buildAction(toolCall: ToolCall): ChatToolAction | null {
|
||||
renderRef,
|
||||
};
|
||||
}
|
||||
case APPLY_LAYER_STYLE_TOOL: {
|
||||
const payload = parseApplyLayerStylePayload(params);
|
||||
if (!payload) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
type: "apply_layer_style",
|
||||
layerId: payload.layerId,
|
||||
resetToDefault: payload.resetToDefault,
|
||||
styleConfig: payload.styleConfig,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user