feat: update session workspace flow and web ui
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user