diff --git a/src/constants/toolIcons.ts b/src/constants/toolIcons.ts index 8d866f9..18c4e1e 100644 --- a/src/constants/toolIcons.ts +++ b/src/constants/toolIcons.ts @@ -70,3 +70,9 @@ export const stopIconSvg = ` `; + +/** + * 探索智能体图标 SVG + */ +export const agentIconSvg = ` +`; diff --git a/src/views/agentCard.ts b/src/views/agentCard.ts index 1515750..2783cd7 100644 --- a/src/views/agentCard.ts +++ b/src/views/agentCard.ts @@ -2,310 +2,176 @@ * 智能体卡片组件 * * 功能说明: - * - 显示子智能体的执行过程 - * - 支持展开/收起步骤详情 - * - 显示执行状态和统计信息 + * - 提供智能体执行状态的可视化展示 + * - 显示智能体名称、状态和执行步骤 + * - 支持实时更新步骤信息 */ -import type { - AgentStartEvent, - AgentProgressEvent, - AgentCompleteEvent, - AgentErrorEvent -} from '../types/api'; +import { agentIconSvg } from "../constants/toolIcons"; /** - * 获取智能体卡片样式 + * 获取智能体卡片的样式 */ export function getAgentCardStyles(): string { return ` + /* 智能体卡片样式 */ + .segment-agent { + margin: 8px 0; + } .agent-card { - background: var(--vscode-editor-background); border: 1px solid var(--vscode-input-border); border-radius: 8px; - margin: 10px 0; overflow: hidden; + background: var(--vscode-editor-background); } - .agent-card-header { - display: flex; - align-items: center; - justify-content: space-between; - padding: 10px 12px; - background: var(--vscode-sideBar-background); - cursor: pointer; - user-select: none; - } - .agent-card-header:hover { - background: var(--vscode-list-hoverBackground); - } - .agent-card-title { + .agent-header { display: flex; align-items: center; gap: 8px; - font-weight: 500; + padding: 8px 12px; + background: var(--vscode-sideBar-background); + border-bottom: 1px solid var(--vscode-input-border); } - .agent-card-icon { + .agent-icon { font-size: 16px; } - .agent-card-status { - font-size: 12px; - padding: 2px 6px; - border-radius: 4px; + .agent-name { + font-weight: 500; + flex: 1; } - .agent-card-status.running { + .agent-status { + font-size: 11px; + padding: 2px 8px; + border-radius: 10px; + } + .agent-status.running { background: var(--vscode-inputValidation-infoBackground); color: var(--vscode-inputValidation-infoForeground); } - .agent-card-status.completed { - background: var(--vscode-testing-iconPassed); + .agent-status.completed { + background: #28a745; color: white; } - .agent-card-status.error { - background: var(--vscode-testing-iconFailed); + .agent-status.error { + background: #dc3545; color: white; } - .agent-card-toggle { + .agent-body { + padding: 8px; + } + .agent-steps-container { + max-height: 150px; + overflow-y: auto; font-size: 12px; - color: var(--vscode-descriptionForeground); - } - .agent-card-body { - padding: 12px; - border-top: 1px solid var(--vscode-input-border); - } - .agent-card-body.collapsed { - display: none; - } - .agent-card-instruction { - font-size: 13px; - color: var(--vscode-descriptionForeground); - margin-bottom: 10px; - padding-bottom: 10px; - border-bottom: 1px dashed var(--vscode-input-border); - } - .agent-steps { - font-size: 13px; } .agent-step { display: flex; - align-items: flex-start; - gap: 8px; - padding: 6px 0; - border-left: 2px solid var(--vscode-input-border); - padding-left: 12px; - margin-left: 6px; + align-items: center; + gap: 6px; + padding: 4px 8px; + border-radius: 4px; + margin-bottom: 4px; + background: var(--vscode-list-hoverBackground); } .agent-step:last-child { - border-left-color: transparent; + margin-bottom: 0; } - .agent-step-icon { + .step-icon { flex-shrink: 0; } - .agent-step-content { - flex: 1; - min-width: 0; - } - .agent-step-name { + .step-name { font-weight: 500; + color: var(--vscode-foreground); } - .agent-step-result { - font-size: 12px; + .step-result { color: var(--vscode-descriptionForeground); - margin-top: 2px; - white-space: nowrap; + font-size: 11px; overflow: hidden; text-overflow: ellipsis; + white-space: nowrap; } - .agent-card-summary { - font-size: 13px; - padding: 8px 12px; - background: var(--vscode-sideBar-background); - border-top: 1px solid var(--vscode-input-border); - } - .agent-card-error { - color: var(--vscode-errorForeground); - padding: 8px 12px; - background: var(--vscode-inputValidation-errorBackground); + .agent-step-placeholder { + color: var(--vscode-descriptionForeground); + font-style: italic; + padding: 8px; + text-align: center; } `; } /** - * 渲染智能体卡片(启动状态) - */ -export function renderAgentCardStart(event: AgentStartEvent): string { - return ` -