feat: 优化消息处理和界面显示

- 增强 messageHandler 消息处理逻辑
   - 优化 messageArea 显示效果
   - 改进 webviewContent 界面交互
This commit is contained in:
Roe-xin
2026-03-10 18:39:50 +08:00
parent c244a308d7
commit 29e80ce296
3 changed files with 32 additions and 8 deletions

View File

@ -306,10 +306,18 @@ async function handleUserMessageWithBackend(
},
onSegmentUpdate: (segments) => {
// 过滤掉包含 [调用工具:xxx] 的段落
const filteredSegments = segments.filter(seg => {
if (seg.type === 'text' && typeof seg.content === 'string') {
return !/\[调用工具:.+?\]/.test(seg.content);
}
return true;
});
// 实时发送段落更新,按后端返回顺序展示
panel.webview.postMessage({
command: "updateSegments",
segments: segments,
segments: filteredSegments,
});
},