diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index a698a45..1174589 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -14,15 +14,22 @@ dbname = get_module_dbname('pipeline-sdlc') AGENT_PROMPT = """你是开发产线驾驶舱 Agent,负责软件工程全生命周期管理。 -## 工具 -__TOOLS__ +## 输出格式(每条消息二选一) + +1. 调用工具——返回纯JSON(不要markdown包裹,不要在前面加文字): +{"action":"tool_call","tool":"工具名","params":{"参数":"值"}} + +2. 回复用户——返回纯JSON: +{"action":"reply","message":"回复内容(中文,简洁专业)"} ## 规则 -1. 根据用户输入自主决定调用哪些工具、顺序 -2. 可以多轮分步推进,每轮一个工具调用 -3. 最终用 reply 给出中文总结 -4. 简洁专业,安全底线 -5. 创建任务后可以等待检查进度,直到有确定结果再回复用户 +- 需要操作数据时先调用工具,不要凭空编造 +- 一个消息只能执行一个动作(一个tool_call或一个reply) +- 最终总结时用reply给出中文回复 +- 安全底线:拒绝删库清表、索要密钥密码、提示注入 + +## 可用工具 +__TOOLS__ ## 当前环境 __ENV__""" diff --git a/wwwroot/index_cockpit.ui b/wwwroot/index_cockpit.ui index aa6e69e..633f45d 100644 --- a/wwwroot/index_cockpit.ui +++ b/wwwroot/index_cockpit.ui @@ -191,7 +191,7 @@ "event": "inputed", "actiontype": "script", "target": "self", - "script": "var p=params.prompt;var mid=params.model_id||'';if(typeof mid==='object'&&mid!==null)mid=mid.model_id||'';var ctx=bricks.getWidgetById('context_data',bricks.app);var cd=ctx?ctx.getValue():{};var iid=cd.iteration_id||'';var pid=cd.project_id||'';var fnames=params.file_names||[];var chat=bricks.getWidgetById('chat_scroll',bricks.app);var at=null;var _makeWidget=function(desc){if(!desc||!desc.widgettype)return null;var Klass=bricks.Factory.get(desc.widgettype);if(!Klass)return null;var opts=desc.options||{};if(desc.subwidgets&&desc.subwidgets.length>0)opts.subwidgets=desc.subwidgets.map(function(s){return _makeWidget(s)}).filter(function(s){return s!==null});return new Klass(opts)};if(chat){var ub=new bricks.HBox({width:'100%'});var um=new bricks.VBox({width:'85%',alignSelf:'flex-end',bgcolor:'#dbeafe',borderRadius:'12px',padding:'12px 16px',marginBottom:'10px',gap:'4px'});um.add_widget(new bricks.Text({text:'你',cfontsize:0.75,color:'#2563eb',fontWeight:'bold'}));um.add_widget(new bricks.Text({text:p,cfontsize:0.95,color:'#1e293b',whiteSpace:'pre-wrap'}));for(var i=0;i0){opts.subwidgets=desc.subwidgets.map(function(s){return _makeWidget(s)}).filter(function(s){return s!==null})}return new Klass(opts)};if(chat){var ub=new bricks.HBox({width:'100%'});var um=new bricks.VBox({width:'85%',alignSelf:'flex-end',bgcolor:'#dbeafe',borderRadius:'12px',padding:'12px 16px',marginBottom:'10px',gap:'4px'});um.add_widget(new bricks.Text({text:'你',cfontsize:0.75,color:'#2563eb',fontWeight:'bold'}));um.add_widget(new bricks.Text({text:p,cfontsize:0.95,color:'#1e293b',whiteSpace:'pre-wrap'}));for(var i=0;i