From 9a6e7e1a75e34e348d419ca98073f732e0a8a0d9 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 9 Aug 2026 17:01:34 +0800 Subject: [PATCH] AgentOut: handle bricks widget descriptor JSON (widgettype) in streamed response --- bricks/agent.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bricks/agent.js b/bricks/agent.js index 60f4a6e..6ed099c 100644 --- a/bricks/agent.js +++ b/bricks/agent.js @@ -55,9 +55,20 @@ bricks.AgentOut = class extends bricks.VBox { this.content = ''; this.error = ''; this.qa_w = null; + this.bricks_widgets = []; // bricks widget descriptor chunks } update(data){ + // Handle bricks widget descriptor JSON ({"widgettype": "Text", "options": {...}}) + if (data.widgettype){ + bricks.widgetBuild(data).then(function(w){ + if (w){ + this.bricks_widgets.push(w); + this.add_widget(w); + } + }.bind(this)); + return; + } if (data.audio){ var url = data.audio; if (! data.audio.startsWith('http')){