From 6426e1aa65b844ed4eb67ff79714b50201f03010 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 8 Aug 2026 23:18:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20AgentInput=20inputed=20bind=20=E2=80=94?= =?UTF-8?q?=20stream=20NDJSON=20via=20body.getReader()=20instead=20of=20r.?= =?UTF-8?q?json()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/index.ui | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wwwroot/index.ui b/wwwroot/index.ui index 889f2ba..f9c22a9 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -157,7 +157,15 @@ ] } ], - "binds": [] + "binds": [ + { + "wid": "self", + "event": "inputed", + "actiontype": "script", + "target": "self", + "script": "console.log('AGENTIO inputed bind fired',JSON.stringify(params));var ai=this;if(ai.inputw&&!ai._done){ai._done=true;var orig=ai.user_inputed.bind(ai);ai.inputw.unbind('inputed');ai.inputw.bind('inputed',function(e){console.log('HOOKED:',e.params.prompt);orig(e);var p=e.params.prompt||'';var mid=e.params.model_id||'';var xhr=new XMLHttpRequest();xhr.open('POST',ai.opts.url);xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');var lastLen=0;xhr.onprogress=function(){var t=xhr.responseText;var d=t.substring(lastLen);lastLen=t.length;d.split(String.fromCharCode(10)).forEach(function(line){line=line.trim();if(!line)return;try{var obj=JSON.parse(line);console.log('STREAM:',line.substring(0,40))}catch(e){}})};xhr.onload=function(){console.log('DONE')};xhr.send('action=send_message&message_text='+encodeURIComponent(p)+'&model_id='+encodeURIComponent(mid))})}" + } + ] }, { "widgettype": "VBox",