toolResult?: unknown
diff --git a/src/components/analysis/AIChat/ChatMessage.vue b/src/components/analysis/AIChat/ChatMessage.vue
index 45aae5e..d056ea6 100644
--- a/src/components/analysis/AIChat/ChatMessage.vue
+++ b/src/components/analysis/AIChat/ChatMessage.vue
@@ -43,6 +43,18 @@ function renderMarkdown(text: string): string {
return md.render(text)
}
+// 思考标签名称映射
+function getThinkLabel(tag: string): string {
+ const normalized = tag?.toLowerCase() || 'think'
+ if (normalized === 'analysis') return t('think.labels.analysis')
+ if (normalized === 'reasoning') return t('think.labels.reasoning')
+ if (normalized === 'reflection') return t('think.labels.reflection')
+ if (normalized === 'think' || normalized === 'thought' || normalized === 'thinking') {
+ return t('think.labels.think')
+ }
+ return t('think.labels.other', { tag })
+}
+
// 渲染后的 HTML(用于用户消息或纯文本 AI 消息)
const renderedContent = computed(() => {
if (!props.content) return ''
@@ -231,6 +243,19 @@ function formatToolParams(tool: ToolBlockContent): string {
/>
+
+
+
+ {{ getThinkLabel(block.tag) }}
+
+
+
+
{
+ const blocks = messages.value[aiMessageIndex].contentBlocks || []
+ const thinkTag = tag || 'think'
+ const lastBlock = blocks[blocks.length - 1]
+
+ if (lastBlock && lastBlock.type === 'think' && lastBlock.tag === thinkTag) {
+ lastBlock.text += text
+ } else {
+ blocks.push({ type: 'think', tag: thinkTag, text })
+ }
+
+ updateAIMessage({ contentBlocks: [...blocks] })
+ }
+
// 辅助函数:添加工具块
const addToolBlock = (toolName: string, params?: Record) => {
const blocks = messages.value[aiMessageIndex].contentBlocks || []
@@ -377,6 +393,13 @@ export function useAIChat(
}
break
+ case 'think':
+ // 思考内容 - 写入思考块
+ if (chunk.content) {
+ appendThinkToBlocks(chunk.content, chunk.thinkTag)
+ }
+ break
+
case 'tool_start':
// 工具开始执行 - 添加工具块到 contentBlocks
console.log('[AI] 工具开始执行:', chunk.toolName, chunk.toolParams)