From acc84707e34940d00e3e48771edf9b551042c5f9 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 8 Aug 2026 22:56:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20index.ui=20AgentInput=E2=86=92AgentIO=20?= =?UTF-8?q?+=20url=20+=20hook=20in=20project=5Fform.changed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/index.ui | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wwwroot/index.ui b/wwwroot/index.ui index b0d4e86..b4407ca 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -81,7 +81,7 @@ "event": "changed", "actiontype": "script", "target": "self", - "script": "var v=this.getValue();var pid=(v||{}).project_id||'';if(!pid)return;fetch('/pipeline-sdlc/api/cockpit_context_update.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'project_id='+encodeURIComponent(pid)}).then(function(r){return r.json()}).then(function(r){if(r.success){var pl=bricks.getWidgetById('task_btn',bricks.app);if(pl&&pl.text_w)pl.text_w.set_text('\\u4efb\\u52a1');}})" + "script": "var ai=bricks.getWidgetById('chat_input',bricks.app);console.log('HOOK: ai=',ai?'found':'null','inputw=',ai&&ai.inputw?'found':'null');if(ai&&ai.inputw&&!ai._hooked){ai._hooked=true;ai.inputw.unbind('inputed');ai.inputw.bind('inputed',function(e){console.log('HOOK inputed:',JSON.stringify(e.params));var p=e.params.prompt||'';var mid=e.params.model_id||'';ai.show_input(e.params);var chat=ai.msg_box;var mout=new bricks.AgentOutput({});chat.add_widget(mout);var xhr=new XMLHttpRequest();xhr.open('POST','/pipeline-sdlc/api/cockpit_chat.dspy');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);if(obj.content){mout.update_data(obj)}}catch(e){console.log('err:',line.substring(0,40))}})};xhr.send('action=send_message&message_text='+encodeURIComponent(p)+'&model_id='+encodeURIComponent(mid))})};var v=this.getValue();var pid=(v||{}).project_id||'';if(!pid)return;fetch('/pipeline-sdlc/api/cockpit_context_update.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'project_id='+encodeURIComponent(pid)}).then(function(r){return r.json()}).then(function(r){if(r.success){var pl=bricks.getWidgetById('task_btn',bricks.app);if(pl&&pl.text_w)pl.text_w.set_text('\\u4efb\\u52a1');}})" } ] }, @@ -126,7 +126,8 @@ "border": "1px solid #e2e8f0", "borderBottom": "none", "borderRadius": "8px 8px 0 0", - "padding": "16px" + "padding": "16px", + "url": "/pipeline-sdlc/api/cockpit_chat.dspy" }, "subwidgets": [ { @@ -168,7 +169,7 @@ }, "subwidgets": [ { - "widgettype": "AgentInput", + "widgettype": "AgentIO", "id": "chat_input", "options": { "placeholder": "输入你的需求...", @@ -190,4 +191,4 @@ ] } ] -} +} \ No newline at end of file