tianxincode 1.0.30 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/components/Header.js +1 -1
  2. package/dist/modules/hooks/handlers/memory.handler.d.ts.map +1 -1
  3. package/dist/modules/hooks/handlers/memory.handler.js +3 -2
  4. package/dist/modules/hooks/handlers/memory.handler.js.map +1 -1
  5. package/package.json +1 -1
  6. package/web/dist/assets/{AiLogsView-CIxbi3Te.js → AiLogsView-DJZLaAiD.js} +1 -1
  7. package/web/dist/assets/{ConfirmDialog-OCsjOe8X.js → ConfirmDialog-CnoVNYtH.js} +1 -1
  8. package/web/dist/assets/{CustomActionsView-IZMOHhZZ.js → CustomActionsView-Dwo20fNr.js} +1 -1
  9. package/web/dist/assets/{DevWorkflowView-2l1EOqLE.js → DevWorkflowView-B5clzQix.js} +4 -4
  10. package/web/dist/assets/DevWorkflowView-Bk0OoCiV.css +1 -0
  11. package/web/dist/assets/{DevWorkflowView-DVK68zH4.js → DevWorkflowView-CyOh99Rf.js} +1 -1
  12. package/web/dist/assets/{GitChanges-D8g3Vgrf.js → GitChanges-SvO9k1WC.js} +1 -1
  13. package/web/dist/assets/{GitChangesApp-CYA5WaWq.js → GitChangesApp-CqxfSujn.js} +1 -1
  14. package/web/dist/assets/{Layout-8r9wJTpA.js → Layout-BNmgOpYh.js} +1 -1
  15. package/web/dist/assets/{TasksView-BSg84kyY.js → TasksView-RUdoJdnW.js} +1 -1
  16. package/web/dist/assets/{TerminalView-Cj8Aki8h.js → TerminalView-C-kMVKFY.js} +1 -1
  17. package/web/dist/assets/{WikiView-DyTQrEN2.js → WikiView-nQlLv75M.js} +1 -1
  18. package/web/dist/assets/{cssMode-DiZeIxBy.js → cssMode-CWUpS9Lk.js} +1 -1
  19. package/web/dist/assets/{freemarker2-DF6toOS9.js → freemarker2-DD-bFfVJ.js} +1 -1
  20. package/web/dist/assets/{handlebars-BzUg_EEs.js → handlebars-Dry8y7RL.js} +1 -1
  21. package/web/dist/assets/{html-z5jzcEHK.js → html-RaMIULea.js} +1 -1
  22. package/web/dist/assets/{htmlMode-DkmEWkZl.js → htmlMode-DhiO4Mtm.js} +1 -1
  23. package/web/dist/assets/{index-BvLW1aj9.js → index-DEabcW89.js} +7 -7
  24. package/web/dist/assets/{javascript-x25JHy7X.js → javascript-BADKuZJe.js} +1 -1
  25. package/web/dist/assets/{jsonMode-Cqz5dGc8.js → jsonMode-BTTCWwmC.js} +1 -1
  26. package/web/dist/assets/{liquid-H_2fkFOb.js → liquid-BHt_ZVeJ.js} +1 -1
  27. package/web/dist/assets/{mdx-CRINdcic.js → mdx-BcW1RSn5.js} +1 -1
  28. package/web/dist/assets/{python-SFSAyBx7.js → python-BOwxOcVC.js} +1 -1
  29. package/web/dist/assets/{razor-BbQbHOeF.js → razor-BLbUc77s.js} +1 -1
  30. package/web/dist/assets/{tsMode-BlaX9nrp.js → tsMode-6ZquyGbx.js} +1 -1
  31. package/web/dist/assets/{typescript-RcgjsDZ3.js → typescript-DPRHE3q6.js} +1 -1
  32. package/web/dist/assets/{xml-fhWLLp79.js → xml-8Xx64-IH.js} +1 -1
  33. package/web/dist/assets/{yaml-CdvXAzw2.js → yaml-DKsYwq1n.js} +1 -1
  34. package/web/dist/index.html +1 -1
  35. package/web/dist/assets/DevWorkflowView-C48T1Vn9.css +0 -1
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Box, Text } from 'ink';
3
- const VERSION = '1.0.30';
3
+ const VERSION = '1.0.31';
4
4
  export const Header = React.memo(function Header() {
5
5
  return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1 },
6
6
  React.createElement(Text, { bold: true, cyan: true }, " "),
@@ -1 +1 @@
1
- {"version":3,"file":"memory.handler.d.ts","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,EAAE,WAAW,CAAW;IAC/B,iBAAiB,EAAE,WAAW,EAAE,CAAkC;IAE5D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBlD"}
1
+ {"version":3,"file":"memory.handler.d.ts","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,EAAE,WAAW,CAAW;IAC/B,iBAAiB,EAAE,WAAW,EAAE,CAAkC;IAE5D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBlD"}
@@ -10,14 +10,15 @@ export class MemoryHandler extends HookHandler {
10
10
  }
11
11
  async handle(message) {
12
12
  try {
13
- const providerConfig = configService.getDefaultProvider();
13
+ const defaultModel = configService.getDefaultModel();
14
+ const providerConfig = configService.getModelProvider(defaultModel);
14
15
  if (!providerConfig) {
15
16
  return;
16
17
  }
17
18
  const provider = new OpenAIProvider({
18
19
  apiKey: providerConfig.apiKey,
19
20
  baseUrl: providerConfig.baseUrl,
20
- defaultModel: configService.getDefaultModel(),
21
+ defaultModel,
21
22
  });
22
23
  const projectPath = this.getProjectPath(message);
23
24
  const memAgent = new MemAgent({ provider, workDir: projectPath });
@@ -1 +1 @@
1
- {"version":3,"file":"memory.handler.js","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QACE,YAAO,GAAgB,OAAO,CAAC;QAC/B,sBAAiB,GAAkB,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAsBpE,CAAC;IApBC,KAAK,CAAC,MAAM,CAAC,OAAoB;QAC/B,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,aAAa,CAAC,kBAAkB,EAAE,CAAC;YAC1D,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,OAAO;YACT,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC;gBAClC,MAAM,EAAE,cAAc,CAAC,MAAM;gBAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;gBAC/B,YAAY,EAAE,aAAa,CAAC,eAAe,EAAE;aAC9C,CAAC,CAAC;YAEH,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;YAClE,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"memory.handler.js","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QACE,YAAO,GAAgB,OAAO,CAAC;QAC/B,sBAAiB,GAAkB,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAuBpE,CAAC;IArBC,KAAK,CAAC,MAAM,CAAC,OAAoB;QAC/B,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,aAAa,CAAC,eAAe,EAAE,CAAC;YACrD,MAAM,cAAc,GAAG,aAAa,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACpE,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,OAAO;YACT,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC;gBAClC,MAAM,EAAE,cAAc,CAAC,MAAM;gBAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;gBAC/B,YAAY;aACb,CAAC,CAAC;YAEH,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;YAClE,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tianxincode",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "type": "module",
5
5
  "description": "AI Coding Assistant",
6
6
  "main": "dist/index.js",
@@ -1 +1 @@
1
- import{n as x,a as n}from"./index-BvLW1aj9.js";const c=[{key:"ai_call_logs",name:"AI 日志",icon:"fa-solid fa-robot text-xs"}],p={name:"AiLogsView",data(){return{logTypes:c,selectedLogType:c[0],logs:[],page:1,pageSize:20,total:0,totalPages:1,sessions:[],loading:!1,filters:{callType:"",sessionId:"",startTime:"",endTime:""}}},async created(){await this.loadSessions(),await this.loadLogs()},methods:{async loadSessions(){try{const s=await n.getSessions(100,0);this.sessions=s.data||[]}catch(s){console.error("Load sessions failed:",s)}},selectLogType(s){this.selectedLogType=s,this.resetFilters()},async loadLogs(){this.loading=!0;try{const s=await n.getAiCallLogs(this.page,this.pageSize);let t=s.data.rows||[];if(this.filters.callType&&(t=t.filter(e=>e.call_type===this.filters.callType)),this.filters.sessionId&&(t=t.filter(e=>e.session_id&&e.session_id.includes(this.filters.sessionId))),this.filters.startTime){const e=new Date(this.filters.startTime).getTime();t=t.filter(l=>new Date(l.request_time).getTime()>=e)}if(this.filters.endTime){const e=new Date(this.filters.endTime).getTime();t=t.filter(l=>new Date(l.request_time).getTime()<=e)}this.logs=t,this.total=s.data.total,this.totalPages=s.data.totalPages}catch(s){console.error("Load logs failed:",s),this.logs=[]}finally{this.loading=!1}},resetFilters(){this.filters.callType="",this.filters.sessionId="",this.filters.startTime="",this.filters.endTime="",this.page=1,this.loadLogs()},async prevPage(){this.page>1&&(this.page--,await this.loadLogs())},async nextPage(){this.page<this.totalPages&&(this.page++,await this.loadLogs())},formatTime(s){return s?new Date(s).toLocaleString("zh-CN"):"-"},getSessionTitle(s){if(!s)return"-";const t=this.sessions.find(e=>e.id===s);return t?t.title:s.substring(0,8)},formatDuration(s){return s?s<1e3?`${s}ms`:`${(s/1e3).toFixed(2)}s`:"0ms"}}};var b=function(){var l,d;var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden"},[e("aside",{staticClass:"w-[260px] bg-sidebar border-r border-border flex flex-col shrink-0"},[t._m(0),e("div",{staticClass:"flex-1 overflow-y-auto py-1"},t._l(t.logTypes,function(a){var i;return e("div",{key:a.key,staticClass:"flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm",class:((i=t.selectedLogType)==null?void 0:i.key)===a.key?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(r){return t.selectLogType(a)}}},[e("i",{class:a.icon}),e("span",{staticClass:"truncate"},[t._v(t._s(a.name))])])}),0)]),e("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-[#1e1e1e]"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar"},[e("div",{staticClass:"flex items-center gap-4 mb-3"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{class:(l=t.selectedLogType)==null?void 0:l.icon}),e("span",{staticClass:"text-white font-medium"},[t._v(t._s((d=t.selectedLogType)==null?void 0:d.name))])]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.total)+" 条记录")])]),e("div",{staticClass:"flex items-center gap-4 flex-wrap"},[e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("调用类型:")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.filters.callType,expression:"filters.callType"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",on:{change:[function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var o="_value"in r?r._value:r.value;return o});t.$set(t.filters,"callType",a.target.multiple?i:i[0])},t.loadLogs]}},[e("option",{attrs:{value:""}},[t._v("全部")]),e("option",{attrs:{value:"tool_call"}},[t._v("工具调用")]),e("option",{attrs:{value:"normal"}},[t._v("普通对话")])])]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("会话:")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.filters.sessionId,expression:"filters.sessionId"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",on:{change:[function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var o="_value"in r?r._value:r.value;return o});t.$set(t.filters,"sessionId",a.target.multiple?i:i[0])},t.loadLogs]}},[e("option",{attrs:{value:""}},[t._v("全部会话")]),t._l(t.sessions,function(a){return e("option",{key:a.id,domProps:{value:a.id}},[t._v(t._s(a.title))])})],2)]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("开始时间:")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.startTime,expression:"filters.startTime"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",attrs:{type:"datetime-local"},domProps:{value:t.filters.startTime},on:{change:t.loadLogs,input:function(a){a.target.composing||t.$set(t.filters,"startTime",a.target.value)}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("结束时间:")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.endTime,expression:"filters.endTime"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",attrs:{type:"datetime-local"},domProps:{value:t.filters.endTime},on:{change:t.loadLogs,input:function(a){a.target.composing||t.$set(t.filters,"endTime",a.target.value)}}})]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.loadLogs}},[t._v(" 查询 ")]),e("button",{staticClass:"px-3 py-1 text-textMuted text-xs rounded hover:bg-white/10",on:{click:t.resetFilters}},[t._v(" 重置 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(1),e("tbody",[t._l(t.logs,function(a){return e("tr",{key:a.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.id))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatTime(a.request_time)))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("span",{staticClass:"text-xs px-2 py-0.5 rounded",class:a.call_type==="tool_call"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"},[t._v(" "+t._s(a.call_type==="tool_call"?"工具调用":"普通对话")+" ")])]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.model_name))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatDuration(a.duration_ms)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.input_tokens||0))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.output_tokens||0))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v("$"+t._s((a.cost||0).toFixed(4)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30 truncate max-w-[150px]",attrs:{title:a.session_id}},[t._v(t._s(t.getSessionTitle(a.session_id)))])])}),t.logs.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"9"}},[t._v("暂无数据")])]):t._e()],2)])]),e("div",{staticClass:"flex items-center justify-between px-4 py-2 border-t border-border bg-sidebar"},[e("span",{staticClass:"text-xs text-textMuted"},[t._v("共 "+t._s(t.total)+" 条")]),e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:t.page<=1},on:{click:t.prevPage}},[e("i",{staticClass:"fa-solid fa-chevron-left"}),t._v(" 上一页 ")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.page)+" / "+t._s(t.totalPages||1))]),e("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:t.page>=t.totalPages},on:{click:t.nextPage}},[t._v(" 下一页 "),e("i",{staticClass:"fa-solid fa-chevron-right"})])])])])])},f=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[t("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-list"}),s._v(" 日志 ")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("ID")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("时间")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("类型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("模型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("耗时")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("输入Token")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("输出Token")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("费用")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("会话ID")])])])}],u=x(p,b,f,!1,null,null);const _=u.exports;export{_ as default};
1
+ import{n as x,a as n}from"./index-DEabcW89.js";const c=[{key:"ai_call_logs",name:"AI 日志",icon:"fa-solid fa-robot text-xs"}],p={name:"AiLogsView",data(){return{logTypes:c,selectedLogType:c[0],logs:[],page:1,pageSize:20,total:0,totalPages:1,sessions:[],loading:!1,filters:{callType:"",sessionId:"",startTime:"",endTime:""}}},async created(){await this.loadSessions(),await this.loadLogs()},methods:{async loadSessions(){try{const s=await n.getSessions(100,0);this.sessions=s.data||[]}catch(s){console.error("Load sessions failed:",s)}},selectLogType(s){this.selectedLogType=s,this.resetFilters()},async loadLogs(){this.loading=!0;try{const s=await n.getAiCallLogs(this.page,this.pageSize);let t=s.data.rows||[];if(this.filters.callType&&(t=t.filter(e=>e.call_type===this.filters.callType)),this.filters.sessionId&&(t=t.filter(e=>e.session_id&&e.session_id.includes(this.filters.sessionId))),this.filters.startTime){const e=new Date(this.filters.startTime).getTime();t=t.filter(l=>new Date(l.request_time).getTime()>=e)}if(this.filters.endTime){const e=new Date(this.filters.endTime).getTime();t=t.filter(l=>new Date(l.request_time).getTime()<=e)}this.logs=t,this.total=s.data.total,this.totalPages=s.data.totalPages}catch(s){console.error("Load logs failed:",s),this.logs=[]}finally{this.loading=!1}},resetFilters(){this.filters.callType="",this.filters.sessionId="",this.filters.startTime="",this.filters.endTime="",this.page=1,this.loadLogs()},async prevPage(){this.page>1&&(this.page--,await this.loadLogs())},async nextPage(){this.page<this.totalPages&&(this.page++,await this.loadLogs())},formatTime(s){return s?new Date(s).toLocaleString("zh-CN"):"-"},getSessionTitle(s){if(!s)return"-";const t=this.sessions.find(e=>e.id===s);return t?t.title:s.substring(0,8)},formatDuration(s){return s?s<1e3?`${s}ms`:`${(s/1e3).toFixed(2)}s`:"0ms"}}};var b=function(){var l,d;var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden"},[e("aside",{staticClass:"w-[260px] bg-sidebar border-r border-border flex flex-col shrink-0"},[t._m(0),e("div",{staticClass:"flex-1 overflow-y-auto py-1"},t._l(t.logTypes,function(a){var i;return e("div",{key:a.key,staticClass:"flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm",class:((i=t.selectedLogType)==null?void 0:i.key)===a.key?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(r){return t.selectLogType(a)}}},[e("i",{class:a.icon}),e("span",{staticClass:"truncate"},[t._v(t._s(a.name))])])}),0)]),e("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-[#1e1e1e]"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar"},[e("div",{staticClass:"flex items-center gap-4 mb-3"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{class:(l=t.selectedLogType)==null?void 0:l.icon}),e("span",{staticClass:"text-white font-medium"},[t._v(t._s((d=t.selectedLogType)==null?void 0:d.name))])]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.total)+" 条记录")])]),e("div",{staticClass:"flex items-center gap-4 flex-wrap"},[e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("调用类型:")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.filters.callType,expression:"filters.callType"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",on:{change:[function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var o="_value"in r?r._value:r.value;return o});t.$set(t.filters,"callType",a.target.multiple?i:i[0])},t.loadLogs]}},[e("option",{attrs:{value:""}},[t._v("全部")]),e("option",{attrs:{value:"tool_call"}},[t._v("工具调用")]),e("option",{attrs:{value:"normal"}},[t._v("普通对话")])])]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("会话:")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.filters.sessionId,expression:"filters.sessionId"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",on:{change:[function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var o="_value"in r?r._value:r.value;return o});t.$set(t.filters,"sessionId",a.target.multiple?i:i[0])},t.loadLogs]}},[e("option",{attrs:{value:""}},[t._v("全部会话")]),t._l(t.sessions,function(a){return e("option",{key:a.id,domProps:{value:a.id}},[t._v(t._s(a.title))])})],2)]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("开始时间:")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.startTime,expression:"filters.startTime"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",attrs:{type:"datetime-local"},domProps:{value:t.filters.startTime},on:{change:t.loadLogs,input:function(a){a.target.composing||t.$set(t.filters,"startTime",a.target.value)}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("结束时间:")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.endTime,expression:"filters.endTime"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",attrs:{type:"datetime-local"},domProps:{value:t.filters.endTime},on:{change:t.loadLogs,input:function(a){a.target.composing||t.$set(t.filters,"endTime",a.target.value)}}})]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.loadLogs}},[t._v(" 查询 ")]),e("button",{staticClass:"px-3 py-1 text-textMuted text-xs rounded hover:bg-white/10",on:{click:t.resetFilters}},[t._v(" 重置 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(1),e("tbody",[t._l(t.logs,function(a){return e("tr",{key:a.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.id))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatTime(a.request_time)))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("span",{staticClass:"text-xs px-2 py-0.5 rounded",class:a.call_type==="tool_call"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"},[t._v(" "+t._s(a.call_type==="tool_call"?"工具调用":"普通对话")+" ")])]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.model_name))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatDuration(a.duration_ms)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.input_tokens||0))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.output_tokens||0))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v("$"+t._s((a.cost||0).toFixed(4)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30 truncate max-w-[150px]",attrs:{title:a.session_id}},[t._v(t._s(t.getSessionTitle(a.session_id)))])])}),t.logs.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"9"}},[t._v("暂无数据")])]):t._e()],2)])]),e("div",{staticClass:"flex items-center justify-between px-4 py-2 border-t border-border bg-sidebar"},[e("span",{staticClass:"text-xs text-textMuted"},[t._v("共 "+t._s(t.total)+" 条")]),e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:t.page<=1},on:{click:t.prevPage}},[e("i",{staticClass:"fa-solid fa-chevron-left"}),t._v(" 上一页 ")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.page)+" / "+t._s(t.totalPages||1))]),e("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:t.page>=t.totalPages},on:{click:t.nextPage}},[t._v(" 下一页 "),e("i",{staticClass:"fa-solid fa-chevron-right"})])])])])])},f=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[t("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-list"}),s._v(" 日志 ")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("ID")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("时间")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("类型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("模型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("耗时")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("输入Token")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("输出Token")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("费用")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("会话ID")])])])}],u=x(p,b,f,!1,null,null);const _=u.exports;export{_ as default};
@@ -1 +1 @@
1
- import{n}from"./index-BvLW1aj9.js";const r={name:"ConfirmDialog",props:{visible:{type:Boolean,default:!1},message:{type:String,default:""}}};var i=function(){var e=this,t=e._self._c;return e.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-96"},[t("p",{staticClass:"text-gray-200 text-sm mb-4"},[e._v(e._s(e.message))]),t("div",{staticClass:"flex justify-end gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs text-gray-400 hover:text-white",on:{click:function(s){return e.$emit("cancel")}}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700",on:{click:function(s){return e.$emit("confirm")}}},[e._v("确定")])])])]):e._e()},a=[],o=n(r,i,a,!1,null,null);const d=o.exports;export{d as C};
1
+ import{n}from"./index-DEabcW89.js";const r={name:"ConfirmDialog",props:{visible:{type:Boolean,default:!1},message:{type:String,default:""}}};var i=function(){var e=this,t=e._self._c;return e.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-96"},[t("p",{staticClass:"text-gray-200 text-sm mb-4"},[e._v(e._s(e.message))]),t("div",{staticClass:"flex justify-end gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs text-gray-400 hover:text-white",on:{click:function(s){return e.$emit("cancel")}}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700",on:{click:function(s){return e.$emit("confirm")}}},[e._v("确定")])])])]):e._e()},a=[],o=n(r,i,a,!1,null,null);const d=o.exports;export{d as C};
@@ -1 +1 @@
1
- import{n as d,a as n}from"./index-BvLW1aj9.js";const u={name:"CustomActionsView",data(){return{actions:[],currentType:"design",showDialog:!1,isEditing:!1,currentAction:null,form:{action_type:"design",name:"",prompt:"",auto_send:!1,sort_order:0},actionTypes:[{value:"design",label:"方案设计"},{value:"code",label:"代码生成"},{value:"test",label:"测试验收"}]}},computed:{filteredActions(){return this.actions.filter(s=>s.action_type===this.currentType)}},async created(){await this.loadActions();const s=this.$route.query.type;s&&["design","code","test"].includes(s)&&(this.currentType=s)},methods:{async loadActions(){try{const s=await n.getCustomActions();this.actions=s.data||[]}catch(s){console.error("Load actions failed:",s),this.$message.error("加载动作失败")}},selectType(s){this.currentType=s},getCountByType(s){return this.actions.filter(t=>t.action_type===s).length},openCreateDialog(){this.isEditing=!1,this.form={action_type:this.currentType,name:"",prompt:"",auto_send:!1,sort_order:0},this.showDialog=!0},openEditDialog(s){this.isEditing=!0,this.currentAction=s,this.form={action_type:s.action_type,name:s.name,prompt:s.prompt,auto_send:!!s.auto_send,sort_order:s.sort_order||0},this.showDialog=!0},closeDialog(){this.showDialog=!1,this.currentAction=null},async saveAction(){if(!this.form.name||!this.form.prompt){this.$message.error("请填写必填项");return}try{this.isEditing&&this.currentAction?(await n.updateCustomAction(this.currentAction.id,this.form),this.$message.success("动作已更新")):(await n.createCustomAction(this.form),this.$message.success("动作已创建")),this.closeDialog(),await this.loadActions()}catch(s){this.$message.error("保存失败: "+s.message)}},async deleteAction(s){if(confirm(`确定删除动作 "${s.name}" 吗?`))try{await n.deleteCustomAction(s.id),this.$message.success("动作已删除"),await this.loadActions()}catch(t){this.$message.error("删除失败: "+t.message)}},getTypeLabel(s){return{design:"方案设计",code:"代码生成",test:"测试验收"}[s]||s}}};var p=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden bg-[#1e1e1e]"},[e("div",{staticClass:"w-48 border-r border-border bg-sidebar shrink-0 flex flex-col"},[t._m(0),e("div",{staticClass:"flex-1 overflow-auto py-2"},t._l(t.actionTypes,function(r){return e("div",{key:r.value,staticClass:"px-4 py-2 cursor-pointer flex items-center justify-between",class:t.currentType===r.value?"bg-accent/20 text-accent":"text-textMuted hover:bg-white/5",on:{click:function(a){return t.selectType(r.value)}}},[e("span",{staticClass:"text-sm"},[t._v(t._s(r.label))]),e("span",{staticClass:"text-xs opacity-60"},[t._v("("+t._s(t.getCountByType(r.value))+")")])])}),0)]),e("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar shrink-0"},[e("div",{staticClass:"flex items-center justify-between"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-bolt text-accent"}),e("span",{staticClass:"text-white font-medium"},[t._v("自定义动作")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v("("+t._s(t.getTypeLabel(t.currentType))+")")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.filteredActions.length)+" 个动作")])]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.openCreateDialog}},[e("i",{staticClass:"fa-solid fa-plus mr-1"}),t._v(" 新增动作 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(1),e("tbody",[t._l(t.filteredActions,function(r){return e("tr",{key:r.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-200"},[t._v(t._s(r.name))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-300 max-w-[300px] truncate",attrs:{title:r.prompt}},[t._v(t._s(r.prompt))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[r.auto_send?e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-green-500/20 text-green-400"},[t._v("是")]):e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-gray-500/20 text-gray-400"},[t._v("否")])]),e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-300"},[t._v(t._s(r.sort_order))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"text-xs px-2 py-1 text-blue-400 hover:bg-blue-500/20 rounded",on:{click:function(a){return t.openEditDialog(r)}}},[t._v("编辑")]),e("button",{staticClass:"text-xs px-2 py-1 text-red-400 hover:bg-red-500/20 rounded",on:{click:function(a){return t.deleteAction(r)}}},[t._v("删除")])])])])}),t.filteredActions.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"5"}},[t._v('暂无动作,点击"新增动作"创建')])]):t._e()],2)])])]),t.showDialog?e("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[e("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[500px] max-h-[80vh] overflow-auto"},[e("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between"},[e("h3",{staticClass:"text-white font-medium"},[t._v(t._s(t.isEditing?"编辑动作":"新增动作"))]),e("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:t.closeDialog}},[t._v("关闭")])]),e("div",{staticClass:"p-4 space-y-4"},[e("div",[t._m(2),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.action_type,expression:"form.action_type"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{disabled:t.isEditing},on:{change:function(r){var a=Array.prototype.filter.call(r.target.options,function(o){return o.selected}).map(function(o){var l="_value"in o?o._value:o.value;return l});t.$set(t.form,"action_type",r.target.multiple?a:a[0])}}},[e("option",{attrs:{value:"design"}},[t._v("方案设计")]),e("option",{attrs:{value:"code"}},[t._v("代码生成")]),e("option",{attrs:{value:"test"}},[t._v("测试验收")])])]),e("div",[t._m(3),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.name,expression:"form.name"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"text",placeholder:"按钮显示名称"},domProps:{value:t.form.name},on:{input:function(r){r.target.composing||t.$set(t.form,"name",r.target.value)}}})]),e("div",[t._m(4),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.form.prompt,expression:"form.prompt"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded resize-none",attrs:{rows:"4",placeholder:"点击按钮后填入输入框的内容"},domProps:{value:t.form.prompt},on:{input:function(r){r.target.composing||t.$set(t.form,"prompt",r.target.value)}}})]),e("div",[e("label",{staticClass:"block text-xs text-textMuted mb-1"},[t._v("排序")]),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.form.sort_order,expression:"form.sort_order",modifiers:{number:!0}}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"number",placeholder:"数字越小越靠前"},domProps:{value:t.form.sort_order},on:{input:function(r){r.target.composing||t.$set(t.form,"sort_order",t._n(r.target.value))},blur:function(r){return t.$forceUpdate()}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.auto_send,expression:"form.auto_send"}],staticClass:"accent-accent",attrs:{type:"checkbox",id:"autoSend"},domProps:{checked:Array.isArray(t.form.auto_send)?t._i(t.form.auto_send,null)>-1:t.form.auto_send},on:{change:function(r){var a=t.form.auto_send,o=r.target,l=!!o.checked;if(Array.isArray(a)){var c=null,i=t._i(a,c);o.checked?i<0&&t.$set(t.form,"auto_send",a.concat([c])):i>-1&&t.$set(t.form,"auto_send",a.slice(0,i).concat(a.slice(i+1)))}else t.$set(t.form,"auto_send",l)}}}),e("label",{staticClass:"text-xs text-textMuted",attrs:{for:"autoSend"}},[t._v("点击后自动发送(无需手动确认)")])])]),e("div",{staticClass:"px-4 py-3 border-t border-border flex justify-end gap-2"},[e("button",{staticClass:"px-4 py-1 text-textMuted text-sm rounded hover:bg-white/10",on:{click:t.closeDialog}},[t._v("取消")]),e("button",{staticClass:"px-4 py-1 bg-accent text-white text-sm rounded hover:bg-accent/80",on:{click:t.saveAction}},[t._v(" "+t._s(t.isEditing?"保存":"创建")+" ")])])])]):t._e()])},x=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"px-4 py-3 border-b border-border"},[t("span",{staticClass:"text-white text-sm font-medium"},[s._v("类型")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("名称")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("提示词")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("自动发送")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("排序")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("操作")])])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("类型 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("名称 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("提示词 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])}],m=d(u,p,x,!1,null,null);const f=m.exports;export{f as default};
1
+ import{n as d,a as n}from"./index-DEabcW89.js";const u={name:"CustomActionsView",data(){return{actions:[],currentType:"design",showDialog:!1,isEditing:!1,currentAction:null,form:{action_type:"design",name:"",prompt:"",auto_send:!1,sort_order:0},actionTypes:[{value:"design",label:"方案设计"},{value:"code",label:"代码生成"},{value:"test",label:"测试验收"}]}},computed:{filteredActions(){return this.actions.filter(s=>s.action_type===this.currentType)}},async created(){await this.loadActions();const s=this.$route.query.type;s&&["design","code","test"].includes(s)&&(this.currentType=s)},methods:{async loadActions(){try{const s=await n.getCustomActions();this.actions=s.data||[]}catch(s){console.error("Load actions failed:",s),this.$message.error("加载动作失败")}},selectType(s){this.currentType=s},getCountByType(s){return this.actions.filter(t=>t.action_type===s).length},openCreateDialog(){this.isEditing=!1,this.form={action_type:this.currentType,name:"",prompt:"",auto_send:!1,sort_order:0},this.showDialog=!0},openEditDialog(s){this.isEditing=!0,this.currentAction=s,this.form={action_type:s.action_type,name:s.name,prompt:s.prompt,auto_send:!!s.auto_send,sort_order:s.sort_order||0},this.showDialog=!0},closeDialog(){this.showDialog=!1,this.currentAction=null},async saveAction(){if(!this.form.name||!this.form.prompt){this.$message.error("请填写必填项");return}try{this.isEditing&&this.currentAction?(await n.updateCustomAction(this.currentAction.id,this.form),this.$message.success("动作已更新")):(await n.createCustomAction(this.form),this.$message.success("动作已创建")),this.closeDialog(),await this.loadActions()}catch(s){this.$message.error("保存失败: "+s.message)}},async deleteAction(s){if(confirm(`确定删除动作 "${s.name}" 吗?`))try{await n.deleteCustomAction(s.id),this.$message.success("动作已删除"),await this.loadActions()}catch(t){this.$message.error("删除失败: "+t.message)}},getTypeLabel(s){return{design:"方案设计",code:"代码生成",test:"测试验收"}[s]||s}}};var p=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden bg-[#1e1e1e]"},[e("div",{staticClass:"w-48 border-r border-border bg-sidebar shrink-0 flex flex-col"},[t._m(0),e("div",{staticClass:"flex-1 overflow-auto py-2"},t._l(t.actionTypes,function(r){return e("div",{key:r.value,staticClass:"px-4 py-2 cursor-pointer flex items-center justify-between",class:t.currentType===r.value?"bg-accent/20 text-accent":"text-textMuted hover:bg-white/5",on:{click:function(a){return t.selectType(r.value)}}},[e("span",{staticClass:"text-sm"},[t._v(t._s(r.label))]),e("span",{staticClass:"text-xs opacity-60"},[t._v("("+t._s(t.getCountByType(r.value))+")")])])}),0)]),e("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar shrink-0"},[e("div",{staticClass:"flex items-center justify-between"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-bolt text-accent"}),e("span",{staticClass:"text-white font-medium"},[t._v("自定义动作")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v("("+t._s(t.getTypeLabel(t.currentType))+")")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.filteredActions.length)+" 个动作")])]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.openCreateDialog}},[e("i",{staticClass:"fa-solid fa-plus mr-1"}),t._v(" 新增动作 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(1),e("tbody",[t._l(t.filteredActions,function(r){return e("tr",{key:r.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-200"},[t._v(t._s(r.name))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-300 max-w-[300px] truncate",attrs:{title:r.prompt}},[t._v(t._s(r.prompt))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[r.auto_send?e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-green-500/20 text-green-400"},[t._v("是")]):e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-gray-500/20 text-gray-400"},[t._v("否")])]),e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-300"},[t._v(t._s(r.sort_order))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"text-xs px-2 py-1 text-blue-400 hover:bg-blue-500/20 rounded",on:{click:function(a){return t.openEditDialog(r)}}},[t._v("编辑")]),e("button",{staticClass:"text-xs px-2 py-1 text-red-400 hover:bg-red-500/20 rounded",on:{click:function(a){return t.deleteAction(r)}}},[t._v("删除")])])])])}),t.filteredActions.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"5"}},[t._v('暂无动作,点击"新增动作"创建')])]):t._e()],2)])])]),t.showDialog?e("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[e("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[500px] max-h-[80vh] overflow-auto"},[e("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between"},[e("h3",{staticClass:"text-white font-medium"},[t._v(t._s(t.isEditing?"编辑动作":"新增动作"))]),e("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:t.closeDialog}},[t._v("关闭")])]),e("div",{staticClass:"p-4 space-y-4"},[e("div",[t._m(2),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.action_type,expression:"form.action_type"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{disabled:t.isEditing},on:{change:function(r){var a=Array.prototype.filter.call(r.target.options,function(o){return o.selected}).map(function(o){var l="_value"in o?o._value:o.value;return l});t.$set(t.form,"action_type",r.target.multiple?a:a[0])}}},[e("option",{attrs:{value:"design"}},[t._v("方案设计")]),e("option",{attrs:{value:"code"}},[t._v("代码生成")]),e("option",{attrs:{value:"test"}},[t._v("测试验收")])])]),e("div",[t._m(3),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.name,expression:"form.name"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"text",placeholder:"按钮显示名称"},domProps:{value:t.form.name},on:{input:function(r){r.target.composing||t.$set(t.form,"name",r.target.value)}}})]),e("div",[t._m(4),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.form.prompt,expression:"form.prompt"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded resize-none",attrs:{rows:"4",placeholder:"点击按钮后填入输入框的内容"},domProps:{value:t.form.prompt},on:{input:function(r){r.target.composing||t.$set(t.form,"prompt",r.target.value)}}})]),e("div",[e("label",{staticClass:"block text-xs text-textMuted mb-1"},[t._v("排序")]),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.form.sort_order,expression:"form.sort_order",modifiers:{number:!0}}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"number",placeholder:"数字越小越靠前"},domProps:{value:t.form.sort_order},on:{input:function(r){r.target.composing||t.$set(t.form,"sort_order",t._n(r.target.value))},blur:function(r){return t.$forceUpdate()}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.auto_send,expression:"form.auto_send"}],staticClass:"accent-accent",attrs:{type:"checkbox",id:"autoSend"},domProps:{checked:Array.isArray(t.form.auto_send)?t._i(t.form.auto_send,null)>-1:t.form.auto_send},on:{change:function(r){var a=t.form.auto_send,o=r.target,l=!!o.checked;if(Array.isArray(a)){var c=null,i=t._i(a,c);o.checked?i<0&&t.$set(t.form,"auto_send",a.concat([c])):i>-1&&t.$set(t.form,"auto_send",a.slice(0,i).concat(a.slice(i+1)))}else t.$set(t.form,"auto_send",l)}}}),e("label",{staticClass:"text-xs text-textMuted",attrs:{for:"autoSend"}},[t._v("点击后自动发送(无需手动确认)")])])]),e("div",{staticClass:"px-4 py-3 border-t border-border flex justify-end gap-2"},[e("button",{staticClass:"px-4 py-1 text-textMuted text-sm rounded hover:bg-white/10",on:{click:t.closeDialog}},[t._v("取消")]),e("button",{staticClass:"px-4 py-1 bg-accent text-white text-sm rounded hover:bg-accent/80",on:{click:t.saveAction}},[t._v(" "+t._s(t.isEditing?"保存":"创建")+" ")])])])]):t._e()])},x=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"px-4 py-3 border-b border-border"},[t("span",{staticClass:"text-white text-sm font-medium"},[s._v("类型")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("名称")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("提示词")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("自动发送")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("排序")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("操作")])])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("类型 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("名称 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("提示词 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])}],m=d(u,p,x,!1,null,null);const f=m.exports;export{f as default};
@@ -1,11 +1,11 @@
1
- import{n as c,R as d,F as u,C as h,M as p,a as o,g,e as _,K as v,b}from"./index-BvLW1aj9.js";const S={name:"WorkflowSidebar",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>{}},currentCategory:{type:String,default:""},currentProject:{type:String,default:""},currentStep:{type:Number,default:1},isLoading:{type:Boolean,default:!1}},data(){return{selectedCategory:"",selectedProject:"",steps:[{id:1,title:"新建需求",desc:"创建新的需求项目",icon:"el-icon-folder-add"},{id:2,title:"方案设计",desc:"编写需求方案",icon:"el-icon-edit"},{id:3,title:"代码生成",desc:"根据方案生成代码",icon:"el-icon-document"},{id:4,title:"测试验收",desc:"测试验证功能",icon:"el-icon-s-check"}]}},computed:{hasAnyProject(){return Object.keys(this.projects||{}).length>0},visibleSteps(){return this.hasAnyProject?this.steps:this.steps.filter(s=>s.id===1)}},watch:{currentCategory(s){this.selectedCategory=s},currentProject(s){this.selectedProject=s}},methods:{onCategoryChange(s){this.selectedProject="",this.$emit("category-change",s)},onProjectChange(s){this.$emit("project-change",s)},onStepClick(s){this.$emit("step-change",s)},isStepCompleted(s){var i;if(!this.currentProject)return!1;const e=`${this.currentCategory}/${this.currentProject}`,t=this.projects[e];return((i=t==null?void 0:t.stepStatus)==null?void 0:i[s])===!0}}};var w=function(){var e=this,t=e._self._c;return t("div",{staticClass:"workflow-sidebar"},[t("div",{staticClass:"sidebar-header"},[t("h3",[e._v("当前项目")]),t("div",{staticClass:"project-display-row"},[t("span",{staticClass:"label"},[e._v("大类")]),t("span",{staticClass:"value"},[e._v(e._s(e.currentCategory||"-"))])]),t("div",{staticClass:"project-display-row"},[t("span",{staticClass:"label"},[e._v("需求")]),t("span",{staticClass:"value"},[e._v(e._s(e.currentProject||"-"))])])]),t("div",{staticClass:"step-list"},e._l(e.visibleSteps,function(i){return t("div",{key:i.id,class:["step-item",{active:e.currentStep===i.id,completed:e.isStepCompleted(i.id)}],on:{click:function(a){return e.onStepClick(i.id)}}},[t("div",{staticClass:"step-icon"},[t("i",{class:i.icon})]),t("div",{staticClass:"step-info"},[t("div",{staticClass:"step-title"},[e._v(e._s(i.title))]),t("div",{staticClass:"step-desc"},[e._v(e._s(i.desc))])]),t("div",{staticClass:"step-status"},[e.isStepCompleted(i.id)?t("i",{staticClass:"el-icon-circle-check",staticStyle:{color:"#22c55e"}}):e._e()])])}),0)])},k=[],$=c(S,w,k,!1,null,"8e3cf2bb");const I=$.exports,M={name:"Step1NewReq",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>({})},basePath:{type:String,default:""},currentCategory:{type:String,default:""},currentProject:{type:String,default:""}},data(){return{selectedCategory:"",selectedProject:"",dialogVisible:!1,dialogInput:"",requirementDialogVisible:!1,requirementDialogInput:""}},computed:{existingRequirementList(){if(!this.selectedCategory)return[];const s=`${this.selectedCategory}/`;return Object.keys(this.projects).filter(e=>e.startsWith(s)).map(e=>e.split("/")[1]).sort()}},watch:{currentCategory:{immediate:!0,handler(s){this.selectedCategory=s||""}},currentProject:{immediate:!0,handler(s){this.selectedProject=s||""}},selectedCategory(s){s||(this.selectedProject="")},existingRequirementList(s){this.selectedProject&&(!Array.isArray(s)||s.length===0||s.includes(this.selectedProject)||(this.selectedProject=""))}},methods:{onCategoryChange(){this.selectedProject="",this.$emit("category-change",this.selectedCategory||""),this.$emit("project-change","")},onProjectChange(){this.$emit("project-change",this.selectedProject||"")},showCreateRequirementDialog(){if(!this.selectedCategory){this.$message.warning("请先选择大类");return}this.requirementDialogInput="",this.requirementDialogVisible=!0},handleCreateRequirementConfirm(){const s=this.requirementDialogInput.trim();if(!s){this.$message.warning("需求名称不能为空");return}if(this.existingRequirementList.includes(s)){this.$message.warning("该需求已存在");return}this.$emit("create-requirement",{category:this.selectedCategory,name:s}),this.requirementDialogVisible=!1},showCreateCategoryDialog(){this.dialogInput="",this.dialogVisible=!0},handleDialogConfirm(){const s=this.dialogInput.trim();if(!s){this.$message.warning("名称不能为空");return}this.$emit("create-category",s),this.dialogVisible=!1}}};var P=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step1-container"},[t("div",{staticClass:"step1-main"},[t("div",{staticClass:"panel-section"},[e._m(0),t("div",{staticClass:"panel-section-body"},[t("el-form",{attrs:{"label-position":"top",size:"small"}},[t("el-form-item",{attrs:{label:"所属大类"}},[t("div",{staticClass:"flex gap-2"},[t("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"请选择大类"},on:{change:e.onCategoryChange},model:{value:e.selectedCategory,callback:function(i){e.selectedCategory=i},expression:"selectedCategory"}},e._l(e.categories,function(i){return t("el-option",{key:i,attrs:{label:i,value:i}})}),1),t("el-button",{on:{click:e.showCreateCategoryDialog}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建 ")])],1)]),t("el-form-item",{attrs:{label:"选择需求"}},[t("div",{staticClass:"flex gap-2"},[t("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"选择已有需求目录",disabled:!e.selectedCategory},on:{change:e.onProjectChange},model:{value:e.selectedProject,callback:function(i){e.selectedProject=i},expression:"selectedProject"}},e._l(e.existingRequirementList,function(i){return t("el-option",{key:i,attrs:{label:i,value:i}})}),1),t("el-button",{attrs:{disabled:!e.selectedCategory},on:{click:e.showCreateRequirementDialog}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建 ")])],1)]),t("div",{staticClass:"form-hint",staticStyle:{color:"#84848a"}},[e._v(" "+e._s(e.selectedCategory?"可直接选择已有需求,或点击“新建”创建需求目录":"请先选择大类")+" ")])],1)],1)])]),t("el-dialog",{attrs:{title:"新建大类",visible:e.dialogVisible,width:"400px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[t("el-form",[t("el-form-item",{attrs:{label:"大类名称"}},[t("el-input",{attrs:{placeholder:"输入大类名称"},model:{value:e.dialogInput,callback:function(i){e.dialogInput=i},expression:"dialogInput"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleDialogConfirm}},[e._v("确定")])],1)],1),t("el-dialog",{attrs:{title:"新建需求",visible:e.requirementDialogVisible,width:"400px"},on:{"update:visible":function(i){e.requirementDialogVisible=i}}},[t("el-form",[t("el-form-item",{attrs:{label:"需求目录名称"}},[t("el-input",{attrs:{placeholder:"输入需求名称,如:用户管理"},model:{value:e.requirementDialogInput,callback:function(i){e.requirementDialogInput=i},expression:"requirementDialogInput"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.requirementDialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleCreateRequirementConfirm}},[e._v("确定")])],1)],1)],1)},j=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"panel-section-header"},[e("span",[e("i",{staticClass:"el-icon-folder-add"}),s._v(" 创建新需求")])])}],x=c(M,P,j,!1,null,"bf976168");const D=x.exports,T={name:"Step2Design",components:{ModelSelectDialog:p,CommandDialog:h,FileSelectDialog:u,ResizableTextarea:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{editor:null,specContent:"",inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle",customActions:[]}},computed:{specFilePath(){return!this.category||!this.name?"等待选择需求...":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`}},watch:{category:{handler(){this.loadData()}},name:{handler(){this.loadData()}}},async mounted(){this.initMonacoEditor(),await this.loadData(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){this.editor&&(this.editor.dispose(),this.editor=null),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
1
+ import{n as c,R as d,F as u,C as h,M as p,a as o,g,e as _,K as v,b}from"./index-DEabcW89.js";const S={name:"WorkflowSidebar",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>{}},currentCategory:{type:String,default:""},currentProject:{type:String,default:""},currentStep:{type:Number,default:1},isLoading:{type:Boolean,default:!1}},data(){return{selectedCategory:"",selectedProject:"",steps:[{id:1,title:"新建需求",desc:"创建新的需求项目",icon:"el-icon-folder-add"},{id:2,title:"方案设计",desc:"编写需求方案",icon:"el-icon-edit"},{id:3,title:"代码生成",desc:"根据方案生成代码",icon:"el-icon-document"},{id:4,title:"测试验收",desc:"测试验证功能",icon:"el-icon-s-check"}]}},computed:{hasAnyProject(){return Object.keys(this.projects||{}).length>0},visibleSteps(){return this.hasAnyProject?this.steps:this.steps.filter(s=>s.id===1)}},watch:{currentCategory(s){this.selectedCategory=s},currentProject(s){this.selectedProject=s}},methods:{onCategoryChange(s){this.selectedProject="",this.$emit("category-change",s)},onProjectChange(s){this.$emit("project-change",s)},onStepClick(s){this.$emit("step-change",s)},isStepCompleted(s){var i;if(!this.currentProject)return!1;const e=`${this.currentCategory}/${this.currentProject}`,t=this.projects[e];return((i=t==null?void 0:t.stepStatus)==null?void 0:i[s])===!0}}};var w=function(){var e=this,t=e._self._c;return t("div",{staticClass:"workflow-sidebar"},[t("div",{staticClass:"sidebar-header"},[t("h3",[e._v("当前项目")]),t("div",{staticClass:"project-display-row"},[t("span",{staticClass:"label"},[e._v("大类")]),t("span",{staticClass:"value"},[e._v(e._s(e.currentCategory||"-"))])]),t("div",{staticClass:"project-display-row"},[t("span",{staticClass:"label"},[e._v("需求")]),t("span",{staticClass:"value"},[e._v(e._s(e.currentProject||"-"))])])]),t("div",{staticClass:"step-list"},e._l(e.visibleSteps,function(i){return t("div",{key:i.id,class:["step-item",{active:e.currentStep===i.id,completed:e.isStepCompleted(i.id)}],on:{click:function(a){return e.onStepClick(i.id)}}},[t("div",{staticClass:"step-icon"},[t("i",{class:i.icon})]),t("div",{staticClass:"step-info"},[t("div",{staticClass:"step-title"},[e._v(e._s(i.title))]),t("div",{staticClass:"step-desc"},[e._v(e._s(i.desc))])]),t("div",{staticClass:"step-status"},[e.isStepCompleted(i.id)?t("i",{staticClass:"el-icon-circle-check",staticStyle:{color:"#22c55e"}}):e._e()])])}),0)])},$=[],k=c(S,w,$,!1,null,"8e3cf2bb");const I=k.exports,M={name:"Step1NewReq",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>({})},basePath:{type:String,default:""},currentCategory:{type:String,default:""},currentProject:{type:String,default:""}},data(){return{selectedCategory:"",selectedProject:"",dialogVisible:!1,dialogInput:"",requirementDialogVisible:!1,requirementDialogInput:""}},computed:{existingRequirementList(){if(!this.selectedCategory)return[];const s=`${this.selectedCategory}/`;return Object.keys(this.projects).filter(e=>e.startsWith(s)).map(e=>e.split("/")[1]).sort()}},watch:{currentCategory:{immediate:!0,handler(s){this.selectedCategory=s||""}},currentProject:{immediate:!0,handler(s){this.selectedProject=s||""}},selectedCategory(s){s||(this.selectedProject="")},existingRequirementList(s){this.selectedProject&&(!Array.isArray(s)||s.length===0||s.includes(this.selectedProject)||(this.selectedProject=""))}},methods:{onCategoryChange(){this.selectedProject="",this.$emit("category-change",this.selectedCategory||""),this.$emit("project-change","")},onProjectChange(){this.$emit("project-change",this.selectedProject||"")},showCreateRequirementDialog(){if(!this.selectedCategory){this.$message.warning("请先选择大类");return}this.requirementDialogInput="",this.requirementDialogVisible=!0},handleCreateRequirementConfirm(){const s=this.requirementDialogInput.trim();if(!s){this.$message.warning("需求名称不能为空");return}if(this.existingRequirementList.includes(s)){this.$message.warning("该需求已存在");return}this.$emit("create-requirement",{category:this.selectedCategory,name:s}),this.requirementDialogVisible=!1},showCreateCategoryDialog(){this.dialogInput="",this.dialogVisible=!0},handleDialogConfirm(){const s=this.dialogInput.trim();if(!s){this.$message.warning("名称不能为空");return}this.$emit("create-category",s),this.dialogVisible=!1}}};var P=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step1-container"},[t("div",{staticClass:"step1-main"},[t("div",{staticClass:"panel-section"},[e._m(0),t("div",{staticClass:"panel-section-body"},[t("el-form",{attrs:{"label-position":"top",size:"small"}},[t("el-form-item",{attrs:{label:"所属大类"}},[t("div",{staticClass:"flex gap-2"},[t("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"请选择大类"},on:{change:e.onCategoryChange},model:{value:e.selectedCategory,callback:function(i){e.selectedCategory=i},expression:"selectedCategory"}},e._l(e.categories,function(i){return t("el-option",{key:i,attrs:{label:i,value:i}})}),1),t("el-button",{on:{click:e.showCreateCategoryDialog}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建 ")])],1)]),t("el-form-item",{attrs:{label:"选择需求"}},[t("div",{staticClass:"flex gap-2"},[t("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"选择已有需求目录",disabled:!e.selectedCategory},on:{change:e.onProjectChange},model:{value:e.selectedProject,callback:function(i){e.selectedProject=i},expression:"selectedProject"}},e._l(e.existingRequirementList,function(i){return t("el-option",{key:i,attrs:{label:i,value:i}})}),1),t("el-button",{attrs:{disabled:!e.selectedCategory},on:{click:e.showCreateRequirementDialog}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建 ")])],1)]),t("div",{staticClass:"form-hint",staticStyle:{color:"#84848a"}},[e._v(" "+e._s(e.selectedCategory?"可直接选择已有需求,或点击“新建”创建需求目录":"请先选择大类")+" ")])],1)],1)])]),t("el-dialog",{attrs:{title:"新建大类",visible:e.dialogVisible,width:"400px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[t("el-form",[t("el-form-item",{attrs:{label:"大类名称"}},[t("el-input",{attrs:{placeholder:"输入大类名称"},model:{value:e.dialogInput,callback:function(i){e.dialogInput=i},expression:"dialogInput"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleDialogConfirm}},[e._v("确定")])],1)],1),t("el-dialog",{attrs:{title:"新建需求",visible:e.requirementDialogVisible,width:"400px"},on:{"update:visible":function(i){e.requirementDialogVisible=i}}},[t("el-form",[t("el-form-item",{attrs:{label:"需求目录名称"}},[t("el-input",{attrs:{placeholder:"输入需求名称,如:用户管理"},model:{value:e.requirementDialogInput,callback:function(i){e.requirementDialogInput=i},expression:"requirementDialogInput"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.requirementDialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleCreateRequirementConfirm}},[e._v("确定")])],1)],1)],1)},j=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"panel-section-header"},[e("span",[e("i",{staticClass:"el-icon-folder-add"}),s._v(" 创建新需求")])])}],x=c(M,P,j,!1,null,"bf976168");const D=x.exports,T={name:"Step2Design",components:{ModelSelectDialog:p,CommandDialog:h,FileSelectDialog:u,ResizableTextarea:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{editor:null,specContent:"",inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle",customActions:[]}},computed:{specFilePath(){return!this.category||!this.name?"等待选择需求...":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`}},watch:{category:{handler(){this.loadData()}},name:{handler(){this.loadData()}}},async mounted(){this.initMonacoEditor(),await this.loadData(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){this.editor&&(this.editor.dispose(),this.editor=null),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
2
2
  `+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadData(){await Promise.all([this.loadSpec(),this.loadSession()])},async loadSpec(){if(!this.category||!this.name){this.specContent=`# 选择或创建需求项目开始设计
3
3
  `,this.syncEditorContent(this.specContent);return}try{const s=this.specFilePath,e=await o.getFileContent(s);this.specContent=e.content||"",this.syncEditorContent(this.specContent)}catch(s){console.error("Load spec failed:",s),this.specContent="",this.syncEditorContent("")}},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,e=await o.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.designSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},syncEditorContent(s){if(!this.editor||s===void 0||s===null)return;const e=String(s);this.editor.getValue()!==e&&this.editor.setValue(e)},initMonacoEditor(){this.editor||this.$nextTick(()=>{this.createEditor()})},createEditor(){this.editor||(this.editor=_.create(this.$refs.editorContainer,{value:this.specContent||`# 选择或创建需求项目开始设计
4
4
  `,language:"markdown",theme:"vs-dark",fontSize:14,fontFamily:"ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Monaco, Consolas, monospace",minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:16}}),this.editor.addCommand(v.CtrlCmd|b.KeyS,()=>{this.saveSpec()}),this.syncEditorContent(this.specContent))},saveSpec(){if(!this.editor)return;const s=this.editor.getValue();this.$emit("save-spec",s)},async sendMessage(){const s=this.inputMessage.trim();if(!s||this.disabled)return;if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession();const e=`先在 ${this.specFilePath} 生成方案,先不要修改代码。
5
5
 
6
- 用户输入: ${s}`;this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),o.sessionWsSend(this.sessionId,"chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0})},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.$emit("spec-updated"),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollToBottom()}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await o.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,o.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?g(s):""},openCustomActions(){window.open("/custom-actions","_blank")},async loadCustomActions(){try{const s=await o.getCustomActions("design");this.customActions=s.data||[]}catch(s){console.error("Load custom actions failed:",s)}},executeCustomAction(s){this.inputMessage=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus(),s.auto_send&&this.sendMessage()})}}};var q=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step2-container"},[t("div",{staticClass:"step2-main"},[t("div",{staticClass:"editor-panel"},[t("div",{staticClass:"editor-header"},[t("i",{staticClass:"el-icon-document"}),t("span",[e._v(e._s(e.specFilePath))])]),t("div",{ref:"editorContainer",staticClass:"editor-container"})]),t("div",{staticClass:"chat-panel"},[e._m(0),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("输入需求描述,AI将协助您完善方案")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(n,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(n.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(n.name))])])}),0):i.type==="chat"||i.type==="think"?t("div",{staticClass:"user-question",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("div",{staticClass:"input-row"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"input-actions"},[e._l(e.customActions,function(i){return t("el-button",{key:i.id,attrs:{type:"info",size:"small",disabled:e.disabled},on:{click:function(a){return e.executeCustomAction(i)}}},[e._v(" "+e._s(i.name)+" ")])}),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}})],1)},F=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"panel-header"},[e("span",[e("i",{staticClass:"el-icon-chat-dot-round"}),s._v(" AI 方案助手")])])}],V=c(T,q,F,!1,null,"ba04f8e5");const B=V.exports,R={name:"Step3CodeGen",components:{ModelSelectDialog:p,CommandDialog:h,FileSelectDialog:u,ResizableTextarea:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,dotAnimation:"",dotInterval:null,dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"],logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle",customActions:[]}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){await this.loadSession(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){this.dotInterval&&clearInterval(this.dotInterval),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
7
- `+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,e=await o.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.codeSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},insertGenerateCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案开发相应功能,先不要修改方案文档。`)},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),o.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollToBottom()}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await o.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,o.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?g(s):""},async loadCustomActions(){try{const s=await o.getCustomActions("code");this.customActions=s.data||[]}catch(s){console.error("Load custom actions failed:",s),this.customActions=[]}},executeCustomAction(s){this.inputMessage=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus(),s.auto_send&&this.sendMessage()})},openCustomActions(){window.open("/custom-actions","_blank")}}};var N=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step3-container"},[t("div",{staticClass:"step3-main"},[t("div",{staticClass:"code-chat-panel"},[t("div",{staticClass:"panel-header"},[e._m(0),t("div",{staticClass:"header-actions"},[t("el-button",{attrs:{type:"primary",size:"small",disabled:e.disabled},on:{click:e.insertGenerateCommand}},[t("i",{staticClass:"el-icon-document"}),e._v(" 根据方案生成代码 ")]),t("el-button",{attrs:{type:"warning",size:"small"},on:{click:e.openCustomActions}},[t("i",{staticClass:"el-icon-setting"}),e._v(" 动作配置 ")])],1)]),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("点击上方按钮或输入需求生成代码")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(n,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(n.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(n.name))])])}),0):i.type==="chat"||i.type==="think"?t("div",{staticClass:"user-question",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("div",{staticClass:"input-row"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入代码修改要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"input-actions"},[e._l(e.customActions,function(i){return t("el-button",{key:i.id,attrs:{type:"info",size:"small",disabled:e.disabled},on:{click:function(a){return e.executeCustomAction(i)}}},[e._v(" "+e._s(i.name)+" ")])}),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}})],1)},A=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-code"}),s._v(" 代码生成对话")])}],L=c(R,N,A,!1,null,"c17daff4");const E=L.exports,O={name:"Step4Test",components:{ModelSelectDialog:p,CommandDialog:h,FileSelectDialog:u,ResizableTextarea:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,dotAnimation:"",dotInterval:null,dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"],logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle",customActions:[]}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){await this.loadSession(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){this.dotInterval&&clearInterval(this.dotInterval),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
8
- `+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,e=await o.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.testSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},insertTestCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案测试相应功能是否实现。`)},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),o.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[]}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await o.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,o.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?g(s):""},async loadCustomActions(){try{const s=await o.getCustomActions("test");this.customActions=s.data||[]}catch(s){console.error("Load custom actions failed:",s),this.customActions=[]}},executeCustomAction(s){this.inputMessage=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus(),s.auto_send&&this.sendMessage()})}}};var U=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step4-container"},[t("div",{staticClass:"step4-main"},[t("div",{staticClass:"code-chat-panel"},[t("div",{staticClass:"panel-header"},[e._m(0),t("el-button",{attrs:{type:"primary",size:"small",disabled:e.disabled},on:{click:e.insertTestCommand}},[t("i",{staticClass:"el-icon-s-claim"}),e._v(" 根据方案测试 ")])],1),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("点击上方按钮或输入测试要求进行验收")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(n,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(n.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(n.name))])])}),0):i.type==="chat"||i.type==="think"?t("div",{staticClass:"user-question",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("div",{staticClass:"input-row"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入测试要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"input-actions"},[e._l(e.customActions,function(i){return t("el-button",{key:i.id,attrs:{type:"info",size:"small",disabled:e.disabled},on:{click:function(a){return e.executeCustomAction(i)}}},[e._v(" "+e._s(i.name)+" ")])}),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}})],1)},K=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-s-check"}),s._v(" 测试验收对话")])}],W=c(O,U,K,!1,null,"a358150e");const z=W.exports,H={name:"DevWorkflowView",components:{WorkflowSidebar:I,Step1NewReq:D,Step2Design:B,Step3CodeGen:E,Step4Test:z},props:{sidebarVisible:{type:Boolean,default:!0}},data(){return{currentCategory:"",currentProject:"",currentStep:1,categories:[],projects:{},reqBasePath:"",isLoadingProjects:!1}},computed:{projectKey(){return!this.currentCategory||!this.currentProject?"":`${this.currentCategory}/${this.currentProject}`},hasSelectedProject(){return!!this.currentProject},stepTitle(){return{1:"新建需求",2:"方案设计",3:"代码生成",4:"测试验收"}[this.currentStep]||""},statusText(){return this.projectKey?`步骤 ${this.currentStep} / 4`:"就绪"}},created(){this.loadState(),this.loadCategories()},methods:{async loadState(){try{const e=(await o.getWorkflowState()).data;e&&(this.currentCategory=e.currentCategory||"",this.currentProject=e.currentProject||"",this.currentStep=e.currentStep||1)}catch(s){console.error("Load workflow state failed:",s)}},async saveState(){try{await o.updateWorkflowState(this.currentCategory,this.currentProject,this.currentStep)}catch(s){console.error("Save workflow state failed:",s)}},async loadCategories(){var s,e;try{const t=await o.getCwd();this.reqBasePath=((s=t.data)==null?void 0:s.basePath)||"";const a=((e=(await o.browseFilesystem(this.reqBasePath)).data)==null?void 0:e.items)||[];this.categories=a.filter(n=>n.is_directory).map(n=>n.name),this.categories.sort(),this.currentCategory&&this.categories.includes(this.currentCategory)&&await this.loadProjectsForCategory(this.currentCategory)}catch(t){console.error("Load categories failed:",t),this.categories=[]}},async loadProjectsForCategory(s){var e;if(s){this.isLoadingProjects=!0;try{const t=`${this.reqBasePath}/${s}`,a=((e=(await o.browseFilesystem(t)).data)==null?void 0:e.items)||[];this.projects={},a.filter(n=>n.is_directory).forEach(n=>{const r=`${s}/${n.name}`;this.projects[r]={name:n.name,stepStatus:{}}})}catch(t){console.error("Load projects failed:",t)}finally{this.isLoadingProjects=!1}}},async onCategoryChange(s){this.currentCategory=s,this.currentProject="",this.currentStep=1,s?await this.loadProjectsForCategory(s):this.projects={}},onProjectChange(s){this.currentProject=s,!this.currentProject&&this.currentStep>1&&(this.currentStep=1)},onStepChange(s){!this.currentProject&&s>1||(this.currentStep=s)},async createCategory(s){if(this.categories.includes(s)){this.$message.warning("大类已存在");return}try{const e=`${this.reqBasePath}/${s}`;await o.createDirectory(e),this.categories.push(s),this.categories.sort(),this.$message.success(`大类「${s}」创建成功`)}catch(e){console.error("Create category failed:",e),this.$message.error("创建大类失败")}},async renameCategory({oldName:s,newName:e}){if(this.categories.includes(e)){this.$message.warning("名称已存在");return}try{const t=`${this.reqBasePath}/${s}`;await o.renameFile(t,e);const i=this.categories.indexOf(s);i>-1&&(this.categories[i]=e),this.categories.sort(),this.currentCategory===s&&(this.currentCategory=e,await this.loadProjectsForCategory(e)),await this.saveState(),this.$message.success(`已重命名为「${e}」`)}catch(t){console.error("Rename category failed:",t),this.$message.error("重命名大类失败")}},async deleteCategory(s){try{const e=`${this.reqBasePath}/${s}`;await o.deleteFile(e),this.categories=this.categories.filter(t=>t!==s),this.currentCategory===s&&(this.currentCategory="",this.currentProject="",this.currentStep=1,this.projects={}),await this.saveState(),this.$message.success(`大类「${s}」已删除`)}catch(e){console.error("Delete category failed:",e),this.$message.error("删除大类失败")}},async createRequirement({category:s,name:e}){var n,r,m;if(this.projects[e]){this.$message.warning("需求已存在");return}try{const l=`${this.reqBasePath}/${s}/${e}`;await o.createDirectory(l)}catch(l){console.error("Create requirement directory failed:",l)}const t=`# ${e}方案
6
+ 用户输入: ${s}`;this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),o.sessionWsSend(this.sessionId,"chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0})},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.$emit("spec-updated"),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollToBottom()}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await o.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,o.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?g(s):""},openCustomActions(){window.open("/custom-actions","_blank")},async loadCustomActions(){try{const s=await o.getCustomActions("design");this.customActions=s.data||[]}catch(s){console.error("Load custom actions failed:",s)}},executeCustomAction(s){this.inputMessage=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus(),s.auto_send&&this.sendMessage()})}}};var q=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step2-container"},[t("div",{staticClass:"step2-main"},[t("div",{staticClass:"editor-panel"},[t("div",{staticClass:"editor-header"},[t("i",{staticClass:"el-icon-document"}),t("span",[e._v(e._s(e.specFilePath))])]),t("div",{ref:"editorContainer",staticClass:"editor-container"})]),t("div",{staticClass:"chat-panel"},[e._m(0),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("输入需求描述,AI将协助您完善方案")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(n,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(n.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(n.name))])])}),0):e._e(),i.type==="chat"?t("div",{staticClass:"flex justify-end"},[t("div",{staticClass:"user-question"},[e._v(e._s(i.content))])]):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("div",{staticClass:"input-row"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"input-actions"},[e._l(e.customActions,function(i){return t("el-button",{key:i.id,attrs:{type:"info",size:"small",disabled:e.disabled},on:{click:function(a){return e.executeCustomAction(i)}}},[e._v(" "+e._s(i.name)+" ")])}),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}})],1)},F=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"panel-header"},[e("span",[e("i",{staticClass:"el-icon-chat-dot-round"}),s._v(" AI 方案助手")])])}],V=c(T,q,F,!1,null,"546f9819");const B=V.exports,R={name:"Step3CodeGen",components:{ModelSelectDialog:p,CommandDialog:h,FileSelectDialog:u,ResizableTextarea:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,dotAnimation:"",dotInterval:null,dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"],logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle",customActions:[]}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){await this.loadSession(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){this.dotInterval&&clearInterval(this.dotInterval),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
7
+ `+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,e=await o.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.codeSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},insertGenerateCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案开发相应功能,先不要修改方案文档。`)},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),o.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollToBottom()}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await o.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,o.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?g(s):""},async loadCustomActions(){try{const s=await o.getCustomActions("code");this.customActions=s.data||[]}catch(s){console.error("Load custom actions failed:",s),this.customActions=[]}},executeCustomAction(s){this.inputMessage=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus(),s.auto_send&&this.sendMessage()})},openCustomActions(){window.open("/custom-actions","_blank")}}};var N=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step3-container"},[t("div",{staticClass:"step3-main"},[t("div",{staticClass:"code-chat-panel"},[t("div",{staticClass:"panel-header"},[e._m(0),t("div",{staticClass:"header-actions"},[t("el-button",{attrs:{type:"primary",size:"small",disabled:e.disabled},on:{click:e.insertGenerateCommand}},[t("i",{staticClass:"el-icon-document"}),e._v(" 根据方案生成代码 ")]),t("el-button",{attrs:{type:"warning",size:"small"},on:{click:e.openCustomActions}},[t("i",{staticClass:"el-icon-setting"}),e._v(" 动作配置 ")])],1)]),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("点击上方按钮或输入需求生成代码")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(n,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(n.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(n.name))])])}),0):e._e(),i.type==="chat"?t("div",{staticClass:"flex justify-end"},[t("div",{staticClass:"user-question"},[e._v(e._s(i.content))])]):i.type==="think"?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("div",{staticClass:"input-row"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入代码修改要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"input-actions"},[e._l(e.customActions,function(i){return t("el-button",{key:i.id,attrs:{type:"info",size:"small",disabled:e.disabled},on:{click:function(a){return e.executeCustomAction(i)}}},[e._v(" "+e._s(i.name)+" ")])}),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}})],1)},A=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-code"}),s._v(" 代码生成对话")])}],L=c(R,N,A,!1,null,"651a6033");const E=L.exports,O={name:"Step4Test",components:{ModelSelectDialog:p,CommandDialog:h,FileSelectDialog:u,ResizableTextarea:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,dotAnimation:"",dotInterval:null,dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"],logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle",customActions:[]}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){await this.loadSession(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){this.dotInterval&&clearInterval(this.dotInterval),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
8
+ `+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,e=await o.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.testSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},insertTestCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案测试相应功能是否实现。`)},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),o.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[]}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await o.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,o.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?g(s):""},async loadCustomActions(){try{const s=await o.getCustomActions("test");this.customActions=s.data||[]}catch(s){console.error("Load custom actions failed:",s),this.customActions=[]}},executeCustomAction(s){this.inputMessage=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus(),s.auto_send&&this.sendMessage()})}}};var U=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step4-container"},[t("div",{staticClass:"step4-main"},[t("div",{staticClass:"code-chat-panel"},[t("div",{staticClass:"panel-header"},[e._m(0),t("el-button",{attrs:{type:"primary",size:"small",disabled:e.disabled},on:{click:e.insertTestCommand}},[t("i",{staticClass:"el-icon-s-claim"}),e._v(" 根据方案测试 ")])],1),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("点击上方按钮或输入测试要求进行验收")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(n,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(n.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(n.name))])])}),0):e._e(),i.type==="chat"?t("div",{staticClass:"flex justify-end"},[t("div",{staticClass:"user-question"},[e._v(e._s(i.content))])]):i.type==="think"?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("div",{staticClass:"input-row"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入测试要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"input-actions"},[e._l(e.customActions,function(i){return t("el-button",{key:i.id,attrs:{type:"info",size:"small",disabled:e.disabled},on:{click:function(a){return e.executeCustomAction(i)}}},[e._v(" "+e._s(i.name)+" ")])}),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}})],1)},K=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-s-check"}),s._v(" 测试验收对话")])}],W=c(O,U,K,!1,null,"ed583438");const z=W.exports,H={name:"DevWorkflowView",components:{WorkflowSidebar:I,Step1NewReq:D,Step2Design:B,Step3CodeGen:E,Step4Test:z},props:{sidebarVisible:{type:Boolean,default:!0}},data(){return{currentCategory:"",currentProject:"",currentStep:1,categories:[],projects:{},reqBasePath:"",isLoadingProjects:!1}},computed:{projectKey(){return!this.currentCategory||!this.currentProject?"":`${this.currentCategory}/${this.currentProject}`},hasSelectedProject(){return!!this.currentProject},stepTitle(){return{1:"新建需求",2:"方案设计",3:"代码生成",4:"测试验收"}[this.currentStep]||""},statusText(){return this.projectKey?`步骤 ${this.currentStep} / 4`:"就绪"}},created(){this.loadState(),this.loadCategories()},methods:{async loadState(){try{const e=(await o.getWorkflowState()).data;e&&(this.currentCategory=e.currentCategory||"",this.currentProject=e.currentProject||"",this.currentStep=e.currentStep||1)}catch(s){console.error("Load workflow state failed:",s)}},async saveState(){try{await o.updateWorkflowState(this.currentCategory,this.currentProject,this.currentStep)}catch(s){console.error("Save workflow state failed:",s)}},async loadCategories(){var s,e;try{const t=await o.getCwd();this.reqBasePath=((s=t.data)==null?void 0:s.basePath)||"";const a=((e=(await o.browseFilesystem(this.reqBasePath)).data)==null?void 0:e.items)||[];this.categories=a.filter(n=>n.is_directory).map(n=>n.name),this.categories.sort(),this.currentCategory&&this.categories.includes(this.currentCategory)&&await this.loadProjectsForCategory(this.currentCategory)}catch(t){console.error("Load categories failed:",t),this.categories=[]}},async loadProjectsForCategory(s){var e;if(s){this.isLoadingProjects=!0;try{const t=`${this.reqBasePath}/${s}`,a=((e=(await o.browseFilesystem(t)).data)==null?void 0:e.items)||[];this.projects={},a.filter(n=>n.is_directory).forEach(n=>{const r=`${s}/${n.name}`;this.projects[r]={name:n.name,stepStatus:{}}})}catch(t){console.error("Load projects failed:",t)}finally{this.isLoadingProjects=!1}}},async onCategoryChange(s){this.currentCategory=s,this.currentProject="",this.currentStep=1,s?await this.loadProjectsForCategory(s):this.projects={}},onProjectChange(s){this.currentProject=s,!this.currentProject&&this.currentStep>1&&(this.currentStep=1)},onStepChange(s){!this.currentProject&&s>1||(this.currentStep=s)},async createCategory(s){if(this.categories.includes(s)){this.$message.warning("大类已存在");return}try{const e=`${this.reqBasePath}/${s}`;await o.createDirectory(e),this.categories.push(s),this.categories.sort(),this.$message.success(`大类「${s}」创建成功`)}catch(e){console.error("Create category failed:",e),this.$message.error("创建大类失败")}},async renameCategory({oldName:s,newName:e}){if(this.categories.includes(e)){this.$message.warning("名称已存在");return}try{const t=`${this.reqBasePath}/${s}`;await o.renameFile(t,e);const i=this.categories.indexOf(s);i>-1&&(this.categories[i]=e),this.categories.sort(),this.currentCategory===s&&(this.currentCategory=e,await this.loadProjectsForCategory(e)),await this.saveState(),this.$message.success(`已重命名为「${e}」`)}catch(t){console.error("Rename category failed:",t),this.$message.error("重命名大类失败")}},async deleteCategory(s){try{const e=`${this.reqBasePath}/${s}`;await o.deleteFile(e),this.categories=this.categories.filter(t=>t!==s),this.currentCategory===s&&(this.currentCategory="",this.currentProject="",this.currentStep=1,this.projects={}),await this.saveState(),this.$message.success(`大类「${s}」已删除`)}catch(e){console.error("Delete category failed:",e),this.$message.error("删除大类失败")}},async createRequirement({category:s,name:e}){var n,r,m;if(this.projects[e]){this.$message.warning("需求已存在");return}try{const l=`${this.reqBasePath}/${s}/${e}`;await o.createDirectory(l)}catch(l){console.error("Create requirement directory failed:",l)}const t=`# ${e}方案
9
9
 
10
10
  > 所属大类:${s}
11
11
 
@@ -0,0 +1 @@
1
+ .workflow-sidebar[data-v-8e3cf2bb]{width:280px;background:#2d2d2d;border-right:1px solid #1e1e1e;display:flex;flex-direction:column;flex-shrink:0}.sidebar-header[data-v-8e3cf2bb]{padding:16px;border-bottom:1px solid #1e1e1e}.sidebar-header h3[data-v-8e3cf2bb]{font-size:14px;color:#84848a;margin-bottom:12px}.sidebar-header .el-select[data-v-8e3cf2bb]{width:100%;margin-bottom:8px}.project-display-row[data-v-8e3cf2bb]{display:flex;justify-content:space-between;gap:8px;margin-bottom:8px;padding:8px 10px;background:#ffffff0a;border:1px solid #3f3f46;border-radius:6px}.project-display-row .label[data-v-8e3cf2bb]{color:#84848a;font-size:12px}.project-display-row .value[data-v-8e3cf2bb]{color:#d4d4d8;font-size:12px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.step-list[data-v-8e3cf2bb]{flex:1;overflow-y:auto;padding:16px}.step-item[data-v-8e3cf2bb]{display:flex;align-items:center;gap:12px;padding:14px 16px;border-radius:8px;margin-bottom:8px;cursor:pointer;transition:all .2s;border:1px solid transparent}.step-item[data-v-8e3cf2bb]:hover{background:#ffffff0d}.step-item.active[data-v-8e3cf2bb]{background:#409eff26;border-color:#409eff}.step-item.completed .step-icon[data-v-8e3cf2bb]{background:#22c55e}.step-item.active .step-icon[data-v-8e3cf2bb]{background:#409eff}.step-icon[data-v-8e3cf2bb]{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:14px;color:#fff;flex-shrink:0}.step-info[data-v-8e3cf2bb]{flex:1}.step-title[data-v-8e3cf2bb]{font-size:14px;font-weight:500;margin-bottom:2px;color:#f4f4f5}.step-desc[data-v-8e3cf2bb]{font-size:12px;color:#84848a}.step-status[data-v-8e3cf2bb]{font-size:14px}.step1-container[data-v-bf976168]{height:100%;padding:24px;overflow:hidden}.step1-main[data-v-bf976168]{max-width:600px;margin:0 auto}.panel-section[data-v-bf976168]{background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden}.panel-section-header[data-v-bf976168]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 16px;font-size:14px;font-weight:500;display:flex;align-items:center;justify-content:space-between;color:#f4f4f5}.panel-section-header .el-button[data-v-bf976168]{padding:4px 8px;font-size:12px}.panel-section-body[data-v-bf976168]{padding:24px}.form-hint[data-v-bf976168]{font-size:12px;color:#84848a;margin-top:8px}.form-hint code[data-v-bf976168]{background:#18191b;padding:2px 6px;border-radius:4px;font-family:ui-monospace,monospace;color:#409eff}.flex[data-v-bf976168]{display:flex}.gap-2[data-v-bf976168]{gap:8px}.step2-container[data-v-546f9819]{height:100%;display:flex;flex-direction:column}.step2-main[data-v-546f9819]{display:flex;flex:1;gap:16px;overflow:hidden;padding:16px}.editor-panel[data-v-546f9819]{flex:1;min-width:300px;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.editor-header[data-v-546f9819]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 16px;font-size:13px;color:#84848a;display:flex;align-items:center;gap:8px}.editor-container[data-v-546f9819]{flex:1;min-height:0}.chat-panel[data-v-546f9819]{width:480px;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column;flex-shrink:0}.panel-header[data-v-546f9819]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 16px;font-size:14px;font-weight:500;color:#f4f4f5;flex-shrink:0}.chat-messages[data-v-546f9819]{flex:1;overflow-y:auto;padding:0 16px 16px;font-size:14px;line-height:1.6}.empty-state[data-v-546f9819]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#84848a}.empty-state i[data-v-546f9819]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-546f9819]{margin-bottom:16px;color:#d4d4d8}.todo-item[data-v-546f9819]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-546f9819]{color:#60a5fa;font-weight:700;border:1px solid #60a5fa;padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-546f9819]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-546f9819]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-success[data-v-546f9819]{color:#22c55e}.tool-fail[data-v-546f9819]{color:#ef4444}.tool-input[data-v-546f9819]{color:#60a5fa;margin-left:8px}.build-info[data-v-546f9819]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-546f9819]{padding:12px 16px;background:#121212;border-top:1px solid #1e1e1e}.input-row[data-v-546f9819]{display:flex;gap:12px;align-items:flex-end}.input-row .input-area[data-v-546f9819]{flex:1}.input-row .input-actions[data-v-546f9819]{display:flex;flex-direction:column;gap:8px;align-items:flex-end}.status-bar[data-v-546f9819]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:#84848a;border-top:1px solid #1e1e1e;flex-shrink:0;flex-wrap:wrap;background:#0a0a09}.status-bar .separator[data-v-546f9819]{color:#3f3f46}.status-ready[data-v-546f9819]{color:#22c55e}.status-thinking[data-v-546f9819]{color:#60a5fa}.thinking-spinner[data-v-546f9819]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-546f9819 .8s linear infinite}@keyframes spin-546f9819{to{transform:rotate(360deg)}}.model-selector[data-v-546f9819]{cursor:pointer}.model-selector[data-v-546f9819]:hover{color:#60a5fa}.step3-container[data-v-651a6033]{height:100%;display:flex;flex-direction:column}.step3-main[data-v-651a6033]{display:flex;flex:1;overflow:hidden;padding:16px}.code-chat-panel[data-v-651a6033]{flex:1;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.panel-header[data-v-651a6033]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#121212;border-bottom:1px solid #1e1e1e;flex-shrink:0}.panel-header span[data-v-651a6033]{font-size:14px;font-weight:500;color:#f4f4f5}.header-actions[data-v-651a6033]{display:flex;gap:8px}.chat-messages[data-v-651a6033]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6}.empty-state[data-v-651a6033]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#84848a}.empty-state i[data-v-651a6033]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-651a6033]{margin-bottom:16px;color:#d4d4d8}.todo-item[data-v-651a6033]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-651a6033]{color:#60a5fa;font-weight:700;border:1px solid #60a5fa;padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-651a6033]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-651a6033]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-success[data-v-651a6033]{color:#22c55e}.tool-fail[data-v-651a6033]{color:#ef4444}.tool-input[data-v-651a6033]{color:#60a5fa;margin-left:8px}.build-info[data-v-651a6033]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-651a6033]{padding:12px 16px;background:#121212;border-top:1px solid #1e1e1e}.input-row[data-v-651a6033]{display:flex;gap:12px;align-items:flex-end}.input-row .input-area[data-v-651a6033]{flex:1}.input-row .input-actions[data-v-651a6033]{display:flex;flex-direction:column;gap:8px;align-items:flex-end}.status-bar[data-v-651a6033]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:#84848a;border-top:1px solid #1e1e1e;flex-shrink:0;flex-wrap:wrap;background:#0a0a09}.status-bar .separator[data-v-651a6033]{color:#3f3f46}.status-ready[data-v-651a6033]{color:#22c55e}.status-thinking[data-v-651a6033]{color:#60a5fa}.thinking-spinner[data-v-651a6033]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-651a6033 .8s linear infinite}@keyframes spin-651a6033{to{transform:rotate(360deg)}}.model-selector[data-v-651a6033]{cursor:pointer}.model-selector[data-v-651a6033]:hover{color:#60a5fa}.step4-container[data-v-ed583438]{height:100%;display:flex;flex-direction:column}.step4-main[data-v-ed583438]{display:flex;flex:1;overflow:hidden;padding:16px}.code-chat-panel[data-v-ed583438]{flex:1;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.panel-header[data-v-ed583438]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#121212;border-bottom:1px solid #1e1e1e;flex-shrink:0}.panel-header span[data-v-ed583438]{font-size:14px;font-weight:500;color:#f4f4f5}.chat-messages[data-v-ed583438]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6}.empty-state[data-v-ed583438]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#84848a}.empty-state i[data-v-ed583438]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-ed583438]{margin-bottom:16px;color:#d4d4d8}.todo-item[data-v-ed583438]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-ed583438]{color:#60a5fa;font-weight:700;border:1px solid #60a5fa;padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-ed583438]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-ed583438]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-success[data-v-ed583438]{color:#22c55e}.tool-fail[data-v-ed583438]{color:#ef4444}.tool-input[data-v-ed583438]{color:#60a5fa;margin-left:8px}.build-info[data-v-ed583438]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-ed583438]{padding:12px 16px;background:#121212;border-top:1px solid #1e1e1e}.input-row[data-v-ed583438]{display:flex;gap:12px;align-items:flex-end}.input-row .input-area[data-v-ed583438]{flex:1}.input-row .input-actions[data-v-ed583438]{display:flex;flex-direction:column;gap:8px;align-items:flex-end}.status-bar[data-v-ed583438]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:#84848a;border-top:1px solid #1e1e1e;flex-shrink:0;flex-wrap:wrap;background:#0a0a09}.status-bar .separator[data-v-ed583438]{color:#3f3f46}.status-ready[data-v-ed583438]{color:#22c55e}.status-thinking[data-v-ed583438]{color:#60a5fa}.thinking-spinner[data-v-ed583438]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-ed583438 .8s linear infinite}@keyframes spin-ed583438{to{transform:rotate(360deg)}}.model-selector[data-v-ed583438]{cursor:pointer}.model-selector[data-v-ed583438]:hover{color:#60a5fa}.dev-workflow-view[data-v-05a3971e]{display:flex;height:100%;overflow:hidden;background:#0a0a09}.main-content[data-v-05a3971e]{flex:1;display:flex;flex-direction:column;overflow:hidden}.panel-header[data-v-05a3971e]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 24px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.panel-title[data-v-05a3971e]{font-size:16px;font-weight:500;color:#f4f4f5}.panel-actions[data-v-05a3971e]{display:flex;gap:12px}.step-content[data-v-05a3971e]{flex:1;overflow:hidden}.status-bar[data-v-05a3971e]{background:#121212;border-top:1px solid #1e1e1e;padding:8px 24px;font-size:12px;color:#84848a;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}