fix: index.ui AgentInput→AgentIO + url + hook in project_form.changed

This commit is contained in:
ymq 2026-08-08 22:56:38 +08:00
parent 2ca5b5a808
commit acc84707e3

View File

@ -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 @@
]
}
]
}
}