diff --git a/src/constants/toolIcons.ts b/src/constants/toolIcons.ts index 18c4e1e..d7c0edd 100644 --- a/src/constants/toolIcons.ts +++ b/src/constants/toolIcons.ts @@ -76,3 +76,8 @@ export const stopIconSvg = ` */ export const agentIconSvg = ` `; + +/** + * planner 图标 SVG + */ +export const plannerIconSvg = ``; diff --git a/src/views/messageArea.ts b/src/views/messageArea.ts index bf5eef2..37432f6 100644 --- a/src/views/messageArea.ts +++ b/src/views/messageArea.ts @@ -22,6 +22,7 @@ import { getWaveformPreviewScript, } from "./waveformPreviewContent"; import { getAgentCardStyles, getAgentCardScript } from "./agentCard"; +import { getPlanCardStyles, getPlanCardScript } from "./planCard"; /** * 获取消息区域的 HTML 内容 @@ -532,87 +533,7 @@ export function getMessageAreaStyles(): string { ${getAgentCardStyles()} - /* 计划卡片样式 */ - .segment-plan { - margin: 8px 0; - } - .plan-card { - border: 1px solid var(--vscode-input-border); - border-radius: 8px; - overflow: hidden; - background: var(--vscode-editor-background); - } - .plan-header { - display: flex; - align-items: center; - gap: 8px; - padding: 10px 12px; - background: var(--vscode-sideBar-background); - border-bottom: 1px solid var(--vscode-input-border); - } - .plan-icon { - font-size: 18px; - } - .plan-title { - font-weight: 600; - font-size: 14px; - } - .plan-body { - padding: 12px; - } - .plan-summary { - color: var(--vscode-descriptionForeground); - margin-bottom: 10px; - font-size: 13px; - } - .plan-steps { - font-size: 13px; - } - .plan-step { - padding: 6px 8px; - margin-bottom: 4px; - background: var(--vscode-list-hoverBackground); - border-radius: 4px; - } - .plan-step:last-child { - margin-bottom: 0; - } - .step-num { - color: var(--vscode-textLink-foreground); - font-weight: 500; - margin-right: 4px; - } - .plan-actions { - display: flex; - gap: 8px; - padding: 12px; - border-top: 1px solid var(--vscode-input-border); - background: var(--vscode-sideBar-background); - } - .plan-btn { - padding: 6px 16px; - border-radius: 4px; - border: none; - cursor: pointer; - font-size: 12px; - font-weight: 500; - } - .plan-btn-confirm { - background: var(--vscode-button-background); - color: var(--vscode-button-foreground); - } - .plan-btn-confirm:hover { - background: var(--vscode-button-hoverBackground); - } - .plan-btn-modify { - background: var(--vscode-input-background); - color: var(--vscode-foreground); - border: 1px solid var(--vscode-input-border); - } - .plan-btn-cancel { - background: transparent; - color: var(--vscode-descriptionForeground); - } + ${getPlanCardStyles()} ${getWaveformPreviewContent()} `; @@ -631,6 +552,8 @@ export function getMessageAreaScript(): string { ${getAgentCardScript()} + ${getPlanCardScript()} + // 工具名称映射 function getToolDisplayName(toolName) { const toolNameMap = { @@ -653,6 +576,8 @@ export function getMessageAreaScript(): string { 'addPlan': '已添加计划', 'addEdge': '已添加边', 'showPlan': '已显示计划', + 'addRule': '已添加规则', + 'updateNode': '已更新节点', 'spawnExplorer': '代码探索' }; return toolNameMap[toolName] || toolName; @@ -1026,92 +951,8 @@ export function getMessageAreaScript(): string { // 智能体卡片渲染 renderAgentCard(segment, segmentDiv); } else if (segment.type === 'plan') { - // 计划卡片渲染(类似 askUser) - segmentDiv.className += ' segment-plan'; - - // 检查是否已回答 - const isAnswered = answeredQuestions.has(segment.askId); - const selectedAnswer = answeredQuestions.get(segment.askId); - - if (isAnswered) { - segmentDiv.classList.add('answered'); - } - - const stepsHtml = (segment.planSteps || []).map((step, i) => - \`