feat: update session workspace flow and web ui

This commit is contained in:
shiyue
2026-03-30 04:31:25 +08:00
parent a29af2767e
commit a3df0cc6f0
9 changed files with 1546 additions and 55 deletions

View File

@@ -339,8 +339,21 @@ function createAgentRuntime(deps) {
if (!item || !item.id) break;
if (item.type === 'agent_message') {
if (item.text) {
entry.fullText += item.text;
wsSend(entry.ws, { type: 'text_delta', text: item.text });
let parsedContent = null;
try {
parsedContent = JSON.parse(item.text);
} catch {}
if (parsedContent && Array.isArray(parsedContent)) {
if (!entry.contentBlocks) entry.contentBlocks = [];
entry.contentBlocks.push(...parsedContent);
const textOnly = parsedContent.filter(b => b.type === 'text').map(b => b.text || '').join('');
entry.fullText += textOnly;
wsSend(entry.ws, { type: 'content_blocks', blocks: parsedContent });
} else {
entry.fullText += item.text;
wsSend(entry.ws, { type: 'text_delta', text: item.text });
}
}
break;
}