index.ui(chat_io) + index_cockpit.ui(chat_input) 两处 AgentIO options 加 secret_dataurl/secret_format/secret_title/secret_tip,指向 pipeline_core 的 secret_options.dspy。驾驶舱会话可用钥匙图标插入 @@sec:NAME@@ 占位符。
208 lines
11 KiB
XML
208 lines
11 KiB
XML
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"padding": "0"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"alignItems": "center",
|
|
"padding": "16px 24px 8px 24px",
|
|
"cheight": 6,
|
|
"gap": "12px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Title2",
|
|
"options": {
|
|
"otext": "开发产线驾驶舱", "text": "开发产线驾驶舱", "i18n": true
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"otext": "AI驱动的对话式开发", "text": "AI驱动的对话式开发", "i18n": true,
|
|
"cfontsize": 0.9,
|
|
"color": "#94a3b8"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Filler"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"padding": "8px 24px 8px 24px",
|
|
"cheight": 4,
|
|
"gap": "16px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "urlwidget",
|
|
"id": "stats_row",
|
|
"options": {
|
|
"url": "{{entire_url('/pipeline-sdlc/api/cockpit_stats.dspy')}}",
|
|
"method": "GET"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"id": "context_bar",
|
|
"options": {
|
|
"width": "100%",
|
|
"padding": "4px 24px 4px 24px",
|
|
"cheight": 2.5,
|
|
"gap": "12px",
|
|
"alignItems": "center",
|
|
"bgcolor": "#e8f0fe"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Html",
|
|
"options": {
|
|
"html": "\u003cscript>setTimeout(function(){console.log('DIAG: page loaded, checking bricks');var ai=bricks.getWidgetById('chat_input',bricks.app);console.log('DIAG: chat_input widget:',ai?'found':'NOT FOUND','type:',ai?ai.constructor.name:'N/A','url:',ai?ai.opts.url:'N/A');if(ai&&ai.inputw){console.log('DIAG: inputw found, bind check');ai.inputw.unbind('inputed');ai.inputw.bind('inputed',function(e){console.log('DIAG: inputed RAW event:',JSON.stringify(e.params));});}fetch('/pipeline-sdlc/api/cockpit_context.dspy').then(function(r){return r.json()}).then(function(d){if(d.project_id){var sel=bricks.getWidgetById('project_selector',bricks.app);if(sel)sel.setValue(d.project_id);}})},200);\u003c/script>",
|
|
"height": "0",
|
|
"width": "0"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Form",
|
|
"id": "project_form",
|
|
"options": {
|
|
"name": "project_form",
|
|
"cols": 1,
|
|
"fields": [
|
|
{
|
|
"name": "project_id",
|
|
"uitype": "code",
|
|
"label": "",
|
|
"placeholder": "选择项目",
|
|
"cwidth": 20,
|
|
"dataurl": "/pipeline-sdlc/api/cockpit_project_picker.dspy",
|
|
"valueField": "value",
|
|
"textField": "text",
|
|
"nullable": true
|
|
}
|
|
]
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"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)+'&session_id='+encodeURIComponent(window._sid())}).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('任务');var io=bricks.getWidgetById('chat_input',bricks.app);var ms=io&&io.inputw&&io.inputw.model_selector;if(ms&&ms.loadData)ms.loadData();}})"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"id": "task_btn",
|
|
"options": {
|
|
"label": "任务",
|
|
"css": "small"
|
|
}
|
|
}
|
|
],
|
|
"binds": []
|
|
},
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"css": "filler",
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"padding": "0 24px 0 24px",
|
|
"gap": "0"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VScrollPanel",
|
|
"id": "chat_scroll",
|
|
"options": {
|
|
"css": "filler",
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"bgcolor": "#f8fafc",
|
|
"border": "1px solid #e2e8f0",
|
|
"borderBottom": "none",
|
|
"borderRadius": "8px 8px 0 0",
|
|
"padding": "16px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"alignItems": "center",
|
|
"padding": "40px 0",
|
|
"gap": "12px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"otext": "选择一个迭代后,在下方输入你的需求。", "text": "选择一个迭代后,在下方输入你的需求。", "i18n": true,
|
|
"cfontsize": 1,
|
|
"color": "#64748b"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"otext": "Agent 将自动分析需求、生成设计、驱动产线执行。", "text": "Agent 将自动分析需求、生成设计、驱动产线执行。", "i18n": true,
|
|
"cfontsize": 0.85,
|
|
"color": "#94a3b8"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"bgcolor": "#fff",
|
|
"border": "1px solid #e2e8f0",
|
|
"borderTop": "none",
|
|
"borderRadius": "0 0 8px 8px",
|
|
"padding": "0"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "AgentIO",
|
|
"id": "chat_input",
|
|
"options": {
|
|
"placeholder": "输入你的需求...",
|
|
"secret_dataurl": "/pipeline_core/api/secret_options.dspy",
|
|
"secret_format": "@@sec:{name}@@",
|
|
"secret_title": "选择敏感信息",
|
|
"secret_tip": "插入敏感信息",
|
|
"url": "/pipeline-sdlc/api/cockpit_chat_v2.dspy",
|
|
"model_dataurl": "/pipeline-sdlc/api/cockpit_model_options.dspy",
|
|
"model_cwidth": 14
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "inputed",
|
|
"actiontype": "script",
|
|
"target": "self",
|
|
"script": "var ai=bricks.getWidgetById('chat_input',bricks.app);if(ai&&ai.inputw&&!ai._hooked){ai._hooked=true;ai.inputw.unbind('inputed');ai.inputw.bind('inputed',function(e){console.log('HOOKED inputed');var p=e.params.prompt||'';var mid=e.params.model_id||'';var chat=bricks.getWidgetById('chat_scroll',bricks.app);var at=null;if(chat){var ab=new bricks.HBox({width:'100%'});var am=new bricks.VBox({width:'85%',alignSelf:'flex-start',bgcolor:'#e8f0fe',borderRadius:'12px',padding:'12px 16px',marginBottom:'10px',gap:'4px'});am.add_widget(new bricks.Text({text:'Agent',cfontsize:0.75,color:'#3b82f6',fontWeight:'bold'}));at=new bricks.Text({text:'...',cfontsize:0.85,color:'#64748b'});am.add_widget(at);ab.add_widget(new bricks.Svg({rate:2,url:bricks_resource('imgs/llm.svg')}));ab.add_widget(am);ab.add_widget(new bricks.VBox({css:'filler'}));chat.add_widget(ab)}var xhr=new XMLHttpRequest();xhr.open('POST','/pipeline-sdlc/api/cockpit_chat_v2.dspy');var lastLen=0;xhr.onprogress=function(){var t=xhr.responseText;var d=t.substring(lastLen);lastLen=t.length;var lines=d.split(String.fromCharCode(10));for(var j=0;j<lines.length;j++){var line=lines[j].trim();if(!line)continue;try{var obj=JSON.parse(line);if(obj.content&&at){var pw=at.parent();if(pw){pw.remove_widget(at);at=null}var tw=new bricks.Text({text:obj.content,cfontsize:0.85,color:'#334155',whiteSpace:'pre-wrap',width:'100%'});pw.add_widget(tw);chat.scrollToBottom()}}catch(e){console.log(e)}}};xhr.onload=function(){var s=bricks.getWidgetById('stats_row',bricks.app);if(s)s.render({})};xhr.onerror=function(){if(at)at.set_text('网络错误')};var fd=new FormData();fd.append('message_text',p);fd.append('model_id',mid);(e.params.add_files||[]).forEach(function(f){fd.append('file',f)});xhr.send(fd)})}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |