tianxincode 1.0.49 → 1.0.51
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.
- package/dist/config/tx.config.d.ts.map +1 -1
- package/dist/config/tx.config.js +3 -1
- package/dist/config/tx.config.js.map +1 -1
- package/dist/core/db/db.service.d.ts +2 -0
- package/dist/core/db/db.service.d.ts.map +1 -1
- package/dist/core/db/db.service.js +11 -0
- package/dist/core/db/db.service.js.map +1 -1
- package/dist/core/db/init_sql/system.init.d.ts +3 -0
- package/dist/core/db/init_sql/system.init.d.ts.map +1 -0
- package/dist/core/db/init_sql/system.init.js +15 -0
- package/dist/core/db/init_sql/system.init.js.map +1 -0
- package/dist/entity/tx-config.entity.d.ts +1 -0
- package/dist/entity/tx-config.entity.d.ts.map +1 -1
- package/dist/gateway/api/file/download_file.js +1 -1
- package/dist/gateway/api/file/download_file.js.map +1 -1
- package/dist/gateway/api/skill/categories_skill.d.ts +3 -0
- package/dist/gateway/api/skill/categories_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/categories_skill.js +11 -0
- package/dist/gateway/api/skill/categories_skill.js.map +1 -0
- package/dist/gateway/api/skill/detail_skill.js +2 -2
- package/dist/gateway/api/skill/detail_skill.js.map +1 -1
- package/dist/gateway/api/skill/install_skill.d.ts +3 -0
- package/dist/gateway/api/skill/install_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/install_skill.js +26 -0
- package/dist/gateway/api/skill/install_skill.js.map +1 -0
- package/dist/gateway/api/skill/published_skill.d.ts +3 -0
- package/dist/gateway/api/skill/published_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/published_skill.js +15 -0
- package/dist/gateway/api/skill/published_skill.js.map +1 -0
- package/dist/gateway/api/skill/skill_routes.d.ts.map +1 -1
- package/dist/gateway/api/skill/skill_routes.js +8 -12
- package/dist/gateway/api/skill/skill_routes.js.map +1 -1
- package/dist/gateway/api/skill/uninstall_skill.d.ts +3 -0
- package/dist/gateway/api/skill/uninstall_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/uninstall_skill.js +20 -0
- package/dist/gateway/api/skill/uninstall_skill.js.map +1 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.js +11 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/auth_start_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/auth_start_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/auth_start_songbing.js +15 -0
- package/dist/gateway/api/songbing/auth_start_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.js +15 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/config_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/config_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/config_songbing.js +6 -0
- package/dist/gateway/api/songbing/config_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/save_config_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/save_config_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/save_config_songbing.js +12 -0
- package/dist/gateway/api/songbing/save_config_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/songbing_routes.d.ts +3 -0
- package/dist/gateway/api/songbing/songbing_routes.d.ts.map +1 -0
- package/dist/gateway/api/songbing/songbing_routes.js +15 -0
- package/dist/gateway/api/songbing/songbing_routes.js.map +1 -0
- package/dist/gateway/api/songbing/sync_models_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/sync_models_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/sync_models_songbing.js +11 -0
- package/dist/gateway/api/songbing/sync_models_songbing.js.map +1 -0
- package/dist/gateway/api/spec/categories_spec.d.ts +3 -0
- package/dist/gateway/api/spec/categories_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/categories_spec.js +11 -0
- package/dist/gateway/api/spec/categories_spec.js.map +1 -0
- package/dist/gateway/api/spec/install_spec.d.ts +3 -0
- package/dist/gateway/api/spec/install_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/install_spec.js +26 -0
- package/dist/gateway/api/spec/install_spec.js.map +1 -0
- package/dist/gateway/api/spec/published_spec.d.ts +3 -0
- package/dist/gateway/api/spec/published_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/published_spec.js +18 -0
- package/dist/gateway/api/spec/published_spec.js.map +1 -0
- package/dist/gateway/api/spec/spec_routes.d.ts.map +1 -1
- package/dist/gateway/api/spec/spec_routes.js +9 -19
- package/dist/gateway/api/spec/spec_routes.js.map +1 -1
- package/dist/gateway/api/spec/uninstall_spec.d.ts +3 -0
- package/dist/gateway/api/spec/uninstall_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/uninstall_spec.js +20 -0
- package/dist/gateway/api/spec/uninstall_spec.js.map +1 -0
- package/dist/gateway/api/system/system_routes.d.ts.map +1 -1
- package/dist/gateway/api/system/system_routes.js +2 -0
- package/dist/gateway/api/system/system_routes.js.map +1 -1
- package/dist/gateway/api/system/version_check.d.ts +3 -0
- package/dist/gateway/api/system/version_check.d.ts.map +1 -0
- package/dist/gateway/api/system/version_check.js +47 -0
- package/dist/gateway/api/system/version_check.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/spec/index.d.ts +0 -1
- package/dist/modules/spec/index.d.ts.map +1 -1
- package/dist/modules/spec/index.js +0 -1
- package/dist/modules/spec/index.js.map +1 -1
- package/dist/modules/spec/spec.injector.d.ts.map +1 -1
- package/dist/modules/spec/spec.injector.js +2 -24
- package/dist/modules/spec/spec.injector.js.map +1 -1
- package/dist/queue/dream/dream.service.d.ts.map +1 -1
- package/dist/queue/dream/dream.service.js +8 -0
- package/dist/queue/dream/dream.service.js.map +1 -1
- package/dist/queue/dream/handlers/clear-session.handler.d.ts +6 -0
- package/dist/queue/dream/handlers/clear-session.handler.d.ts.map +1 -0
- package/dist/queue/dream/handlers/clear-session.handler.js +50 -0
- package/dist/queue/dream/handlers/clear-session.handler.js.map +1 -0
- package/dist/queue/dream/handlers/init.handler.d.ts.map +1 -1
- package/dist/queue/dream/handlers/init.handler.js +4 -2
- package/dist/queue/dream/handlers/init.handler.js.map +1 -1
- package/dist/repository/index.d.ts +2 -0
- package/dist/repository/index.d.ts.map +1 -1
- package/dist/repository/index.js +1 -0
- package/dist/repository/index.js.map +1 -1
- package/dist/repository/message.repository.d.ts +2 -0
- package/dist/repository/message.repository.d.ts.map +1 -1
- package/dist/repository/message.repository.js +8 -0
- package/dist/repository/message.repository.js.map +1 -1
- package/dist/repository/system.repository.d.ts +18 -0
- package/dist/repository/system.repository.d.ts.map +1 -0
- package/dist/repository/system.repository.js +14 -0
- package/dist/repository/system.repository.js.map +1 -0
- package/dist/services/hub/txcode_hub.service.d.ts +98 -0
- package/dist/services/hub/txcode_hub.service.d.ts.map +1 -0
- package/dist/services/hub/txcode_hub.service.js +173 -0
- package/dist/services/hub/txcode_hub.service.js.map +1 -0
- package/dist/services/songbing/songbing.service.d.ts +30 -0
- package/dist/services/songbing/songbing.service.d.ts.map +1 -0
- package/dist/services/songbing/songbing.service.js +155 -0
- package/dist/services/songbing/songbing.service.js.map +1 -0
- package/dist/services/system/device-sync.service.d.ts +2 -0
- package/dist/services/system/device-sync.service.d.ts.map +1 -0
- package/dist/services/system/device-sync.service.js +51 -0
- package/dist/services/system/device-sync.service.js.map +1 -0
- package/package.json +2 -1
- package/web/dist/assets/{ConfirmDialog-B03GcCHQ.js → ConfirmDialog-IKK1F-1U.js} +1 -1
- package/web/dist/assets/PcLayout-CLW13hCk.js +1 -0
- package/web/dist/assets/{aiLogsView-Bt8Xg1Qx.js → aiLogsView-D6QEk_U9.js} +1 -1
- package/web/dist/assets/{cssMode-CBb6D87U.js → cssMode-QPobA5wX.js} +1 -1
- package/web/dist/assets/{customActionsView-DdjnHzwm.js → customActionsView-ClRg3U7-.js} +1 -1
- package/web/dist/assets/{deployView-Cj51_Job.js → deployView-DUWf2jhH.js} +1 -1
- package/web/dist/assets/designView-BjjT_eB5.css +1 -0
- package/web/dist/assets/designView-DKuJizPM.js +18 -0
- package/web/dist/assets/devWorkflowView-CNmKhVZJ.js +36 -0
- package/web/dist/assets/devWorkflowView-CiSrMRlP.css +1 -0
- package/web/dist/assets/{devWorkflowViewApp-DLslXEq9.js → devWorkflowViewApp-C61Ulpxv.js} +1 -1
- package/web/dist/assets/{fileZihao-CtZ4bUIH.js → fileZihao-BTpK560o.js} +1 -1
- package/web/dist/assets/{freemarker2-CX3jc3l2.js → freemarker2-DvYwU7jd.js} +1 -1
- package/web/dist/assets/gitChanges-5Yut6NPa.css +1 -0
- package/web/dist/assets/gitChanges-CRoMAiCZ.js +2 -0
- package/web/dist/assets/{gitChangesApp-ZI7-V8oB.js → gitChangesApp-DWWUQkP3.js} +1 -1
- package/web/dist/assets/{handlebars-CTaQD6FN.js → handlebars-CK4TZqgf.js} +1 -1
- package/web/dist/assets/{html-BruJsfYv.js → html-Dyb2cBd1.js} +1 -1
- package/web/dist/assets/{htmlMode-wewroXLr.js → htmlMode-BgucwytQ.js} +1 -1
- package/web/dist/assets/{index-C0xmVTIn.css → index-CLl7xUVM.css} +1 -1
- package/web/dist/assets/{index-Cn73hS12.js → index-CUBJZpK-.js} +195 -195
- package/web/dist/assets/{javascript-B4ku8P1-.js → javascript-C2N5q77q.js} +1 -1
- package/web/dist/assets/{jsonMode-BIvVuBMG.js → jsonMode-CROJscjh.js} +1 -1
- package/web/dist/assets/{liquid-Bo3G0Ep7.js → liquid-BbMQX3iL.js} +1 -1
- package/web/dist/assets/{mdx-Duv0ylZz.js → mdx-DJKFF9Ub.js} +1 -1
- package/web/dist/assets/{mediaChat-RT7iqqYb.js → mediaChat-DHxUlCTa.js} +1 -1
- package/web/dist/assets/{python-CEhCctGm.js → python-DVBiUABc.js} +1 -1
- package/web/dist/assets/{razor-DPK8nTD7.js → razor-BFkZw5AO.js} +1 -1
- package/web/dist/assets/taskView-Bg6voWmj.js +1 -0
- package/web/dist/assets/{terminalView-GTYtDlus.js → terminalView-DJPI44tU.js} +1 -1
- package/web/dist/assets/{tsMode-BZvUU1nf.js → tsMode-CQoCUTDo.js} +1 -1
- package/web/dist/assets/{typescript-CmEn-k1B.js → typescript-DrsQGMkk.js} +1 -1
- package/web/dist/assets/wikiView-B-OhVpHv.css +1 -0
- package/web/dist/assets/{wikiView-CRjg-cZ8.js → wikiView-DyH2kquo.js} +1 -1
- package/web/dist/assets/{xml-bjvdKeyy.js → xml-BtAJQIGO.js} +1 -1
- package/web/dist/assets/{yaml-N5RXWxJk.js → yaml-vvMVX3ro.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/PcLayout-ZTdJNg7G.js +0 -1
- package/web/dist/assets/designView-C3pSX4nP.css +0 -1
- package/web/dist/assets/designView-RT8tKEN9.js +0 -18
- package/web/dist/assets/devWorkflowView-BTozmaiN.js +0 -36
- package/web/dist/assets/devWorkflowView-DYhIfbCB.css +0 -1
- package/web/dist/assets/gitChanges-D6QxPcii.css +0 -1
- package/web/dist/assets/gitChanges-DFRvzL5I.js +0 -2
- package/web/dist/assets/taskView-sOyebRqn.js +0 -1
- package/web/dist/assets/wikiView-C-oqMnJM.css +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{n as d,I as g,R as m,D as f,S as v,M as C,g as p,a as o,s as S,b,F as k,c as w,e as D,K as P,d as M,f as x}from"./index-CUBJZpK-.js";import{m as y}from"./mediaChat-DHxUlCTa.js";const T={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 F=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)])},j=[],V=d(T,F,j,!1,null,"86f1727d");const R=V.exports,q={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 B=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)},L=[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(" 创建新需求")])])}],W=d(q,B,L,!1,null,"1cbab0a8");const z=W.exports,N={name:"DesignDiscuss",components:{ModelSelectDialog:C,SkillSelectDialog:v,DesignSelectDialog:f,ResizableTextarea:m,ImagePreviewList:g},mixins:[y()],props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{discussions:[],currentDiscussion:null,dropdownOpen:!1,activeMenuId:null,renamingId:null,renameTitle:"",deleteDialogVisible:!1,deleteTarget:null,logItems:[],inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,modelName:"",modelSelectVisible:!1,skillSelectVisible:!1,designSelectVisible:!1,skillCursorPos:-1,sessionStatus:"idle",wsUnsubscribe:null}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`},sessionFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/session.json`}},watch:{category:{handler(){this.loadData()}},name:{handler(){this.loadData()}}},async mounted(){document.addEventListener("mousedown",this.onDocumentMouseDown),await this.loadData(),await this.loadDefaultModel()},beforeDestroy(){document.removeEventListener("mousedown",this.onDocumentMouseDown),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
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},onDocumentMouseDown(s){this.activeMenuId&&!s.target.closest(".item-actions")&&(this.activeMenuId=null),this.dropdownOpen&&!s.target.closest(".discuss-dropdown")&&(this.dropdownOpen=!1)},async loadData(){await this.loadDiscussions()},async loadDiscussions(){var s;if(!this.category||!this.name){this.discussions=[],this.currentDiscussion=null;return}try{const e=await o.getFileContent(this.sessionFilePath);if(e&&((s=e.data)!=null&&s.content)){const t=JSON.parse(e.data.content);this.discussions=t.designDiscussions||[]}else this.discussions=[];this.discussions.length>0&&!this.currentDiscussion&&await this.switchDiscussion(this.discussions[0])}catch(e){console.error("Load discussions failed:",e),this.discussions=[],this.currentDiscussion=null}},async saveDiscussions(){var s;if(!(!this.category||!this.name))try{const e=await o.getFileContent(this.sessionFilePath);let t={};e&&((s=e.data)!=null&&s.content)&&(t=JSON.parse(e.data.content)),t.designDiscussions=this.discussions,await o.writeFile(this.sessionFilePath,JSON.stringify(t,null,2))}catch(e){console.error("Save discussions failed:",e)}},async createDiscussion(){var s,e,t,i;try{const a=`探讨${this.discussions.length+1}`,n=await o.createSession(a),l={id:((s=n.data)==null?void 0:s.id)||((e=n.data)==null?void 0:e.sessionId)||Date.now().toString(),sessionId:((t=n.data)==null?void 0:t.id)||((i=n.data)==null?void 0:i.sessionId),title:a,createdAt:new Date().toISOString()};this.discussions.push(l),await this.saveDiscussions(),this.dropdownOpen=!1,await this.switchDiscussion(l)}catch(a){console.error("Create discussion failed:",a),this.$message.error("创建探讨失败")}},async switchDiscussion(s){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null),this.currentDiscussion=s,this.dropdownOpen=!1,this.activeMenuId=null,this.logItems=[],this.inputMessage="",this.disabled=!1,this.stopping=!1,this.promptTokens=0,this.sessionStatus="idle",this.mediaFiles=[],s&&s.sessionId&&(await this.loadMessages(),this.subscribeSession())},startRename(s){this.activeMenuId=null,this.$prompt("请输入新名称","重命名探讨",{confirmButtonText:"确定",cancelButtonText:"取消",inputValue:s.title}).then(async({value:e})=>{e&&e.trim()&&(s.title=e.trim(),await this.saveDiscussions())}).catch(()=>{})},confirmDelete(s){this.activeMenuId=null,this.deleteTarget=s,this.deleteDialogVisible=!0},async doDelete(){const s=this.deleteTarget;if(this.deleteDialogVisible=!1,this.deleteTarget=null,!!s)try{await o.deleteSession(s.sessionId);const e=this.discussions.findIndex(t=>t.id===s.id);e!==-1&&this.discussions.splice(e,1),await this.saveDiscussions(),this.currentDiscussion&&this.currentDiscussion.id===s.id&&(this.discussions.length>0?await this.switchDiscussion(this.discussions[0]):(this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null),this.currentDiscussion=null,this.logItems=[],this.promptTokens=0,this.sessionStatus="idle"))}catch(e){console.error("Delete discussion failed:",e),this.$message.error("删除探讨失败")}},async sendMessage(){const s=this.inputMessage.trim(),e=this.mediaFiles&&this.mediaFiles.length>0;if(!s&&!e||this.disabled)return;if(!this.currentDiscussion||!this.currentDiscussion.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession();const t=`方案路径:${this.specFilePath}
|
|
3
|
+
|
|
4
|
+
这个是对这个方案的探讨 你只需要回答用户的问题即可 不需要修改方案 也不要修改代码
|
|
5
|
+
|
|
6
|
+
用户输入: ${s}`;this.inputMessage="",this.disabled=!0,this.stopping=!1;const i=(this.mediaFiles||[]).filter(a=>!a.uploading&&a.filePath).map(a=>({filePath:a.filePath,type:a.type,dataUrl:a.dataUrl}));this.logItems.push({type:"chat",content:s,mediaFiles:i}),this.scrollChatToBottom(!0),o.sessionWsSend(this.currentDiscussion.sessionId,"chat",{message:t,sessionId:this.currentDiscussion.sessionId,modelName:this.modelName||void 0,mediaFiles:i.map(a=>({filePath:a.filePath,type:a.type}))}),this.mediaFiles=[]},stopChat(){!this.currentDiscussion||!this.currentDiscussion.sessionId||this.stopping||(this.stopping=!0,o.sessionWsSend(this.currentDiscussion.sessionId,"stop",{sessionId:this.currentDiscussion.sessionId}))},subscribeSession(){!this.currentDiscussion||!this.currentDiscussion.sessionId||(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=o.wsSubscribe(this.currentDiscussion.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.currentDiscussion.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollChatToBottom()},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.scrollChatToBottom()},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.scrollChatToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollChatToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollChatToBottom(s=!1){const e=S(this.$refs.messagesContainer);this.$nextTick(()=>{b(this.$refs.messagesContainer,{force:s,prevSnapshot:e})})},async loadMessages(){if(!(!this.currentDiscussion||!this.currentDiscussion.sessionId))try{const s=await o.getMessages(this.currentDiscussion.sessionId);this.logItems=s.data||[],this.scrollChatToBottom(!0)}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)},openSkillSelect(){const s=this.$el.querySelector(".input-area textarea");this.skillCursorPos=s?s.selectionStart:-1,this.skillSelectVisible=!0},onSkillSelected(s){const e=`[${s}] `,t=this.skillCursorPos>=0?this.skillCursorPos:0;this.inputMessage=this.inputMessage.slice(0,t)+e+this.inputMessage.slice(t),this.skillSelectVisible=!1},openDesignSelect(){this.designSelectVisible=!0},onDesignSelected(s){const e=`[设计:${s.name}](${s.path}) `;this.inputMessage+=e,this.designSelectVisible=!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?p(s):""}}};var U=function(){var e=this,t=e._self._c;return t("div",{staticClass:"discuss-container"},[e.discussions.length>0?t("div",{staticClass:"discuss-dropdown"},[t("div",{staticClass:"dropdown-trigger",on:{click:function(i){e.dropdownOpen=!e.dropdownOpen}}},[t("span",{staticClass:"dropdown-title"},[e._v(e._s(e.currentDiscussion?e.currentDiscussion.title:"选择探讨"))]),t("i",{staticClass:"el-icon-arrow-down",class:{rotated:e.dropdownOpen}})]),e.dropdownOpen?t("div",{staticClass:"dropdown-menu"},[e._l(e.discussions,function(i){return t("div",{key:i.id,staticClass:"dropdown-item",class:{active:e.currentDiscussion&&e.currentDiscussion.id===i.id}},[t("span",{staticClass:"item-title",on:{click:function(a){return e.switchDiscussion(i)}}},[e._v(e._s(i.title))]),t("span",{staticClass:"item-actions",on:{click:function(a){a.stopPropagation()}}},[t("span",{staticClass:"menu-trigger",on:{click:function(a){a.stopPropagation(),e.activeMenuId=e.activeMenuId===i.id?null:i.id}}},[e._v("⋮")]),e.activeMenuId===i.id?t("div",{staticClass:"menu-popup"},[t("div",{staticClass:"menu-item",on:{click:function(a){return a.stopPropagation(),e.startRename(i)}}},[e._v("重命名")]),t("div",{staticClass:"menu-item danger",on:{click:function(a){return a.stopPropagation(),e.confirmDelete(i)}}},[e._v("删除")])]):e._e()])])}),t("div",{staticClass:"dropdown-item add-item",on:{click:e.createDiscussion}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建探讨 ")])],2):e._e()]):e._e(),!e.currentDiscussion&&e.discussions.length===0?t("div",{staticClass:"empty-discuss"},[t("div",{staticClass:"empty-card",on:{click:e.createDiscussion}},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("新建探讨")]),t("span",[e._v("点击创建第一个方案探讨会话")])])]):e._e(),e.currentDiscussion?[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,l){return t("div",{key:l,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"},[i.mediaFiles&&i.mediaFiles.length>0?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(n){return t("img",{key:n.filePath,staticClass:"chat-image-thumb",attrs:{src:n.url||n.dataUrl||n.filePath},on:{click:function(l){return l.stopPropagation(),e.openImagePreview(n)}}})}),0):e._e(),t("div",[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,l){return t("div",{key:l,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()])})]:i.type==="think"?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):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"},[e.mediaFiles&&e.mediaFiles.length>0?t("ImagePreviewList",{attrs:{files:e.mediaFiles,disabled:e.disabled},on:{remove:e.removeMedia}}):e._e(),t("div",{staticClass:"input-panel"},[t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入探讨内容... (Enter 发送, Ctrl+Enter 换行)",disabled:e.disabled&&!e.stopping},on:{"paste-image":e.handlePasteImages},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("input",{ref:"mediaInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:e.handleImageSelected}})],1),t("div",{staticClass:"input-actions"},[t("span",{staticClass:"status-action",on:{click:e.openSkillSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openDesignSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择设计")]),t("span",{staticClass:"separator"},[e._v("|")]),t("el-button",{staticClass:"upload-btn",attrs:{disabled:e.disabled,size:"small"},on:{click:e.handleImageUpload}},[e._v("图片")]),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger",size:"small"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:"",size:"small"}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()&&e.mediaFiles.length===0,size:"small"},on:{click:e.sendMessage}},[e._v(" 发送 ")])],1)])],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.currentDiscussion.sessionId?e.currentDiscussion.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))])])]:e._e(),t("el-dialog",{attrs:{visible:e.deleteDialogVisible,title:"确认删除",width:"360px","close-on-click-modal":!1},on:{"update:visible":function(i){e.deleteDialogVisible=i}}},[t("p",[e._v("确定要删除探讨「"+e._s(e.deleteTarget?e.deleteTarget.title:"")+"」吗?此操作不可恢复。")]),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.deleteDialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"danger"},on:{click:e.doDelete}},[e._v("删除")])],1)]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:function(i){e.skillSelectVisible=!1}}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e()],2)},E=[],O=d(N,U,E,!1,null,"ae48df15");const A=O.exports,K={name:"Step2Design",components:{ModelSelectDialog:C,CommandDialog:w,FileSelectDialog:k,SkillSelectDialog:v,DesignSelectDialog:f,ResizableTextarea:m,ImagePreviewList:g,DesignDiscuss:A},mixins:[y()],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,skillSelectVisible:!1,designSelectVisible:!1,skillCursorPos:-1,sessionId:"",sessionStatus:"idle",customActions:[],chatTab:"assistant",parentInfo:null,chatPanelWidth:480,isResizing:!1,startX:0,startWidth:0,minChatWidth:320,maxChatWidthRatio:.6}},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()}},reqBasePath:{handler(s){s&&this.loadData()}}},async mounted(){document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),this.initMonacoEditor(),await this.loadData(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),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)+`
|
|
7
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadData(){this.reqBasePath&&await Promise.all([this.loadSpec(),this.loadSession()])},async loadSpec(){var s;if(!this.category||!this.name){this.specContent=`# 选择或创建需求项目开始设计
|
|
8
|
+
`,this.syncEditorContent(this.specContent);return}try{const e=this.specFilePath,t=await o.getFileContent(e);this.specContent=((s=t.data)==null?void 0:s.content)||"",this.syncEditorContent(this.specContent)}catch(e){console.error("Load spec failed:",e),this.specContent="",this.syncEditorContent("")}},async loadSession(){var s;if(!this.category||!this.name){this.sessionId="",this.$emit("update:sessionId",""),this.parentInfo=null;return}try{const e=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,t=await o.getFileContent(e);if(t&&((s=t.data)!=null&&s.content)){const i=JSON.parse(t.data.content);this.sessionId=i.designSessionId||"",this.parentInfo=i.parent||null}else this.sessionId="",this.parentInfo=null;this.$emit("update:sessionId",this.sessionId),this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(e){console.error("Load session failed:",e),this.sessionId="",this.$emit("update:sessionId",""),this.parentInfo=null,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=D.create(this.$refs.editorContainer,{value:this.specContent||`# 选择或创建需求项目开始设计
|
|
9
|
+
`,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},scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6,useShadows:!1}}),this.editor.addCommand(P.CtrlCmd|M.KeyS,()=>{this.saveSpec()}),this.syncEditorContent(this.specContent))},saveSpec(){if(!this.editor)return;const s=this.editor.getValue();this.$emit("save-spec",s)},async refreshSpec(){await this.loadSpec(),this.$message.success("方案已刷新")},exportScheme(){if(!this.category||!this.name){this.$message.warning("请先选择方案");return}const s=`${this.name}_方案.md`;o.downloadFilesystemWithProgress(this.specFilePath,s)},async sendMessage(){const s=this.inputMessage.trim(),e=this.mediaFiles&&this.mediaFiles.length>0;if(!s&&!e||this.disabled)return;if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession();let t="";this.logItems.length===0&&this.parentInfo&&(t=`
|
|
10
|
+
|
|
11
|
+
注意:当前方案是「${this.parentInfo.name}」的子方案,请参考父方案内容。父方案路径:${this.parentInfo.specPath}`);const i=`先在 ${this.specFilePath} 生成方案,先不要修改代码。${t}
|
|
12
|
+
|
|
13
|
+
用户输入: ${s}`;this.inputMessage="",this.disabled=!0,this.stopping=!1;const a=(this.mediaFiles||[]).filter(n=>!n.uploading&&n.filePath).map(n=>({filePath:n.filePath,type:n.type,dataUrl:n.dataUrl}));this.logItems.push({type:"chat",content:s,mediaFiles:a}),this.scrollChatToBottom(!0),o.sessionWsSend(this.sessionId,"chat",{message:i,sessionId:this.sessionId,modelName:this.modelName||void 0,mediaFiles:a.map(n=>({filePath:n.filePath,type:n.type}))}),this.mediaFiles=[]},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=>{var e;console.log("[Step2Design] WS todos event, todos count:",(e=s==null?void 0:s.todos)==null?void 0:e.length),s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollChatToBottom()},step:s=>{var e,t;console.log("[Step2Design] WS step event, has thought:",!!s.thought,"toolCalls:",(e=s==null?void 0:s.toolCalls)==null?void 0:e.length),this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(t=s.usage)!=null&&t.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollChatToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;console.log("[Step2Design] WS done event"),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.scrollChatToBottom()},stopped:()=>{console.log("[Step2Design] WS stopped event"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollChatToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollChatToBottom(s=!1){const e=S(this.$refs.messagesContainer);console.log("[Step2Design] scrollChatToBottom called, force:",s,"snap:",JSON.stringify(e)),this.$nextTick(()=>{b(this.$refs.messagesContainer,{force:s,prevSnapshot:e})})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollChatToBottom(!0)}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},openSkillSelect(){const s=this.$el.querySelector(".input-area textarea");this.skillCursorPos=s?s.selectionStart:-1,this.skillSelectVisible=!0},onSkillSelected(s){const e=`[${s}] `,t=this.skillCursorPos>=0?this.skillCursorPos:0;this.inputMessage=this.inputMessage.slice(0,t)+e+this.inputMessage.slice(t),this.cancelSkillSelect()},cancelSkillSelect(){this.skillSelectVisible=!1},openDesignSelect(){this.designSelectVisible=!0},onDesignSelected(s){const e=`[设计:${s.name}](${s.path}) `;this.inputMessage+=e,this.designSelectVisible=!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?p(s):""},openCustomActions(){window.open("/#/views/pc/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()})},startResize(s){this.isResizing=!0,this.startX=s.clientX,this.startWidth=this.chatPanelWidth,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},handleResize(s){if(!this.isResizing)return;const e=this.startX-s.clientX;let t=this.startWidth+e;const i=this.$el.querySelector(".step2-main"),a=i?i.clientWidth*this.maxChatWidthRatio:800;t<this.minChatWidth&&(t=this.minChatWidth),t>a&&(t=a),this.chatPanelWidth=t},stopResize(){this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect=""}}};var J=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("span",{staticClass:"editor-title"},[t("i",{staticClass:"el-icon-document"}),t("span",[e._v(e._s(e.specFilePath))])]),t("div",{staticClass:"editor-actions"},[t("el-button",{attrs:{size:"small",type:"text",title:"保存方案"},on:{click:e.saveSpec}},[t("i",{staticClass:"el-icon-check"})]),t("el-button",{attrs:{size:"small",type:"text",title:"刷新方案"},on:{click:e.refreshSpec}},[t("i",{staticClass:"el-icon-refresh"})]),t("el-button",{attrs:{size:"small",type:"text",title:"导出方案"},on:{click:e.exportScheme}},[t("i",{staticClass:"el-icon-download"})]),t("el-button",{attrs:{size:"small",type:"text",title:"新建子方案"},on:{click:function(i){return e.$emit("create-sub-scheme")}}},[t("i",{staticClass:"el-icon-plus"})])],1)]),t("div",{ref:"editorContainer",staticClass:"editor-container"})]),t("div",{staticClass:"resize-handle",on:{mousedown:e.startResize}}),t("div",{ref:"chatPanel",staticClass:"chat-panel",style:{width:e.chatPanelWidth+"px"}},[t("div",{staticClass:"panel-header panel-tabs"},[t("div",{staticClass:"panel-tab",class:{active:e.chatTab==="assistant"},on:{click:function(i){e.chatTab="assistant"}}},[t("i",{staticClass:"el-icon-chat-dot-round"}),e._v(" AI生成方案 ")]),t("div",{staticClass:"panel-tab",class:{active:e.chatTab==="discuss"},on:{click:function(i){e.chatTab="discuss"}}},[t("i",{staticClass:"el-icon-chat-dot-square"}),e._v(" AI方案交流 ")])]),e.chatTab==="assistant"?[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,l){return t("div",{key:l,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"},[i.mediaFiles&&i.mediaFiles.length>0?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(n){return t("img",{key:n.filePath,staticClass:"chat-image-thumb",attrs:{src:n.url||n.dataUrl||n.filePath},on:{click:function(l){return l.stopPropagation(),e.openImagePreview(n)}}})}),0):e._e(),t("div",[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,l){return t("div",{key:l,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()])})]:i.type==="think"?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):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"},[e.mediaFiles&&e.mediaFiles.length>0?t("ImagePreviewList",{attrs:{files:e.mediaFiles,disabled:e.disabled},on:{remove:e.removeMedia}}):e._e(),t("div",{staticClass:"input-panel"},[t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},on:{"paste-image":e.handlePasteImages},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("input",{ref:"mediaInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:e.handleImageSelected}})],1),t("div",{staticClass:"input-actions"},[t("div",{staticClass:"input-actions-left"},[t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openSkillSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openDesignSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择设计")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")])]),t("div",{staticClass:"input-actions-right"},[t("el-button",{staticClass:"upload-btn",attrs:{disabled:e.disabled,size:"small"},on:{click:e.handleImageUpload}},[e._v("图片")]),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",size:"small"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:"",size:"small"}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()&&e.mediaFiles.length===0,size:"small"},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)])]),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))])])],1)]:e._e(),e.chatTab==="discuss"?t("DesignDiscuss",{attrs:{category:e.category,name:e.name,reqBasePath:e.reqBasePath}}):e._e()],2)]),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}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:e.cancelSkillSelect}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e()],1)},H=[],X=d(K,J,H,!1,null,"41db44ff");const G=X.exports,Q={name:"Step3CodeGen",components:{ModelSelectDialog:C,CommandDialog:w,FileSelectDialog:k,SkillSelectDialog:v,DesignSelectDialog:f,ResizableTextarea:m,ImagePreviewList:g},mixins:[y()],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,skillSelectVisible:!1,designSelectVisible:!1,skillCursorPos:-1,sessionId:"",sessionStatus:"idle",customActions:[],devLogContent:"",devLogLoading:!1,devlogPanelWidth:400,isResizing:!1,startX:0,startWidth:0,minDevlogWidth:250,maxDevlogWidthRatio:.6}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`},renderedDevLog(){return this.devLogContent?p(this.devLogContent):'<p style="color: var(--color-textMuted);">暂无记录</p>'}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),await this.loadSession(),await this.loadDefaultModel(),await this.loadCustomActions(),o.ws.init()},beforeDestroy(){document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),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)+`
|
|
14
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){var s;if(!this.category||!this.name){this.sessionId="",this.$emit("update:sessionId","");return}try{const e=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,t=await o.getFileContent(e);if(t&&((s=t.data)!=null&&s.content)){const i=JSON.parse(t.data.content);this.sessionId=i.codeSessionId||""}else this.sessionId="";this.$emit("update:sessionId",this.sessionId),this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(e){console.error("Load session failed:",e),this.sessionId="",this.$emit("update:sessionId",""),this.logItems=[]}},insertGenerateCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案开发相应功能,先不要修改方案文档。`)},async sendMessage(){const s=this.inputMessage.trim(),e=this.mediaFiles&&this.mediaFiles.length>0;if(!s&&!e||this.disabled)return;if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1;const t=(this.mediaFiles||[]).filter(i=>!i.uploading&&i.filePath).map(i=>({filePath:i.filePath,type:i.type,dataUrl:i.dataUrl}));this.logItems.push({type:"chat",content:s,mediaFiles:t}),this.scrollChatToBottom(!0),o.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0,enableDevLog:!0,mediaFiles:t.map(i=>({filePath:i.filePath,type:i.type}))}),this.mediaFiles=[]},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.scrollChatToBottom()},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.scrollChatToBottom()},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.loadDevLog(),this.scrollChatToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollChatToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollChatToBottom(s=!1){const e=S(this.$refs.messagesContainer);console.log("[Step3CodeGen] scrollChatToBottom called, force:",s,"snap:",JSON.stringify(e)),this.$nextTick(()=>{b(this.$refs.messagesContainer,{force:s,prevSnapshot:e})})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollChatToBottom(!0)}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},openSkillSelect(){const s=this.$el.querySelector(".input-area textarea");this.skillCursorPos=s?s.selectionStart:-1,this.skillSelectVisible=!0},onSkillSelected(s){const e=`[${s}] `,t=this.skillCursorPos>=0?this.skillCursorPos:0;this.inputMessage=this.inputMessage.slice(0,t)+e+this.inputMessage.slice(t),this.cancelSkillSelect()},cancelSkillSelect(){this.skillSelectVisible=!1},openDesignSelect(){this.designSelectVisible=!0},onDesignSelected(s){const e=`[设计:${s.name}](${s.path}) `;this.inputMessage+=e,this.designSelectVisible=!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?p(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("/#/views/pc/custom-actions","_blank")},async loadDevLog(){var s;if(this.sessionId){this.devLogLoading=!0;try{const t=await(await fetch(`/api/devlog/list_devlog?sessionId=${this.sessionId}`)).json();t.success&&(this.devLogContent=((s=t.data)==null?void 0:s.content)||"")}catch(e){console.error("加载开发日志失败:",e)}finally{this.devLogLoading=!1}}},async refreshDevLog(){await this.loadDevLog()},startResize(s){this.isResizing=!0,this.startX=s.clientX,this.startWidth=this.devlogPanelWidth,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},handleResize(s){if(!this.isResizing)return;const e=this.startX-s.clientX;let t=this.startWidth+e;const i=this.$el.querySelector(".step3-main"),a=i?i.clientWidth*this.maxDevlogWidthRatio:800;t<this.minDevlogWidth&&(t=this.minDevlogWidth),t>a&&(t=a),this.devlogPanelWidth=t},stopResize(){this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect=""}}};var Y=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,l){return t("div",{key:l,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"},[i.mediaFiles&&i.mediaFiles.length>0?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(n){return t("img",{key:n.filePath,staticClass:"chat-image-thumb",attrs:{src:n.url||n.dataUrl||n.filePath},on:{click:function(l){return l.stopPropagation(),e.openImagePreview(n)}}})}),0):e._e(),t("div",[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,l){return t("div",{key:l,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"},[e.mediaFiles&&e.mediaFiles.length>0?t("ImagePreviewList",{attrs:{files:e.mediaFiles,disabled:e.disabled},on:{remove:e.removeMedia}}):e._e(),t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入代码修改要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},on:{"paste-image":e.handlePasteImages},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("input",{ref:"mediaInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:e.handleImageSelected}}),t("div",{staticClass:"input-actions"},[t("el-button",{staticClass:"upload-btn",attrs:{disabled:e.disabled,size:"small"},on:{click:e.handleImageUpload}},[e._v("图片")]),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",size:"small"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:"",size:"small"}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()&&e.mediaFiles.length===0,size:"small"},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)],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("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openSkillSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openDesignSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择设计")])])]),t("div",{staticClass:"resize-handle",on:{mousedown:e.startResize}}),t("div",{ref:"devlogPanel",staticClass:"devlog-panel",style:{width:e.devlogPanelWidth+"px"}},[t("div",{staticClass:"panel-header"},[e._m(1),t("el-button",{attrs:{size:"small"},on:{click:e.refreshDevLog}},[t("i",{staticClass:"el-icon-refresh"}),e._v(" 刷新 ")])],1),t("div",{staticClass:"devlog-content",domProps:{innerHTML:e._s(e.renderedDevLog)}})])]),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}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:e.cancelSkillSelect}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e()],1)},Z=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-code"}),s._v(" 代码生成对话")])},function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-document"}),s._v(" 开发记录")])}],ee=d(Q,Y,Z,!1,null,"def50e8d");const se=ee.exports,te={name:"Step4Test",components:{ModelSelectDialog:C,CommandDialog:w,FileSelectDialog:k,SkillSelectDialog:v,DesignSelectDialog:f,ResizableTextarea:m,ImagePreviewList:g},mixins:[y()],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,skillSelectVisible:!1,designSelectVisible:!1,skillCursorPos:-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)+`
|
|
15
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){var s;if(!this.category||!this.name){this.sessionId="",this.$emit("update:sessionId","");return}try{const e=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,t=await o.getFileContent(e);if(t&&((s=t.data)!=null&&s.content)){const i=JSON.parse(t.data.content);this.sessionId=i.testSessionId||""}else this.sessionId="";this.$emit("update:sessionId",this.sessionId),this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(e){console.error("Load session failed:",e),this.sessionId="",this.$emit("update:sessionId",""),this.logItems=[]}},insertTestCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案测试相应功能是否实现。`)},async sendMessage(){const s=this.inputMessage.trim(),e=this.mediaFiles&&this.mediaFiles.length>0;if(!s&&!e||this.disabled)return;if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1;const t=(this.mediaFiles||[]).filter(i=>!i.uploading&&i.filePath).map(i=>({filePath:i.filePath,type:i.type,dataUrl:i.dataUrl}));this.logItems.push({type:"chat",content:s,mediaFiles:t}),this.scrollChatToBottom(!0),o.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0,mediaFiles:t.map(i=>({filePath:i.filePath,type:i.type}))}),this.mediaFiles=[]},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.scrollChatToBottom()},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.scrollChatToBottom()},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.scrollChatToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollChatToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollChatToBottom(s=!1){const e=S(this.$refs.messagesContainer);console.log("[Step4Test] scrollChatToBottom called, force:",s,"snap:",JSON.stringify(e)),this.$nextTick(()=>{b(this.$refs.messagesContainer,{force:s,prevSnapshot:e})})},async loadMessages(){if(this.sessionId)try{const s=await o.getMessages(this.sessionId);this.logItems=s.data||[],this.scrollChatToBottom(!0)}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},openSkillSelect(){const s=this.$el.querySelector(".input-area textarea");this.skillCursorPos=s?s.selectionStart:-1,this.skillSelectVisible=!0},onSkillSelected(s){const e=`[${s}] `,t=this.skillCursorPos>=0?this.skillCursorPos:0;this.inputMessage=this.inputMessage.slice(0,t)+e+this.inputMessage.slice(t),this.cancelSkillSelect()},cancelSkillSelect(){this.skillSelectVisible=!1},openDesignSelect(){this.designSelectVisible=!0},onDesignSelected(s){const e=`[设计:${s.name}](${s.path}) `;this.inputMessage+=e,this.designSelectVisible=!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?p(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 ie=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,l){return t("div",{key:l,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"},[i.mediaFiles&&i.mediaFiles.length>0?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(n){return t("img",{key:n.filePath,staticClass:"chat-image-thumb",attrs:{src:n.url||n.dataUrl||n.filePath},on:{click:function(l){return l.stopPropagation(),e.openImagePreview(n)}}})}),0):e._e(),t("div",[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,l){return t("div",{key:l,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"},[e.mediaFiles&&e.mediaFiles.length>0?t("ImagePreviewList",{attrs:{files:e.mediaFiles,disabled:e.disabled},on:{remove:e.removeMedia}}):e._e(),t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入测试要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},on:{"paste-image":e.handlePasteImages},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("input",{ref:"mediaInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:e.handleImageSelected}}),t("div",{staticClass:"input-actions"},[t("el-button",{staticClass:"upload-btn",attrs:{disabled:e.disabled,size:"small"},on:{click:e.handleImageUpload}},[e._v("图片")]),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",size:"small"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:"",size:"small"}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()&&e.mediaFiles.length===0,size:"small"},on:{click:e.sendMessage}},[e._v(" 发送 ")])],2)],1)],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("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openSkillSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openDesignSelect,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}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:e.cancelSkillSelect}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e()],1)},ne=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-s-check"}),s._v(" 测试验收对话")])}],ae=d(te,ie,ne,!1,null,"75f7cf43");const oe=ae.exports,le={name:"SubSchemeDialog",props:{visible:{type:Boolean,default:!1},category:{type:String,default:""},parentName:{type:String,default:""},defaultName:{type:String,default:""}},data(){return{name:""}},watch:{visible(s){s&&(this.name=this.defaultName)}},methods:{handleVisibleChange(s){this.$emit("update:visible",s)},handleClose(){this.$emit("cancel")},onConfirm(){const s=this.name.trim();s&&(this.$emit("confirm",s),this.$emit("update:visible",!1))},onCancel(){this.$emit("cancel"),this.$emit("update:visible",!1)}}};var re=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"新建子方案",width:"420px"},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("el-form",{attrs:{"label-width":"80px"}},[t("el-form-item",{attrs:{label:"方案名称"}},[t("el-input",{attrs:{placeholder:"请输入子方案名称"},nativeOn:{keyup:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.onConfirm.apply(null,arguments)}},model:{value:e.name,callback:function(i){e.name=i},expression:"name"}})],1),t("el-form-item",{attrs:{label:"所属大类"}},[t("span",[e._v(e._s(e.category))])]),t("el-form-item",{attrs:{label:"父方案"}},[t("span",[e._v(e._s(e.parentName))])])],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.onCancel}},[e._v("取消")]),t("el-button",{attrs:{type:"primary",disabled:!e.name.trim()},on:{click:e.onConfirm}},[e._v("确认")])],1)],1)},ce=[],de=d(le,re,ce,!1,null,null);const ue=de.exports,he={name:"DevWorkflowView",components:{WorkflowSidebar:R,Step1NewReq:z,Step2Design:G,Step3CodeGen:se,Step4Test:oe,SubSchemeDialog:ue},props:{sidebarVisible:{type:Boolean,default:!0}},data(){return{currentCategory:"",currentProject:"",currentStep:1,categories:[],projects:{},reqBasePath:"",isLoadingProjects:!1,designSessionId:"",codeSessionId:"",testSessionId:"",taskStatus:"idle",unsubRunning:null,subSchemeDialogVisible:!1,subSchemeDefaultName:"",unsubFileChanged:null}},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(){var a,n,l;const s=(a=this.$route.query)==null?void 0:a.category,e=(n=this.$route.query)==null?void 0:n.project,t=parseInt((l=this.$route.query)==null?void 0:l.step)||1,i=!!(s&&e);this.loadCategories(),i?(this.currentCategory=s,this.currentProject=e,this.currentStep=t):this.loadState()},mounted(){console.log("[DevWorkflow][mounted] subscribing to running_sessions"),o.ws.init(),this.unsubRunning=o.ws.on("running_sessions",s=>{var t;const e=((t=s.data)==null?void 0:t.runningSessionIds)||[];console.log("[DevWorkflow][ws] running_sessions event:",e),this.updateTaskStatus(e)}),this.unsubFileChanged=x.on("file:changed",s=>{this.onFileChanged(s)}),console.log("[DevWorkflow][mounted] subscribed to file:changed")},beforeDestroy(){this.unsubRunning&&(this.unsubRunning(),this.unsubRunning=null),this.unsubFileChanged&&(this.unsubFileChanged(),this.unsubFileChanged=null)},watch:{currentProject(){this.updateTitle()},taskStatus(){this.updateTitle()}},methods:{updateDesignSessionId(s){console.log("[DevWorkflow][sessionId] design:",s),this.designSessionId=s},updateCodeSessionId(s){console.log("[DevWorkflow][sessionId] code:",s),this.codeSessionId=s},updateTestSessionId(s){console.log("[DevWorkflow][sessionId] test:",s),this.testSessionId=s},updateTaskStatus(s){const e=[this.designSessionId,this.codeSessionId,this.testSessionId].filter(Boolean);if(console.log("[DevWorkflow][taskStatus] mySessions:",e,"runningIds:",s),e.length===0){console.log("[DevWorkflow][taskStatus] -> idle (no sessions)"),this.taskStatus="idle";return}const t=e.some(i=>s.includes(i));console.log("[DevWorkflow][taskStatus] isRunning:",t,"prevStatus:",this.taskStatus),t?(console.log("[DevWorkflow][taskStatus] -> running"),this.taskStatus="running"):this.taskStatus==="running"&&(console.log("[DevWorkflow][taskStatus] -> completed"),this.taskStatus="completed")},updateTitle(){var t;const s=((t=this.$route.meta)==null?void 0:t.title)||"软件研发";if(!this.currentProject){document.title=`${s} - TXCode`;return}let e="";this.taskStatus==="running"?e="⏳ ":this.taskStatus==="completed"&&(e="✅ "),console.log("[DevWorkflow][updateTitle] status:",this.taskStatus,"title:",`${e}${this.currentProject} · ${s} - TXCode`),document.title=`${e}${this.currentProject} · ${s} - TXCode`},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 i=((s=(await o.getCwd()).data)==null?void 0:s.current_path)||"";this.reqBasePath=i?`${i}/.txcode/req`:"";const n=((e=(await o.browseFilesystem(this.reqBasePath)).data)==null?void 0:e.items)||[];this.categories=n.filter(l=>l.is_directory).map(l=>l.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 l=`${s}/${n.name}`;this.projects[l]={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,this.updateUrlQuery(),s?await this.loadProjectsForCategory(s):this.projects={}},onProjectChange(s){this.currentProject=s,!this.currentProject&&this.currentStep>1&&(this.currentStep=1),this.updateUrlQuery()},onStepChange(s){!this.currentProject&&s>1||(this.currentStep=s,this.updateUrlQuery())},updateUrlQuery(){const s={};this.currentCategory&&(s.category=this.currentCategory),this.currentProject&&(s.project=this.currentProject),this.currentStep>1&&(s.step=String(this.currentStep)),this.$router.replace({query:s}).catch(()=>{})},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}`,i=`${this.reqBasePath}/${e}`;await o.renameFile(t,i);const a=this.categories.indexOf(s);a>-1&&(this.categories[a]=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,l,u;if(this.projects[e]){this.$message.warning("需求已存在");return}try{const r=`${this.reqBasePath}/${s}/${e}`;await o.createDirectory(r)}catch(r){console.error("Create requirement directory failed:",r)}const t=`# ${e}方案
|
|
16
|
+
|
|
17
|
+
> 所属大类:${s}
|
|
18
|
+
|
|
19
|
+
## 用户原始需求
|
|
20
|
+
|
|
21
|
+
## 业务目标
|
|
22
|
+
|
|
23
|
+
## 功能点
|
|
24
|
+
|
|
25
|
+
`;try{const r=`${this.reqBasePath}/${s}/${e}/${e}_方案.md`;await o.writeFile(r,t)}catch(r){console.error("Write spec file failed:",r)}let i={designSessionId:"",codeSessionId:"",testSessionId:""};try{const[r,h,c]=await Promise.all([o.createSession(`workflow:${s}/${e}:design`),o.createSession(`workflow:${s}/${e}:code`),o.createSession(`workflow:${s}/${e}:test`)]);i={designSessionId:((n=r.data)==null?void 0:n.id)||"",codeSessionId:((l=h.data)==null?void 0:l.id)||"",testSessionId:((u=c.data)==null?void 0:u.id)||""};const _=`${this.reqBasePath}/${s}/${e}/session.json`;await o.writeFile(_,JSON.stringify(i,null,2))}catch(r){console.error("Create sessions failed:",r)}const a=`${s}/${e}`;this.$set(this.projects,a,{name:e,stepStatus:{}}),this.currentCategory=s,this.currentProject=e,this.$message.success(`需求「${e}」创建成功`),this.$nextTick(()=>{this.currentStep=2})},async createSubScheme(){var e;if(!this.currentProject||!this.currentCategory){this.$message.warning("请先选择一个方案");return}const s=this.currentProject;try{const t=`${this.reqBasePath}/${this.currentCategory}`,a=((e=(await o.browseFilesystem(t)).data)==null?void 0:e.items)||[];let n=0;const l=new RegExp(`^${this.escapeRegex(s)}_(\\d+)$`);a.filter(r=>r.is_directory).forEach(r=>{const h=r.name.match(l);if(h){const c=parseInt(h[1],10);c>n&&(n=c)}});const u=String(n+1).padStart(2,"0");this.subSchemeDefaultName=`${s}_${u}`,this.subSchemeDialogVisible=!0}catch(t){console.error("Browse category failed:",t),this.$message.error("获取子方案列表失败")}},escapeRegex(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},async onSubSchemeConfirm(s){var u,r,h;this.subSchemeDialogVisible=!1;const e=this.currentProject,t=this.currentCategory;try{const c=`${this.reqBasePath}/${t}/${s}`;await o.createDirectory(c)}catch(c){console.error("Create sub-scheme directory failed:",c),this.$message.error("创建子方案目录失败");return}const i=`${this.reqBasePath}/${t}/${e}/${e}_方案.md`,a=`# ${s}_方案
|
|
26
|
+
|
|
27
|
+
> 所属大类:${t}
|
|
28
|
+
> 父方案:[../${e}/${e}_方案.md](../${e}/${e}_方案.md)
|
|
29
|
+
|
|
30
|
+
## 用户原始需求
|
|
31
|
+
|
|
32
|
+
## 业务目标
|
|
33
|
+
|
|
34
|
+
## 功能点
|
|
35
|
+
|
|
36
|
+
`;try{const c=`${this.reqBasePath}/${t}/${s}/${s}_方案.md`;await o.writeFile(c,a)}catch(c){console.error("Write spec file failed:",c)}let n={designSessionId:"",codeSessionId:"",testSessionId:""};try{const[c,_,I]=await Promise.all([o.createSession(`workflow:${t}/${s}:design`),o.createSession(`workflow:${t}/${s}:code`),o.createSession(`workflow:${t}/${s}:test`)]);n={designSessionId:((u=c.data)==null?void 0:u.id)||"",codeSessionId:((r=_.data)==null?void 0:r.id)||"",testSessionId:((h=I.data)==null?void 0:h.id)||"",parent:{name:e,specPath:i}};const $=`${this.reqBasePath}/${t}/${s}/session.json`;await o.writeFile($,JSON.stringify(n,null,2))}catch(c){console.error("Create sessions failed:",c)}const l=`${t}/${s}`;this.$set(this.projects,l,{name:s,stepStatus:{}}),this.$message.success(`子方案「${s}」创建成功`),window.open(`#/views/pc/devWorkflow?category=${encodeURIComponent(t)}&project=${encodeURIComponent(s)}&step=2`,"_blank")},async onSaveSpec(s){if(!this.projectKey)return;const e=`${this.reqBasePath}/${this.currentCategory}/${this.currentProject}/${this.currentProject}_方案.md`;try{await o.writeFile(e,s),this.$message.success("方案已保存")}catch(t){console.error("Save spec failed:",t),this.$message.error("保存方案失败")}},async refreshSpec(){var s;(s=this.$refs.step2Ref)!=null&&s.loadSpec&&await this.$refs.step2Ref.loadSpec()},onFileChanged(s){var n;if(console.log("[DevWorkflow] file:changed received",s),!this.projectKey||!s.filePath){console.log("[DevWorkflow] file:changed skipped (no projectKey or filePath)");return}const e=`${this.reqBasePath}/${this.currentCategory}/${this.currentProject}/${this.currentProject}_方案.md`.replace(/\\/g,"/"),t=(this.reqBasePath||".txcode/req").replace(/\\/g,"/"),i=s.filePath.replace(/\\/g,"/");if(!(i.indexOf(t)!==-1||i===e)){console.log("[DevWorkflow] file:changed skipped (not related to current project)");return}console.log("[DevWorkflow] file:changed triggering refresh, step:",this.currentStep),this.currentStep===2&&(console.log("[DevWorkflow] file:changed → refreshSpec()"),this.refreshSpec()),this.currentStep===3&&((n=this.$refs.step3Ref)!=null&&n.refreshDevLog)&&(console.log("[DevWorkflow] file:changed → refreshDevLog()"),this.$refs.step3Ref.refreshDevLog())}}};var pe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"dev-workflow-view"},[t("WorkflowSidebar",{ref:"sidebar",attrs:{categories:e.categories,projects:e.projects,"current-category":e.currentCategory,"current-project":e.currentProject,"current-step":e.currentStep,"is-loading":e.isLoadingProjects},on:{"category-change":e.onCategoryChange,"project-change":e.onProjectChange,"step-change":e.onStepChange,"delete-category":e.deleteCategory,"rename-category":e.renameCategory}}),t("div",{staticClass:"main-content"},[t("div",{staticClass:"step-content"},[t("Step1NewReq",{directives:[{name:"show",rawName:"v-show",value:e.currentStep===1,expression:"currentStep === 1"}],attrs:{categories:e.categories,projects:e.projects,"base-path":e.reqBasePath,"current-category":e.currentCategory,"current-project":e.currentProject},on:{"category-change":e.onCategoryChange,"project-change":e.onProjectChange,"create-category":e.createCategory,"create-requirement":e.createRequirement}}),e.currentStep===2&&e.hasSelectedProject?t("Step2Design",{ref:"step2Ref",attrs:{category:e.currentCategory,name:e.currentProject,"req-base-path":e.reqBasePath},on:{"update:sessionId":e.updateDesignSessionId,"save-spec":e.onSaveSpec,"spec-updated":e.refreshSpec,"create-sub-scheme":e.createSubScheme}}):e._e(),e.currentStep===3&&e.hasSelectedProject?t("Step3CodeGen",{ref:"step3Ref",attrs:{category:e.currentCategory,name:e.currentProject,"req-base-path":e.reqBasePath},on:{"update:sessionId":e.updateCodeSessionId}}):e._e(),e.currentStep===4&&e.hasSelectedProject?t("Step4Test",{ref:"step4Ref",attrs:{category:e.currentCategory,name:e.currentProject,"req-base-path":e.reqBasePath},on:{"update:sessionId":e.updateTestSessionId}}):e._e(),t("SubSchemeDialog",{attrs:{visible:e.subSchemeDialogVisible,category:e.currentCategory,"parent-name":e.currentProject,"default-name":e.subSchemeDefaultName},on:{"update:visible":function(i){e.subSchemeDialogVisible=i},confirm:e.onSubSchemeConfirm,cancel:function(i){e.subSchemeDialogVisible=!1}}})],1),t("div",{staticClass:"status-bar"},[t("span",[t("i",{staticClass:"el-icon-info"}),e._v(" "+e._s(e.statusText)+" ")]),t("span",[e._v(e._s(e.projectKey||"未选择项目"))])])])],1)},ge=[],me=d(he,pe,ge,!1,null,"fa541c1b");const Ce=me.exports;export{Ce as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.workflow-sidebar[data-v-86f1727d]{width:280px;background:var(--color-sidebar);border-right:1px solid var(--color-contentBg);display:flex;flex-direction:column;flex-shrink:0}.sidebar-header[data-v-86f1727d]{padding:16px;border-bottom:1px solid var(--color-contentBg)}.sidebar-header h3[data-v-86f1727d]{font-size:14px;color:var(--color-textMuted);margin-bottom:12px}.sidebar-header .el-select[data-v-86f1727d]{width:100%;margin-bottom:8px}.project-display-row[data-v-86f1727d]{display:flex;justify-content:space-between;gap:8px;margin-bottom:8px;padding:8px 10px;background:#ffffff0a;border:1px solid var(--color-border);border-radius:6px}.project-display-row .label[data-v-86f1727d]{color:var(--color-textMuted);font-size:12px}.project-display-row .value[data-v-86f1727d]{color:var(--color-textMain);font-size:12px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.step-list[data-v-86f1727d]{flex:1;overflow-y:auto;padding:16px}.step-item[data-v-86f1727d]{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-86f1727d]:hover{background:#ffffff0d}.step-item.active[data-v-86f1727d]{background:#409eff26;border-color:var(--color-accent)}.step-item.completed .step-icon[data-v-86f1727d]{background:#22c55e}.step-item.active .step-icon[data-v-86f1727d]{background:var(--color-accent)}.step-icon[data-v-86f1727d]{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-86f1727d]{flex:1}.step-title[data-v-86f1727d]{font-size:14px;font-weight:500;margin-bottom:2px;color:#f4f4f5}.step-desc[data-v-86f1727d]{font-size:12px;color:var(--color-textMuted)}.step-status[data-v-86f1727d]{font-size:14px}.step1-container[data-v-1cbab0a8]{height:100%;padding:80px 24px 24px;overflow:hidden}.step1-main[data-v-1cbab0a8]{max-width:600px;margin:0 auto}.panel-section[data-v-1cbab0a8]{background:var(--color-panelHeader);border:1px solid var(--color-contentBg);border-radius:8px;overflow:hidden}.panel-section-header[data-v-1cbab0a8]{background:var(--color-panelHeader);border-bottom:1px solid var(--color-contentBg);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-1cbab0a8]{padding:4px 8px;font-size:12px}.panel-section-body[data-v-1cbab0a8]{padding:24px}.form-hint[data-v-1cbab0a8]{font-size:12px;color:var(--color-textMuted);margin-top:8px}.form-hint code[data-v-1cbab0a8]{background:var(--color-inputBg);padding:2px 6px;border-radius:4px;font-family:ui-monospace,monospace;color:var(--color-accent)}.flex[data-v-1cbab0a8]{display:flex}.gap-2[data-v-1cbab0a8]{gap:8px}.discuss-container[data-v-ae48df15]{flex:1;display:flex;flex-direction:column;overflow:hidden;min-height:0}.discuss-dropdown[data-v-ae48df15]{position:relative;flex-shrink:0;border-bottom:1px solid var(--color-contentBg)}.dropdown-trigger[data-v-ae48df15]{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;cursor:pointer;color:var(--color-textMain);font-size:13px}.dropdown-trigger[data-v-ae48df15]:hover{background:var(--color-contentBg)}.dropdown-title[data-v-ae48df15]{font-weight:500}.dropdown-trigger .el-icon-arrow-down[data-v-ae48df15]{transition:transform .2s;font-size:12px;color:var(--color-textMuted)}.dropdown-trigger .el-icon-arrow-down.rotated[data-v-ae48df15]{transform:rotate(180deg)}.dropdown-menu[data-v-ae48df15]{position:absolute;top:100%;left:0;right:0;background:var(--color-contentBg);border:1px solid var(--color-contentBg);border-top:none;z-index:100;max-height:240px;overflow-y:auto}.dropdown-item[data-v-ae48df15]{display:flex;align-items:center;justify-content:space-between;padding:8px 16px;cursor:pointer;color:var(--color-textMain);font-size:13px}.dropdown-item[data-v-ae48df15]:hover{background:var(--color-hoverBg)}.dropdown-item.active[data-v-ae48df15]{background:var(--color-active)}.dropdown-item.add-item[data-v-ae48df15]{border-top:1px solid var(--color-contentBg);color:var(--color-accent);justify-content:flex-start;gap:6px}.item-title[data-v-ae48df15]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.item-actions[data-v-ae48df15]{flex-shrink:0;margin-left:8px;position:relative}.menu-trigger[data-v-ae48df15]{cursor:pointer;color:var(--color-textMuted);padding:2px 6px;border-radius:4px}.menu-trigger[data-v-ae48df15]:hover{background:var(--color-hoverBg);color:var(--color-textMain)}.menu-actions[data-v-ae48df15]{display:flex;flex-direction:column;min-width:80px}.menu-popup[data-v-ae48df15]{position:absolute;right:0;top:100%;background:var(--color-contentBg);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 12px #0006;z-index:200;min-width:100px;overflow:hidden}.menu-item[data-v-ae48df15]{padding:6px 12px;cursor:pointer;font-size:13px;color:var(--color-textMain)}.menu-item[data-v-ae48df15]:hover{background:var(--color-hoverBg)}.menu-item.danger[data-v-ae48df15]{color:#ef4444}.empty-discuss[data-v-ae48df15]{flex:1;display:flex;align-items:center;justify-content:center}.empty-card[data-v-ae48df15]{display:flex;flex-direction:column;align-items:center;gap:12px;padding:32px 48px;border:2px dashed var(--color-border);border-radius:12px;cursor:pointer;transition:all .2s}.empty-card[data-v-ae48df15]:hover{border-color:var(--color-accent);background:#60a5fa0d}.empty-card i[data-v-ae48df15]{font-size:36px;color:var(--color-accent)}.empty-card p[data-v-ae48df15]{font-size:16px;color:var(--color-textMain);margin:0}.empty-card span[data-v-ae48df15]{font-size:13px;color:var(--color-textMuted)}.chat-messages[data-v-ae48df15]{flex:1;overflow-y:auto;padding:0 16px 16px;font-size:14px;line-height:1.6}.chat-messages[data-v-ae48df15]::-webkit-scrollbar{width:4px}.chat-messages[data-v-ae48df15]::-webkit-scrollbar-track{background:transparent}.chat-messages[data-v-ae48df15]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:2px}.chat-messages[data-v-ae48df15]::-webkit-scrollbar-thumb:hover{background:var(--color-textMuted)}.empty-state[data-v-ae48df15]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--color-textMuted)}.empty-state i[data-v-ae48df15]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-ae48df15]{margin-bottom:16px;color:var(--color-textMain)}.todo-item[data-v-ae48df15]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-ae48df15]{color:var(--color-accent);font-weight:700;border:1px solid var(--color-accent);padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-ae48df15]{color:var(--color-textMain);margin-bottom:16px}.log-mute[data-v-ae48df15]{color:var(--color-textMuted);margin-bottom:16px;white-space:pre}.tool-success[data-v-ae48df15]{color:#22c55e}.tool-fail[data-v-ae48df15]{color:#ef4444}.tool-input[data-v-ae48df15]{color:var(--color-accent);margin-left:8px}.build-info[data-v-ae48df15]{color:var(--color-textMuted);display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-ae48df15]{padding:12px 16px;background:var(--color-panelHeader);border-top:1px solid var(--color-contentBg);flex-shrink:0}.input-panel[data-v-ae48df15]{background:var(--color-panel);border-radius:6px;border:1px solid var(--color-border);overflow:hidden}.input-wrapper[data-v-ae48df15]{position:relative}.input-area[data-v-ae48df15]{flex:1}.input-area[data-v-ae48df15] .el-textarea__inner{border:none;border-radius:0;background:var(--color-panel);color:var(--color-textMain);resize:none}.input-area[data-v-ae48df15] .el-textarea__inner:focus{box-shadow:none}.input-panel .input-actions[data-v-ae48df15]{display:flex;justify-content:flex-end;align-items:center;padding:6px 12px;gap:6px;background:var(--color-panel)}.input-panel .status-action[data-v-ae48df15]{cursor:pointer;font-size:12px;color:var(--color-textMuted)}.input-panel .status-action[data-v-ae48df15]:hover{color:var(--color-accent)}.input-panel .separator[data-v-ae48df15]{color:var(--color-border);font-size:12px}.status-bar[data-v-ae48df15]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:var(--color-textMuted);border-top:1px solid var(--color-contentBg);flex-shrink:0;flex-wrap:wrap;background:var(--color-panel)}.status-bar .separator[data-v-ae48df15]{color:var(--color-border)}.status-ready[data-v-ae48df15]{color:#22c55e}.status-thinking[data-v-ae48df15]{color:var(--color-accent)}.thinking-spinner[data-v-ae48df15]{display:inline-block;width:12px;height:12px;border:2px solid var(--color-accent);border-top-color:transparent;border-radius:50%;animation:spin-ae48df15 .8s linear infinite}@keyframes spin-ae48df15{to{transform:rotate(360deg)}}.model-selector[data-v-ae48df15]{cursor:pointer}.model-selector[data-v-ae48df15]:hover{color:var(--color-accent)}.status-action[data-v-ae48df15]{cursor:pointer}.status-action[data-v-ae48df15]:hover{color:var(--color-accent)}.flex[data-v-ae48df15]{display:flex}.justify-end[data-v-ae48df15]{justify-content:flex-end}.chat-images[data-v-ae48df15]{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.chat-image-thumb[data-v-ae48df15]{width:120px;height:120px;-o-object-fit:cover;object-fit:cover;border-radius:6px;border:1px solid var(--color-border);cursor:zoom-in;transition:border-color .2s}.chat-image-thumb[data-v-ae48df15]:hover{border-color:var(--color-accent)}.image-lightbox[data-v-ae48df15]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#000000e6;display:flex;align-items:center;justify-content:center;cursor:zoom-out}.lightbox-close[data-v-ae48df15]{position:absolute;top:20px;right:30px;color:#fff;font-size:40px;cursor:pointer;z-index:1}.lightbox-image[data-v-ae48df15]{max-width:90vw;max-height:90vh;-o-object-fit:contain;object-fit:contain;cursor:default}.upload-btn[data-v-ae48df15]{height:auto}.step2-container[data-v-41db44ff]{height:100%;display:flex;flex-direction:column}.step2-main[data-v-41db44ff]{display:flex;flex:1;gap:5px;overflow:hidden;padding:16px}.editor-panel[data-v-41db44ff]{flex:1;min-width:300px;background:var(--color-panelHeader);border:1px solid var(--color-contentBg);border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.editor-header[data-v-41db44ff]{background:var(--color-panelHeader);border-bottom:1px solid var(--color-contentBg);padding:12px 16px;font-size:13px;color:var(--color-textMuted);display:flex;align-items:center;justify-content:space-between}.editor-title[data-v-41db44ff]{display:flex;align-items:center;gap:8px}.editor-actions[data-v-41db44ff]{display:flex;gap:4px;align-items:center}.editor-actions .el-button--text[data-v-41db44ff]{color:var(--color-textMuted);padding:2px 6px;font-size:16px}.editor-actions .el-button--text[data-v-41db44ff]:hover{color:var(--color-accent)}.editor-container[data-v-41db44ff]{flex:1;min-height:0}.chat-panel[data-v-41db44ff]{background:var(--color-panelHeader);border:1px solid var(--color-contentBg);border-radius:8px;overflow:hidden;display:flex;flex-direction:column;flex-shrink:0}.resize-handle[data-v-41db44ff]{width:4px;cursor:col-resize;background:transparent;flex-shrink:0;transition:background .15s}.resize-handle[data-v-41db44ff]:hover{background:var(--color-accent)}.panel-header[data-v-41db44ff]{background:var(--color-panelHeader);border-bottom:1px solid var(--color-contentBg);padding:12px 16px;font-size:14px;font-weight:500;color:var(--color-textMain);flex-shrink:0}.panel-tabs[data-v-41db44ff]{display:flex;gap:0;padding:0}.panel-tab[data-v-41db44ff]{flex:1;text-align:center;padding:10px 16px;cursor:pointer;color:var(--color-textMuted);font-size:13px;border-bottom:2px solid transparent;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.panel-tab[data-v-41db44ff]:hover{color:var(--color-textMain)}.panel-tab.active[data-v-41db44ff]{color:var(--color-accent);border-bottom-color:var(--color-accent)}.chat-messages[data-v-41db44ff]{flex:1;overflow-y:auto;padding:0 16px 16px;font-size:14px;line-height:1.6}.chat-messages[data-v-41db44ff]::-webkit-scrollbar{width:4px}.chat-messages[data-v-41db44ff]::-webkit-scrollbar-track{background:transparent}.chat-messages[data-v-41db44ff]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:2px}.chat-messages[data-v-41db44ff]::-webkit-scrollbar-thumb:hover{background:var(--color-textMuted)}.empty-state[data-v-41db44ff]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--color-textMuted)}.empty-state i[data-v-41db44ff]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-41db44ff]{margin-bottom:16px;color:var(--color-textMain)}.todo-item[data-v-41db44ff]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-41db44ff]{color:var(--color-accent);font-weight:700;border:1px solid var(--color-accent);padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-41db44ff]{color:var(--color-textMain);margin-bottom:16px}.log-mute[data-v-41db44ff]{color:var(--color-textMuted);margin-bottom:16px;white-space:pre}.tool-success[data-v-41db44ff]{color:#22c55e}.tool-fail[data-v-41db44ff]{color:#ef4444}.tool-input[data-v-41db44ff]{color:var(--color-accent);margin-left:8px}.build-info[data-v-41db44ff]{color:var(--color-textMuted);display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-41db44ff]{padding:12px 16px;background:var(--color-panelHeader);border-top:1px solid var(--color-contentBg)}.input-panel[data-v-41db44ff]{background:var(--color-panel);border-radius:6px;border:1px solid var(--color-border);overflow:hidden}.input-wrapper[data-v-41db44ff]{position:relative}.input-area[data-v-41db44ff]{flex:1}.input-area[data-v-41db44ff] .el-textarea__inner{border:none;border-radius:0;background:var(--color-panel);color:var(--color-textMain);resize:none}.input-area[data-v-41db44ff] .el-textarea__inner:focus{box-shadow:none}.input-panel .input-actions[data-v-41db44ff]{display:flex;justify-content:space-between;align-items:center;padding:6px 12px;gap:6px;background:var(--color-panel)}.input-actions-left[data-v-41db44ff],.input-actions-right[data-v-41db44ff]{display:flex;align-items:center;gap:6px}.input-panel .status-action[data-v-41db44ff]{cursor:pointer;font-size:12px;color:var(--color-textMuted)}.input-panel .status-action[data-v-41db44ff]:hover{color:var(--color-accent)}.input-panel .separator[data-v-41db44ff]{color:var(--color-border);font-size:12px}.status-bar[data-v-41db44ff]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:var(--color-textMuted);border-top:1px solid var(--color-contentBg);flex-shrink:0;flex-wrap:wrap;background:var(--color-panel)}.status-bar .separator[data-v-41db44ff]{color:var(--color-border)}.status-ready[data-v-41db44ff]{color:#22c55e}.status-thinking[data-v-41db44ff]{color:var(--color-accent)}.thinking-spinner[data-v-41db44ff]{display:inline-block;width:12px;height:12px;border:2px solid var(--color-accent);border-top-color:transparent;border-radius:50%;animation:spin-41db44ff .8s linear infinite}@keyframes spin-41db44ff{to{transform:rotate(360deg)}}.model-selector[data-v-41db44ff]{cursor:pointer}.model-selector[data-v-41db44ff]:hover{color:var(--color-accent)}.status-action[data-v-41db44ff]{cursor:pointer}.status-action[data-v-41db44ff]:hover{color:var(--color-accent)}.chat-images[data-v-41db44ff]{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.chat-image-thumb[data-v-41db44ff]{width:120px;height:120px;-o-object-fit:cover;object-fit:cover;border-radius:6px;border:1px solid var(--color-border);cursor:zoom-in;transition:border-color .2s}.chat-image-thumb[data-v-41db44ff]:hover{border-color:var(--color-accent)}.image-lightbox[data-v-41db44ff]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#000000e6;display:flex;align-items:center;justify-content:center;cursor:zoom-out}.lightbox-close[data-v-41db44ff]{position:absolute;top:20px;right:30px;color:#fff;font-size:40px;cursor:pointer;z-index:1}.lightbox-image[data-v-41db44ff]{max-width:90vw;max-height:90vh;-o-object-fit:contain;object-fit:contain;cursor:default}.upload-btn[data-v-41db44ff]{height:auto}.step3-container[data-v-def50e8d]{height:100%;display:flex;flex-direction:column}.step3-main[data-v-def50e8d]{display:flex;flex:1;gap:5px;overflow:hidden;padding:16px}.code-chat-panel[data-v-def50e8d]{flex:1;background:var(--color-panelHeader);border:1px solid var(--color-border);border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.panel-header[data-v-def50e8d]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--color-panelHeader);border-bottom:1px solid var(--color-border);flex-shrink:0}.panel-header span[data-v-def50e8d]{font-size:14px;font-weight:500;color:var(--color-textMain)}.header-actions[data-v-def50e8d]{display:flex;gap:8px}.chat-messages[data-v-def50e8d]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6}.chat-messages[data-v-def50e8d]::-webkit-scrollbar{width:4px}.chat-messages[data-v-def50e8d]::-webkit-scrollbar-track{background:transparent}.chat-messages[data-v-def50e8d]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:2px}.chat-messages[data-v-def50e8d]::-webkit-scrollbar-thumb:hover{background:var(--color-textMuted)}.empty-state[data-v-def50e8d]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--color-textMuted)}.empty-state i[data-v-def50e8d]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-def50e8d]{margin-bottom:16px;color:var(--color-textMain)}.todo-item[data-v-def50e8d]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-def50e8d]{color:var(--color-accent);font-weight:700;border:1px solid var(--color-accent);padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-def50e8d]{color:var(--color-textMain);margin-bottom:16px}.log-mute[data-v-def50e8d]{color:var(--color-textMuted);margin-bottom:16px;white-space:pre}.tool-success[data-v-def50e8d]{color:#22c55e}.tool-fail[data-v-def50e8d]{color:#ef4444}.tool-input[data-v-def50e8d]{color:var(--color-accent);margin-left:8px}.build-info[data-v-def50e8d]{color:var(--color-textMuted);display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-def50e8d]{padding:12px 16px;background:var(--color-panelHeader);border-top:1px solid var(--color-border)}.input-wrapper[data-v-def50e8d]{position:relative;flex:1}.input-area[data-v-def50e8d]{flex:1}.input-wrapper .input-actions[data-v-def50e8d]{position:absolute;right:8px;bottom:8px;display:flex;gap:6px;z-index:5}.input-wrapper[data-v-def50e8d] .el-textarea__inner{padding-bottom:50px}.status-bar[data-v-def50e8d]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:var(--color-textMuted);border-top:1px solid var(--color-border);flex-shrink:0;flex-wrap:wrap;background:var(--color-panel)}.status-bar .separator[data-v-def50e8d]{color:var(--color-border)}.status-ready[data-v-def50e8d]{color:#22c55e}.status-thinking[data-v-def50e8d]{color:var(--color-accent)}.thinking-spinner[data-v-def50e8d]{display:inline-block;width:12px;height:12px;border:2px solid var(--color-accent);border-top-color:transparent;border-radius:50%;animation:spin-def50e8d .8s linear infinite}@keyframes spin-def50e8d{to{transform:rotate(360deg)}}.model-selector[data-v-def50e8d]{cursor:pointer}.model-selector[data-v-def50e8d]:hover{color:var(--color-accent)}.devlog-panel[data-v-def50e8d]{background:var(--color-panelHeader);border:1px solid var(--color-border);border-radius:8px;overflow:hidden;display:flex;flex-direction:column;flex-shrink:0}.resize-handle[data-v-def50e8d]{width:4px;cursor:col-resize;background:transparent;flex-shrink:0;transition:background .15s}.resize-handle[data-v-def50e8d]:hover{background:var(--color-accent)}.devlog-panel .panel-header[data-v-def50e8d]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--color-panelHeader);border-bottom:1px solid var(--color-border)}.devlog-panel .panel-header span[data-v-def50e8d]{font-size:14px;font-weight:500;color:var(--color-textMain)}.devlog-content[data-v-def50e8d]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6;color:var(--color-textMain)}.devlog-content[data-v-def50e8d]::-webkit-scrollbar{width:4px}.devlog-content[data-v-def50e8d]::-webkit-scrollbar-track{background:transparent}.devlog-content[data-v-def50e8d]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:2px}.devlog-content[data-v-def50e8d]::-webkit-scrollbar-thumb:hover{background:var(--color-textMuted)}.chat-images[data-v-def50e8d]{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.chat-image-thumb[data-v-def50e8d]{width:120px;height:120px;-o-object-fit:cover;object-fit:cover;border-radius:6px;border:1px solid var(--color-border);cursor:zoom-in;transition:border-color .2s}.chat-image-thumb[data-v-def50e8d]:hover{border-color:var(--color-accent)}.image-lightbox[data-v-def50e8d]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#000000e6;display:flex;align-items:center;justify-content:center;cursor:zoom-out}.lightbox-close[data-v-def50e8d]{position:absolute;top:20px;right:30px;color:#fff;font-size:40px;cursor:pointer;z-index:1}.lightbox-image[data-v-def50e8d]{max-width:90vw;max-height:90vh;-o-object-fit:contain;object-fit:contain;cursor:default}.upload-btn[data-v-def50e8d]{height:auto}.step4-container[data-v-75f7cf43]{height:100%;display:flex;flex-direction:column}.step4-main[data-v-75f7cf43]{display:flex;flex:1;overflow:hidden;padding:16px}.code-chat-panel[data-v-75f7cf43]{flex:1;background:var(--color-panelHeader);border:1px solid var(--color-border);border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.panel-header[data-v-75f7cf43]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--color-panelHeader);border-bottom:1px solid var(--color-border);flex-shrink:0}.panel-header span[data-v-75f7cf43]{font-size:14px;font-weight:500;color:var(--color-textMain)}.chat-messages[data-v-75f7cf43]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6}.empty-state[data-v-75f7cf43]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--color-textMuted)}.empty-state i[data-v-75f7cf43]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-75f7cf43]{margin-bottom:16px;color:var(--color-textMain)}.todo-item[data-v-75f7cf43]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-75f7cf43]{color:var(--color-accent);font-weight:700;border:1px solid var(--color-accent);padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-75f7cf43]{color:var(--color-textMain);margin-bottom:16px}.log-mute[data-v-75f7cf43]{color:var(--color-textMuted);margin-bottom:16px;white-space:pre}.tool-success[data-v-75f7cf43]{color:#22c55e}.tool-fail[data-v-75f7cf43]{color:#ef4444}.tool-input[data-v-75f7cf43]{color:var(--color-accent);margin-left:8px}.build-info[data-v-75f7cf43]{color:var(--color-textMuted);display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-75f7cf43]{padding:12px 16px;background:var(--color-panelHeader);border-top:1px solid var(--color-border)}.input-wrapper[data-v-75f7cf43]{position:relative;flex:1}.input-area[data-v-75f7cf43]{flex:1}.input-wrapper .input-actions[data-v-75f7cf43]{position:absolute;right:8px;bottom:8px;display:flex;gap:6px;z-index:5}.input-wrapper[data-v-75f7cf43] .el-textarea__inner{padding-bottom:50px}.status-bar[data-v-75f7cf43]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:var(--color-textMuted);border-top:1px solid var(--color-border);flex-shrink:0;flex-wrap:wrap;background:var(--color-panel)}.status-bar .separator[data-v-75f7cf43]{color:var(--color-border)}.status-ready[data-v-75f7cf43]{color:#22c55e}.status-thinking[data-v-75f7cf43]{color:var(--color-accent)}.thinking-spinner[data-v-75f7cf43]{display:inline-block;width:12px;height:12px;border:2px solid var(--color-accent);border-top-color:transparent;border-radius:50%;animation:spin-75f7cf43 .8s linear infinite}@keyframes spin-75f7cf43{to{transform:rotate(360deg)}}.model-selector[data-v-75f7cf43]{cursor:pointer}.model-selector[data-v-75f7cf43]:hover{color:var(--color-accent)}.chat-images[data-v-75f7cf43]{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.chat-image-thumb[data-v-75f7cf43]{width:120px;height:120px;-o-object-fit:cover;object-fit:cover;border-radius:6px;border:1px solid var(--color-border);cursor:zoom-in;transition:border-color .2s}.chat-image-thumb[data-v-75f7cf43]:hover{border-color:var(--color-accent)}.image-lightbox[data-v-75f7cf43]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#000000e6;display:flex;align-items:center;justify-content:center;cursor:zoom-out}.lightbox-close[data-v-75f7cf43]{position:absolute;top:20px;right:30px;color:#fff;font-size:40px;cursor:pointer;z-index:1}.lightbox-image[data-v-75f7cf43]{max-width:90vw;max-height:90vh;-o-object-fit:contain;object-fit:contain;cursor:default}.upload-btn[data-v-75f7cf43]{height:auto}.dev-workflow-view[data-v-fa541c1b]{display:flex;height:100%;overflow:hidden;background:var(--color-panel)}.main-content[data-v-fa541c1b]{flex:1;display:flex;flex-direction:column;overflow:hidden}.step-content[data-v-fa541c1b]{flex:1;overflow:hidden}.status-bar[data-v-fa541c1b]{background:var(--color-panelHeader);border-top:1px solid var(--color-contentBg);padding:8px 24px;font-size:12px;color:var(--color-textMuted);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as p,h as g,g as m,w as h,i as v,a as o}from"./index-Cn73hS12.js";const w={name:"AppWorkflowStep",props:{currentStep:{type:Number,default:1}},data(){return{steps:[{id:1,label:"需求"},{id:2,label:"设计"},{id:3,label:"代码"},{id:4,label:"测试"}]}}};var y=function(){var s=this,t=s._self._c;return t("div",{staticClass:"workflow-step-bar"},s._l(s.steps,function(i){return t("div",{key:i.id,staticClass:"step-item",class:{active:s.currentStep>=i.id,current:s.currentStep===i.id},on:{click:function(r){return s.$emit("step-change",i.id)}}},[t("div",{staticClass:"step-number"},[s._v(s._s(i.id))]),t("div",{staticClass:"step-label"},[s._v(s._s(i.label))])])}),0)},b=[],S=p(w,y,b,!1,null,"1cf39c0c");const $=S.exports,k={name:"AppStep1Req",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>({})},reqBasePath:{type:String,default:""},currentCategory:{type:String,default:""},currentProject:{type:String,default:""}},data(){return{selectedCategory:"",selectedProject:"",dialogVisible:!1,dialogInput:"",requirementDialogVisible:!1,requirementDialogInput:""}},computed:{requirementList(){if(!this.selectedCategory)return[];const e=`${this.selectedCategory}/`;return Object.keys(this.projects).filter(s=>s.startsWith(e)).map(s=>s.split("/")[1]).sort()}},watch:{currentCategory:{immediate:!0,handler(e){this.selectedCategory=e||""}},currentProject:{immediate:!0,handler(e){this.selectedProject=e||""}},selectedCategory(e){e||(this.selectedProject="")}},methods:{selectCategory(e){this.selectedCategory=e,this.$emit("category-change",e),this.$emit("project-change","")},selectProject(e){this.selectedProject=e,this.$emit("project-change",e)},showCreateCategoryDialog(){this.dialogInput="",this.dialogVisible=!0},handleDialogConfirm(){const e=this.dialogInput.trim();e&&(this.$emit("create-category",e),this.dialogVisible=!1)},showCreateRequirementDialog(){this.selectedCategory&&(this.requirementDialogInput="",this.requirementDialogVisible=!0)},handleCreateRequirementConfirm(){const e=this.requirementDialogInput.trim();e&&(this.requirementList.includes(e)||(this.$emit("create-requirement",{category:this.selectedCategory,name:e}),this.requirementDialogVisible=!1))}}};var P=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step1-req"},[t("div",{staticClass:"category-section"},[s._m(0),t("div",{staticClass:"category-list"},[s._l(s.categories,function(i){return t("div",{key:i,staticClass:"category-item",class:{active:s.selectedCategory===i},on:{click:function(r){return s.selectCategory(i)}}},[t("i",{staticClass:"fa-solid fa-folder"}),t("span",[s._v(s._s(i))])])}),t("div",{staticClass:"category-item add-btn",on:{click:s.showCreateCategoryDialog}},[t("i",{staticClass:"fa-solid fa-plus"}),t("span",[s._v("新建大类")])])],2)]),t("div",{staticClass:"divider"}),t("div",{staticClass:"project-section"},[t("div",{staticClass:"section-header"},[t("span",[s._v("选择需求")]),t("button",{staticClass:"btn-primary",attrs:{disabled:!s.selectedCategory},on:{click:s.showCreateRequirementDialog}},[t("i",{staticClass:"fa-solid fa-plus"}),s._v(" 新建 ")])]),t("div",{staticClass:"project-list"},[s._l(s.requirementList,function(i){return t("div",{key:i,staticClass:"project-item",on:{click:function(r){return s.selectProject(i)}}},[t("div",{staticClass:"project-info"},[t("i",{staticClass:"fa-solid fa-folder-open"}),t("span",[s._v(s._s(i))])]),t("i",{staticClass:"fa-solid fa-chevron-right"})])}),!s.requirementList.length&&s.selectedCategory?t("div",{staticClass:"empty-hint"},[s._v(" 暂无需求,请点击新建 ")]):s._e(),s.selectedCategory?s._e():t("div",{staticClass:"empty-hint"},[s._v(" 请先选择大类 ")])],2)]),s.dialogVisible?t("div",{staticClass:"dialog-overlay",on:{click:function(i){if(i.target!==i.currentTarget)return null;s.dialogVisible=!1}}},[t("div",{staticClass:"dialog"},[t("div",{staticClass:"dialog-header"},[t("span",[s._v("新建大类")]),t("button",{staticClass:"close-btn",on:{click:function(i){s.dialogVisible=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"dialog-body"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.dialogInput,expression:"dialogInput"}],attrs:{type:"text",placeholder:"输入大类名称"},domProps:{value:s.dialogInput},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")?null:s.handleDialogConfirm.apply(null,arguments)},input:function(i){i.target.composing||(s.dialogInput=i.target.value)}}})]),t("div",{staticClass:"dialog-footer"},[t("button",{staticClass:"btn-cancel",on:{click:function(i){s.dialogVisible=!1}}},[s._v("取消")]),t("button",{staticClass:"btn-confirm",on:{click:s.handleDialogConfirm}},[s._v("确定")])])])]):s._e(),s.requirementDialogVisible?t("div",{staticClass:"dialog-overlay",on:{click:function(i){if(i.target!==i.currentTarget)return null;s.requirementDialogVisible=!1}}},[t("div",{staticClass:"dialog"},[t("div",{staticClass:"dialog-header"},[t("span",[s._v("新建需求")]),t("button",{staticClass:"close-btn",on:{click:function(i){s.requirementDialogVisible=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"dialog-body"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.requirementDialogInput,expression:"requirementDialogInput"}],attrs:{type:"text",placeholder:"输入需求名称"},domProps:{value:s.requirementDialogInput},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")?null:s.handleCreateRequirementConfirm.apply(null,arguments)},input:function(i){i.target.composing||(s.requirementDialogInput=i.target.value)}}})]),t("div",{staticClass:"dialog-footer"},[t("button",{staticClass:"btn-cancel",on:{click:function(i){s.requirementDialogVisible=!1}}},[s._v("取消")]),t("button",{staticClass:"btn-confirm",on:{click:s.handleCreateRequirementConfirm}},[s._v("确定")])])])]):s._e()])},D=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"section-header"},[s("span",[e._v("选择大类")])])}],I=p(k,P,D,!1,null,"ff2d2605");const M=I.exports,q={name:"AppStep2Design",components:{FileSelectDrawer:g},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{mode:"chat",specView:"edit",specContent:"",inputMessage:"",isProcessing:!1,stopping:!1,logItems:[],sessionId:"",modelName:"",promptTokens:0,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,models:[],logSeq:0,wsUnsubscribe:null,parentInfo:null}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`},renderedContent(){return m(this.specContent||"")}},watch:{category:{handler(){this.loadData()}},name:{handler(){this.loadData()}},reqBasePath:{handler(e){e&&this.loadData()}}},async mounted(){h.init(),await this.loadModels(),await this.loadDefaultModel(),await this.loadData()},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{async loadData(){this.reqBasePath&&await Promise.all([this.loadSpec(),this.loadSession()])},async loadSpec(){var e;if(!this.category||!this.name){this.specContent="";return}try{const s=await o.getFileContent(this.specFilePath);this.specContent=((e=s.data)==null?void 0:e.content)||""}catch{this.specContent=""}},async loadSession(){var e;if(!this.category||!this.name){this.sessionId="",this.parentInfo=null;return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,t=await o.getFileContent(s);if(t&&((e=t.data)!=null&&e.content)){const i=JSON.parse(t.data.content);this.sessionId=i.designSessionId||"",this.parentInfo=i.parent||null}else this.sessionId="",this.parentInfo=null;this.sessionId&&(await this.loadMessages(),this.subscribeSession())}catch{this.sessionId="",this.parentInfo=null}},async saveSpec(){if(this.specFilePath)try{await o.writeFile(this.specFilePath,this.specContent),this.$emit("save-spec",this.specContent),this.$emit("spec-updated"),this.$message.success("方案已保存")}catch{this.$message.error("保存失败")}},async loadModels(){try{const e=await o.getModels();this.models=e.data||[]}catch(e){console.error("Load models failed:",e)}},async loadDefaultModel(){var e;try{const s=await o.getConfig("defaultModel");(e=s.data)!=null&&e.value&&(this.modelName=s.data.value)}catch{this.modelName="gpt-4o"}},selectModel(e){const s=e.name.split("/");this.modelName=s.length>2?s.slice(1).join("/"):e.name,o.setConfig("defaultModel",this.modelName),this.showModelDrawer=!1},async loadMessages(){if(this.sessionId)try{const e=await v(this.sessionId);this.logItems=(e.data||[]).map(s=>s.type==="think"?{type:"think",content:s.content||"",_id:`log-${++this.logSeq}`}:s.type==="step"?{type:"step",thought:s.thought,toolCalls:s.toolCalls||[],success:s.success,_id:`log-${++this.logSeq}`}:s.type==="chat"?{type:"chat",content:s.content,_id:`log-${++this.logSeq}`}:s.type==="todos"?{type:"todos",todos:s.todos||[],_id:`log-${++this.logSeq}`}:{type:"system",content:String(s),_id:`log-${++this.logSeq}`}),this.scrollToBottom()}catch(e){console.error("Load messages failed:",e)}},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=h.subscribe(this.sessionId,{running_sessions:e=>{const s=(e==null?void 0:e.runningSessionIds)||[];this.isProcessing=s.includes(this.sessionId)},todos:e=>{this.logItems.push({type:"todos",todos:e.todos,_id:`log-${++this.logSeq}`}),this.scrollToBottom()},step:e=>{var s;this.logItems.push({type:"step",thought:e==null?void 0:e.thought,toolCalls:(e==null?void 0:e.toolCalls)||[],success:e==null?void 0:e.success,_id:`log-${++this.logSeq}`}),(s=e==null?void 0:e.usage)!=null&&s.promptTokens&&(this.promptTokens=e.usage.promptTokens),this.scrollToBottom()},compact:e=>{this.logItems.push({type:"system",content:`【压缩完成】${e.summary||""}`,_id:`log-${++this.logSeq}`}),this.loadMessages()},done:e=>{var s;this.isProcessing=!1,this.stopping=!1,e!=null&&e.modelName&&(this.modelName=e.modelName),(s=e==null?void 0:e.usage)!=null&&s.promptTokens&&(this.promptTokens=e.usage.promptTokens),e!=null&&e.response&&this.logItems.push({type:"think",content:e.response,_id:`log-${++this.logSeq}`}),this.$emit("spec-updated"),this.loadSpec(),this.scrollToBottom()},stopped:()=>{this.isProcessing=!1,this.stopping=!1,this.logItems.push({type:"think",content:"【已停止】",_id:`log-${++this.logSeq}`}),this.scrollToBottom()},error:e=>{this.isProcessing=!1,this.stopping=!1,this.$message.error((e==null?void 0:e.error)||"发生错误")}}))},async sendMessage(){const e=this.inputMessage.trim();if(!e||this.isProcessing||!this.sessionId)return;this.wsUnsubscribe||this.subscribeSession();let s="";this.logItems.length===0&&this.parentInfo&&(s=`
|
|
1
|
+
import{n as p,i as g,g as m,w as h,j as v,a as o}from"./index-CUBJZpK-.js";const w={name:"AppWorkflowStep",props:{currentStep:{type:Number,default:1}},data(){return{steps:[{id:1,label:"需求"},{id:2,label:"设计"},{id:3,label:"代码"},{id:4,label:"测试"}]}}};var y=function(){var s=this,t=s._self._c;return t("div",{staticClass:"workflow-step-bar"},s._l(s.steps,function(i){return t("div",{key:i.id,staticClass:"step-item",class:{active:s.currentStep>=i.id,current:s.currentStep===i.id},on:{click:function(r){return s.$emit("step-change",i.id)}}},[t("div",{staticClass:"step-number"},[s._v(s._s(i.id))]),t("div",{staticClass:"step-label"},[s._v(s._s(i.label))])])}),0)},b=[],S=p(w,y,b,!1,null,"1cf39c0c");const $=S.exports,k={name:"AppStep1Req",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>({})},reqBasePath:{type:String,default:""},currentCategory:{type:String,default:""},currentProject:{type:String,default:""}},data(){return{selectedCategory:"",selectedProject:"",dialogVisible:!1,dialogInput:"",requirementDialogVisible:!1,requirementDialogInput:""}},computed:{requirementList(){if(!this.selectedCategory)return[];const e=`${this.selectedCategory}/`;return Object.keys(this.projects).filter(s=>s.startsWith(e)).map(s=>s.split("/")[1]).sort()}},watch:{currentCategory:{immediate:!0,handler(e){this.selectedCategory=e||""}},currentProject:{immediate:!0,handler(e){this.selectedProject=e||""}},selectedCategory(e){e||(this.selectedProject="")}},methods:{selectCategory(e){this.selectedCategory=e,this.$emit("category-change",e),this.$emit("project-change","")},selectProject(e){this.selectedProject=e,this.$emit("project-change",e)},showCreateCategoryDialog(){this.dialogInput="",this.dialogVisible=!0},handleDialogConfirm(){const e=this.dialogInput.trim();e&&(this.$emit("create-category",e),this.dialogVisible=!1)},showCreateRequirementDialog(){this.selectedCategory&&(this.requirementDialogInput="",this.requirementDialogVisible=!0)},handleCreateRequirementConfirm(){const e=this.requirementDialogInput.trim();e&&(this.requirementList.includes(e)||(this.$emit("create-requirement",{category:this.selectedCategory,name:e}),this.requirementDialogVisible=!1))}}};var P=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step1-req"},[t("div",{staticClass:"category-section"},[s._m(0),t("div",{staticClass:"category-list"},[s._l(s.categories,function(i){return t("div",{key:i,staticClass:"category-item",class:{active:s.selectedCategory===i},on:{click:function(r){return s.selectCategory(i)}}},[t("i",{staticClass:"fa-solid fa-folder"}),t("span",[s._v(s._s(i))])])}),t("div",{staticClass:"category-item add-btn",on:{click:s.showCreateCategoryDialog}},[t("i",{staticClass:"fa-solid fa-plus"}),t("span",[s._v("新建大类")])])],2)]),t("div",{staticClass:"divider"}),t("div",{staticClass:"project-section"},[t("div",{staticClass:"section-header"},[t("span",[s._v("选择需求")]),t("button",{staticClass:"btn-primary",attrs:{disabled:!s.selectedCategory},on:{click:s.showCreateRequirementDialog}},[t("i",{staticClass:"fa-solid fa-plus"}),s._v(" 新建 ")])]),t("div",{staticClass:"project-list"},[s._l(s.requirementList,function(i){return t("div",{key:i,staticClass:"project-item",on:{click:function(r){return s.selectProject(i)}}},[t("div",{staticClass:"project-info"},[t("i",{staticClass:"fa-solid fa-folder-open"}),t("span",[s._v(s._s(i))])]),t("i",{staticClass:"fa-solid fa-chevron-right"})])}),!s.requirementList.length&&s.selectedCategory?t("div",{staticClass:"empty-hint"},[s._v(" 暂无需求,请点击新建 ")]):s._e(),s.selectedCategory?s._e():t("div",{staticClass:"empty-hint"},[s._v(" 请先选择大类 ")])],2)]),s.dialogVisible?t("div",{staticClass:"dialog-overlay",on:{click:function(i){if(i.target!==i.currentTarget)return null;s.dialogVisible=!1}}},[t("div",{staticClass:"dialog"},[t("div",{staticClass:"dialog-header"},[t("span",[s._v("新建大类")]),t("button",{staticClass:"close-btn",on:{click:function(i){s.dialogVisible=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"dialog-body"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.dialogInput,expression:"dialogInput"}],attrs:{type:"text",placeholder:"输入大类名称"},domProps:{value:s.dialogInput},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")?null:s.handleDialogConfirm.apply(null,arguments)},input:function(i){i.target.composing||(s.dialogInput=i.target.value)}}})]),t("div",{staticClass:"dialog-footer"},[t("button",{staticClass:"btn-cancel",on:{click:function(i){s.dialogVisible=!1}}},[s._v("取消")]),t("button",{staticClass:"btn-confirm",on:{click:s.handleDialogConfirm}},[s._v("确定")])])])]):s._e(),s.requirementDialogVisible?t("div",{staticClass:"dialog-overlay",on:{click:function(i){if(i.target!==i.currentTarget)return null;s.requirementDialogVisible=!1}}},[t("div",{staticClass:"dialog"},[t("div",{staticClass:"dialog-header"},[t("span",[s._v("新建需求")]),t("button",{staticClass:"close-btn",on:{click:function(i){s.requirementDialogVisible=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"dialog-body"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.requirementDialogInput,expression:"requirementDialogInput"}],attrs:{type:"text",placeholder:"输入需求名称"},domProps:{value:s.requirementDialogInput},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")?null:s.handleCreateRequirementConfirm.apply(null,arguments)},input:function(i){i.target.composing||(s.requirementDialogInput=i.target.value)}}})]),t("div",{staticClass:"dialog-footer"},[t("button",{staticClass:"btn-cancel",on:{click:function(i){s.requirementDialogVisible=!1}}},[s._v("取消")]),t("button",{staticClass:"btn-confirm",on:{click:s.handleCreateRequirementConfirm}},[s._v("确定")])])])]):s._e()])},D=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"section-header"},[s("span",[e._v("选择大类")])])}],I=p(k,P,D,!1,null,"ff2d2605");const M=I.exports,q={name:"AppStep2Design",components:{FileSelectDrawer:g},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{mode:"chat",specView:"edit",specContent:"",inputMessage:"",isProcessing:!1,stopping:!1,logItems:[],sessionId:"",modelName:"",promptTokens:0,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,models:[],logSeq:0,wsUnsubscribe:null,parentInfo:null}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}/${this.category}/${this.name}/${this.name}_方案.md`},renderedContent(){return m(this.specContent||"")}},watch:{category:{handler(){this.loadData()}},name:{handler(){this.loadData()}},reqBasePath:{handler(e){e&&this.loadData()}}},async mounted(){h.init(),await this.loadModels(),await this.loadDefaultModel(),await this.loadData()},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{async loadData(){this.reqBasePath&&await Promise.all([this.loadSpec(),this.loadSession()])},async loadSpec(){var e;if(!this.category||!this.name){this.specContent="";return}try{const s=await o.getFileContent(this.specFilePath);this.specContent=((e=s.data)==null?void 0:e.content)||""}catch{this.specContent=""}},async loadSession(){var e;if(!this.category||!this.name){this.sessionId="",this.parentInfo=null;return}try{const s=`${this.reqBasePath}/${this.category}/${this.name}/session.json`,t=await o.getFileContent(s);if(t&&((e=t.data)!=null&&e.content)){const i=JSON.parse(t.data.content);this.sessionId=i.designSessionId||"",this.parentInfo=i.parent||null}else this.sessionId="",this.parentInfo=null;this.sessionId&&(await this.loadMessages(),this.subscribeSession())}catch{this.sessionId="",this.parentInfo=null}},async saveSpec(){if(this.specFilePath)try{await o.writeFile(this.specFilePath,this.specContent),this.$emit("save-spec",this.specContent),this.$emit("spec-updated"),this.$message.success("方案已保存")}catch{this.$message.error("保存失败")}},async loadModels(){try{const e=await o.getModels();this.models=e.data||[]}catch(e){console.error("Load models failed:",e)}},async loadDefaultModel(){var e;try{const s=await o.getConfig("defaultModel");(e=s.data)!=null&&e.value&&(this.modelName=s.data.value)}catch{this.modelName="gpt-4o"}},selectModel(e){const s=e.name.split("/");this.modelName=s.length>2?s.slice(1).join("/"):e.name,o.setConfig("defaultModel",this.modelName),this.showModelDrawer=!1},async loadMessages(){if(this.sessionId)try{const e=await v(this.sessionId);this.logItems=(e.data||[]).map(s=>s.type==="think"?{type:"think",content:s.content||"",_id:`log-${++this.logSeq}`}:s.type==="step"?{type:"step",thought:s.thought,toolCalls:s.toolCalls||[],success:s.success,_id:`log-${++this.logSeq}`}:s.type==="chat"?{type:"chat",content:s.content,_id:`log-${++this.logSeq}`}:s.type==="todos"?{type:"todos",todos:s.todos||[],_id:`log-${++this.logSeq}`}:{type:"system",content:String(s),_id:`log-${++this.logSeq}`}),this.scrollToBottom()}catch(e){console.error("Load messages failed:",e)}},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=h.subscribe(this.sessionId,{running_sessions:e=>{const s=(e==null?void 0:e.runningSessionIds)||[];this.isProcessing=s.includes(this.sessionId)},todos:e=>{this.logItems.push({type:"todos",todos:e.todos,_id:`log-${++this.logSeq}`}),this.scrollToBottom()},step:e=>{var s;this.logItems.push({type:"step",thought:e==null?void 0:e.thought,toolCalls:(e==null?void 0:e.toolCalls)||[],success:e==null?void 0:e.success,_id:`log-${++this.logSeq}`}),(s=e==null?void 0:e.usage)!=null&&s.promptTokens&&(this.promptTokens=e.usage.promptTokens),this.scrollToBottom()},compact:e=>{this.logItems.push({type:"system",content:`【压缩完成】${e.summary||""}`,_id:`log-${++this.logSeq}`}),this.loadMessages()},done:e=>{var s;this.isProcessing=!1,this.stopping=!1,e!=null&&e.modelName&&(this.modelName=e.modelName),(s=e==null?void 0:e.usage)!=null&&s.promptTokens&&(this.promptTokens=e.usage.promptTokens),e!=null&&e.response&&this.logItems.push({type:"think",content:e.response,_id:`log-${++this.logSeq}`}),this.$emit("spec-updated"),this.loadSpec(),this.scrollToBottom()},stopped:()=>{this.isProcessing=!1,this.stopping=!1,this.logItems.push({type:"think",content:"【已停止】",_id:`log-${++this.logSeq}`}),this.scrollToBottom()},error:e=>{this.isProcessing=!1,this.stopping=!1,this.$message.error((e==null?void 0:e.error)||"发生错误")}}))},async sendMessage(){const e=this.inputMessage.trim();if(!e||this.isProcessing||!this.sessionId)return;this.wsUnsubscribe||this.subscribeSession();let s="";this.logItems.length===0&&this.parentInfo&&(s=`
|
|
2
2
|
|
|
3
3
|
注意:当前方案是「${this.parentInfo.name}」的子方案,请参考父方案内容。父方案路径:${this.parentInfo.specPath}`);const t=`先在 ${this.specFilePath} 生成方案,先不要修改代码。${s}
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as m,C,a as u}from"./index-
|
|
1
|
+
import{n as m,C,a as u}from"./index-CUBJZpK-.js";const g="/api";async function c(t,e,a=null){const i={method:t,headers:{"Content-Type":"application/json"}};a&&t!=="GET"&&(i.body=JSON.stringify(a));const o=await(await fetch(`${g}${e}`,i)).json();if(o.success===!1)throw new Error(o.error||o.message||"请求失败");return o}const h={getZihaoConfig(){return c("GET","/zihao/config")},saveZihaoConfig(t){return c("POST","/zihao/config",t)},deleteZihaoConfig(t){return c("POST","/zihao/config/delete",{id:t})},setActiveConfig(t){return c("POST","/zihao/config/active",{id:t})},connect(){return c("POST","/zihao/connect")},browse(t="/"){return c("GET",`/zihao/browse?path=${encodeURIComponent(t)}`)},viewFile(t){return c("GET",`/zihao/view?path=${encodeURIComponent(t)}`)},create(t,e,a){return c("POST","/zihao/create",{name:t,path:e,type:a})},rename(t,e){return c("POST","/zihao/rename",{oldPath:t,newName:e})},deleteFile(t,e){return c("POST","/zihao/delete",{path:t,type:e})},saveContent(t,e){return c("POST","/zihao/save-content",{path:t,content:e})},getHomeDir(){return c("GET","/zihao/home-dir")},uploadChunk(t,e,a,i,l){const o=new FormData;return o.append("targetDir",t),o.append("fileName",encodeURIComponent(e)),o.append("chunkIndex",String(a)),o.append("totalChunks",String(i)),o.append("chunk",l),fetch(`${g}/zihao/chunk-upload`,{method:"POST",body:o}).then(n=>n.json()).then(n=>{if(n.success===!1)throw new Error(n.error||"上传分片失败");return n})},uploadWithProgress(t,e,a,i){const o=t,n=Math.ceil(o.size/1048576);return(async()=>{for(let r=0;r<n;r++){const f=r*1048576,x=Math.min(f+1048576,o.size),p=o.slice(f,x);await this.uploadChunk(a,e,r,n,p),i&&i(Math.round((r+1)/n*100))}return{success:!0}})()},async download(t,e,a){var s;const i=`${g}/zihao/download?path=${encodeURIComponent(t)}&localPath=${encodeURIComponent(e)}`,l=await fetch(i);if(!l.ok)throw new Error("下载失败");const o=(s=l.body)==null?void 0:s.getReader();if(!o)throw new Error("无法读取响应");const n=new TextDecoder;for(;;){const{done:r,value:f}=await o.read();if(r)break;const p=n.decode(f,{stream:!0}).split(`
|
|
2
2
|
`).filter(Boolean);for(const v of p)try{const d=JSON.parse(v);if(typeof d.progress=="number")a(d.progress);else if(d.done)a(100);else if(d.success===!1)throw new Error(d.error)}catch{}}}},b={name:"ZihaoConfigDialog",data(){return{dialogVisible:!1,editingConfig:null,loading:!1,form:{name:"",url:"",username:"",password:""},rules:{name:[{required:!0,message:"请输入配置名称",trigger:"blur"}],url:[{required:!0,message:"请输入服务地址",trigger:"blur"}],username:[{required:!0,message:"请输入用户名",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]}}},methods:{open(t=null){this.editingConfig=t,t?this.form={name:t.name||"",url:t.url||"",username:t.username||"",password:""}:this.form={name:"",url:"",username:"",password:""},this.dialogVisible=!0},handleClose(){var t;(t=this.$refs.formRef)==null||t.resetFields(),this.dialogVisible=!1,this.editingConfig=null},async handleSubmit(){var t;try{await this.$refs.formRef.validate()}catch{return}this.loading=!0;try{const e={...this.form};(t=this.editingConfig)!=null&&t.id&&(e.id=this.editingConfig.id,e.password||delete e.password),await h.saveZihaoConfig(e),this.$message.success("保存成功"),this.$emit("success"),this.handleClose()}catch(e){this.$message.error("保存失败: "+e.message)}finally{this.loading=!1}}}};var y=function(){var e=this,a=e._self._c;return a("el-dialog",{attrs:{title:e.editingConfig?"编辑梓豪配置":"新增梓豪配置",visible:e.dialogVisible,width:"500px","close-on-click-modal":!1},on:{"update:visible":function(i){e.dialogVisible=i},close:e.handleClose}},[a("el-form",{ref:"formRef",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"配置名称",prop:"name"}},[a("el-input",{attrs:{placeholder:"例如:我的梓豪服务器"},model:{value:e.form.name,callback:function(i){e.$set(e.form,"name",i)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:"服务地址",prop:"url"}},[a("el-input",{attrs:{placeholder:"例如:http://192.168.1.100:5000"},model:{value:e.form.url,callback:function(i){e.$set(e.form,"url",i)},expression:"form.url"}})],1),a("el-form-item",{attrs:{label:"用户名",prop:"username"}},[a("el-input",{attrs:{placeholder:"远程平台用户名"},model:{value:e.form.username,callback:function(i){e.$set(e.form,"username",i)},expression:"form.username"}})],1),a("el-form-item",{attrs:{label:"密码",prop:"password"}},[a("el-input",{attrs:{placeholder:"远程平台密码","show-password":""},model:{value:e.form.password,callback:function(i){e.$set(e.form,"password",i)},expression:"form.password"}})],1)],1),a("span",{attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取消")]),a("el-button",{attrs:{type:"primary",loading:e.loading},on:{click:e.handleSubmit}},[e._v("确定")])],1)],1)},w=[],_=m(b,y,w,!1,null,null);const P=_.exports,D={name:"ZihaoContextMenu",components:{CopyPathDialog:C},data(){return{visible:!1,x:0,y:0,target:null,onRename:null,onDelete:null,onDownload:null}},methods:{show(t,e,a={}){this.target=e,this.x=t.pageX,this.y=t.pageY,this.visible=!0,this.onRename=a.onRename||null,this.onDelete=a.onDelete||null,this.onDownload=a.onDownload||null},hide(){this.visible=!1},handleRename(){this.hide(),this.onRename&&this.onRename(this.target)},handleDelete(){this.hide(),this.onDelete&&this.onDelete(this.target)},handleDownload(){this.hide(),this.onDownload&&this.onDownload(this.target)},handleCopyPath(){var t;this.hide(),(t=this.target)!=null&&t.path&&this.$refs.copyPathDialog.open(this.target.path)}}};var z=function(){var i;var e=this,a=e._self._c;return a("div",[a("div",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],staticClass:"fixed bg-[#252526] border border-[#3c3c3c] rounded shadow-lg py-1 z-50 min-w-[160px]",style:{left:e.x+"px",top:e.y+"px"}},[a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-[#cccccc] hover:bg-[#094771] flex items-center gap-2",on:{click:e.handleCopyPath}},[a("i",{staticClass:"fa-solid fa-copy text-xs w-4"}),e._v(" 复制路径 ")]),a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-[#cccccc] hover:bg-[#094771] flex items-center gap-2",on:{click:e.handleRename}},[a("i",{staticClass:"fa-solid fa-pen text-xs w-4"}),e._v(" 重命名 ")]),a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-[#094771] flex items-center gap-2",on:{click:e.handleDelete}},[a("i",{staticClass:"fa-solid fa-trash text-xs w-4"}),e._v(" 删除 ")]),((i=e.target)==null?void 0:i.type)==="file"?a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-[#cccccc] hover:bg-[#094771] flex items-center gap-2",on:{click:e.handleDownload}},[a("i",{staticClass:"fa-solid fa-download text-xs w-4"}),e._v(" 下载到本地 ")]):e._e()]),a("CopyPathDialog",{ref:"copyPathDialog"})],1)},Z=[],k=m(D,z,Z,!1,null,null);const L=k.exports,$={name:"FileZihao",components:{ZihaoConfigDialog:P,ZihaoContextMenu:L},data(){return{localItems:[],localLoading:!1,localPath:"",localCurrentPath:"",localParentPath:null,selectedLocalPath:null,localDragOver:!1,dragFile:null,zihaoConfig:null,zihaoItems:[],zihaoLoading:!1,zihaoPath:"/",zihaoPathInput:"/",selectedZihaoPath:null,isDragOver:!1,localContextMenu:{visible:!1,x:0,y:0,target:null},renameDialog:{visible:!1,title:"",value:"",target:null,isZihao:!1},uploadProgress:{visible:!1,percent:0,filename:"",isDownload:!1}}},async created(){document.addEventListener("click",this.hideLocalContextMenu),await this.loadZihaoConfig(),await this.loadLocalFiles()},beforeDestroy(){document.removeEventListener("click",this.hideLocalContextMenu)},methods:{async loadLocalFiles(){this.localLoading=!0;try{const t=await u.browseFilesystem(this.localPath);let e=t.data.items||[];this.localCurrentPath=t.data.current_path||"",this.localParentPath=t.data.parent_path,this.localParentPath!==void 0&&(e=[{name:"..",is_directory:!0,path:this.localParentPath||"",size:0},...e]),this.localItems=e.sort((a,i)=>a.name===".."?-1:i.name===".."?1:a.is_directory===i.is_directory?a.name.localeCompare(i.name):a.is_directory?-1:1)}catch(t){console.error("加载本地文件失败:",t)}finally{this.localLoading=!1}},refreshLocal(){this.loadLocalFiles()},goLocalUp(){this.localParentPath!==null&&(this.localPath=this.localParentPath===""?"":this.localParentPath,this.loadLocalFiles())},goLocalHome(){this.localPath="",this.loadLocalFiles()},selectLocalItem(t){this.selectedLocalPath=t.path},openLocalItem(t){t.name===".."?(this.localPath=t.path===""?"":t.path,this.loadLocalFiles()):t.is_directory&&(this.localPath=t.path,this.loadLocalFiles())},showLocalContextMenu(t,e){this.localContextMenu={visible:!0,x:t.pageX,y:t.pageY,target:e}},hideLocalContextMenu(){this.localContextMenu.visible=!1},copyLocalPath(){this.hideLocalContextMenu(),this.localContextMenu.target&&(navigator.clipboard.writeText(this.localContextMenu.target.path).catch(()=>{}),this.$message.success("已复制路径"))},showLocalRenameDialog(){const t=this.localContextMenu.target;!t||t.name===".."||(this.renameDialog={visible:!0,title:"重命名",value:t.name,target:t,isZihao:!1},this.hideLocalContextMenu(),this.$nextTick(()=>{var e,a;(e=this.$refs.renameInput)==null||e.focus(),(a=this.$refs.renameInput)==null||a.select()}))},async deleteLocalItem(){const t=this.localContextMenu.target;if(!(!t||t.name==="..")){try{await this.$confirm(`确定要删除 "${t.name}" 吗?`,"确认删除",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}),await u.deleteFile(t.path),this.$message.success("删除成功"),this.loadLocalFiles()}catch(e){e!=="cancel"&&this.$message.error("删除失败: "+e.message)}this.hideLocalContextMenu()}},async uploadToZihao(){this.hideLocalContextMenu();const t=this.localContextMenu.target;if(!t||t.is_directory||t.name==="..")return;if(!this.zihaoConfig){this.$message.warning("请先配置梓豪平台");return}const e=t.name,a=this.zihaoPath||"/";this.uploadProgress={visible:!0,percent:0,filename:e,isDownload:!1};try{const i=await fetch(`/api/file/download_file?path=${encodeURIComponent(t.path)}`);if(!i.ok)throw new Error("读取文件失败");const l=await i.blob(),o=new File([l],e);await h.uploadWithProgress(o,e,a,n=>{this.uploadProgress.percent=n}),this.$message.success("上传成功"),this.loadZihaoFiles()}catch(i){this.$message.error("上传失败: "+i.message)}finally{this.uploadProgress.visible=!1}},handleLocalDragStart(t,e){if(e.is_directory){t.preventDefault();return}this.dragFile=e,t.dataTransfer.effectAllowed="copy"},handleLocalDragOver(t){t.preventDefault(),this.localDragOver=!0,t.dataTransfer.dropEffect="copy"},handleLocalDragLeave(){this.localDragOver=!1},async handleLocalDrop(t){t.preventDefault(),this.localDragOver=!1;const e=t.dataTransfer.files;if(e.length===0)return;const a=this.localCurrentPath||this.localPath;if(!a){this.$message.warning("无法确定上传目录");return}for(const i of e){this.uploadProgress={visible:!0,percent:0,filename:i.name,isDownload:!1};try{await u.uploadFilesystemWithProgress(a,i,l=>{this.uploadProgress.percent=l})}catch(l){this.uploadProgress.visible=!1,this.$message.error(`上传 ${i.name} 失败: `+l.message);return}this.uploadProgress.visible=!1}this.$message.success(`已上传 ${e.length} 个文件`),this.loadLocalFiles()},async loadZihaoConfig(){try{const t=await h.getZihaoConfig();this.zihaoConfig=t.data.active,this.zihaoConfig&&await this.loadZihaoFiles()}catch(t){console.error("加载梓豪配置失败:",t)}},async loadZihaoFiles(){if(this.zihaoConfig){this.zihaoLoading=!0;try{let e=(await h.browse(this.zihaoPath)).data.items||[];if(this.zihaoPath!=="/"){const a=this.zihaoPath.split("/").filter(Boolean).slice(0,-1).join("/");e=[{name:"..",type:"folder",path:a?"/"+a:"/",size:0,modify_time:""},...e]}this.zihaoItems=e}catch(t){this.$message.error("加载梓豪文件失败: "+t.message)}finally{this.zihaoLoading=!1}}},refreshZihao(){this.loadZihaoFiles()},navigateZihaoPath(){let t=this.zihaoPathInput.trim();t&&(t.startsWith("/")||(t="/"+t),this.zihaoPath=t,this.zihaoPathInput=t,this.loadZihaoFiles())},goZihaoUp(){if(this.zihaoPath==="/")return;const t=this.zihaoPath.split("/").filter(Boolean);t.pop(),this.zihaoPath=t.length>0?"/"+t.join("/"):"/",this.zihaoPathInput=this.zihaoPath,this.loadZihaoFiles()},selectZihaoItem(t){this.selectedZihaoPath=t.path},openZihaoItem(t){t.type==="folder"&&(this.zihaoPath=t.path,this.zihaoPathInput=t.path,this.loadZihaoFiles())},showZihaoContextMenu(t,e){this.selectedZihaoPath=e.path,this.$refs.zihaoContextMenu.show(t,e,{onRename:this.showZihaoRenameDialog,onDelete:this.handleZihaoDelete,onDownload:e.type==="file"?this.downloadZihaoToLocal:null})},showZihaoRenameDialog(t){this.renameDialog={visible:!0,title:"重命名",value:t.name,target:t,isZihao:!0},this.$nextTick(()=>{var e,a;(e=this.$refs.renameInput)==null||e.focus(),(a=this.$refs.renameInput)==null||a.select()})},async handleZihaoDelete(t){try{await this.$confirm(`确定要删除 "${t.name}" 吗?`,"确认删除",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}),await h.deleteFile(t.path,t.type),this.$message.success("删除成功"),this.loadZihaoFiles()}catch(e){e!=="cancel"&&this.$message.error("删除失败: "+e.message)}},async downloadZihaoToLocal(t){const e=this.localCurrentPath||this.localPath;if(!e){this.$message.warning("请先进入一个本地文件夹");return}this.uploadProgress={visible:!0,percent:0,filename:t.name,isDownload:!0};try{const a=e.includes("\\")?"\\":"/",i=e.endsWith("/")||e.endsWith("\\")?"":a,l=e+i+t.name;await h.download(t.path,l,o=>{this.uploadProgress.percent=o}),this.$message.success("已下载到本地: "+l),this.loadLocalFiles()}catch(a){this.$message.error("下载失败: "+a.message)}finally{this.uploadProgress.visible=!1}},async confirmRename(){const{value:t,target:e,isZihao:a}=this.renameDialog;if(!t.trim()||!e){this.cancelRename();return}try{a?(await h.rename(e.path,t.trim()),this.$message.success("重命名成功"),this.loadZihaoFiles()):(await u.renameFile(e.path,t.trim()),this.$message.success("重命名成功"),this.loadLocalFiles())}catch(i){this.$message.error("重命名失败: "+i.message)}this.renameDialog.visible=!1},cancelRename(){this.renameDialog.visible=!1},handleZihaoDragOver(t){t.preventDefault(),this.isDragOver=!0,t.dataTransfer.dropEffect="copy"},handleZihaoDragLeave(){this.isDragOver=!1},async handleZihaoDrop(t){if(t.preventDefault(),this.isDragOver=!1,!this.dragFile||!this.zihaoConfig){this.$message.warning("请先从左侧拖拽文件");return}const e=this.dragFile.name,a=this.zihaoPath||"/";this.uploadProgress={visible:!0,percent:0,filename:e,isDownload:!1};try{const i=await fetch(`/api/file/download_file?path=${encodeURIComponent(this.dragFile.path)}`);if(!i.ok)throw new Error("读取文件失败");const l=await i.blob(),o=new File([l],e);await h.uploadWithProgress(o,e,a,n=>{this.uploadProgress.percent=n}),this.$message.success("上传成功"),this.loadZihaoFiles()}catch(i){this.$message.error("上传失败: "+i.message)}finally{this.uploadProgress.visible=!1,this.dragFile=null}},openZihaoConfig(){this.$refs.zihaoConfigDialog.open(this.zihaoConfig)},formatSize(t){if(!t)return"-";const e=["B","KB","MB","GB"];let a=0,i=t;for(;i>=1024&&a<e.length-1;)i/=1024,a++;return`${i.toFixed(1)}${e[a]}`},getFileIcon(t){var i;const e=(i=t.split(".").pop())==null?void 0:i.toLowerCase();return{js:"fa-brands fa-js text-yellow-400",ts:"fa-brands fa-js text-blue-400",html:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",json:"fa-solid fa-file-code text-yellow-300",md:"fa-solid fa-file-lines text-gray-400",py:"fa-brands fa-python text-blue-500",vue:"fa-brands fa-vuejs text-green-400",png:"fa-solid fa-image text-purple-400",jpg:"fa-solid fa-image text-purple-400",pdf:"fa-solid fa-file-pdf text-red-400"}[e]||"fa-solid fa-file text-gray-400"}}};var M=function(){var i,l,o,n;var e=this,a=e._self._c;return a("div",{staticClass:"flex-1 flex overflow-hidden"},[a("aside",{staticClass:"bg-sidebar border-r border-border flex flex-col shrink-0",staticStyle:{width:"50%"}},[e._m(0),a("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[a("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"上级目录"},on:{click:e.goLocalUp}},[a("i",{staticClass:"fa-solid fa-arrow-up"})]),a("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.refreshLocal}},[a("i",{staticClass:"fa-solid fa-refresh"})]),a("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"我的电脑"},on:{click:e.goLocalHome}},[a("i",{staticClass:"fa-solid fa-home"})])]),a("div",{staticClass:"flex-1 overflow-auto py-1",class:{"bg-blue-900/20":e.localDragOver},on:{dragover:function(s){return s.preventDefault(),e.handleLocalDragOver.apply(null,arguments)},dragleave:e.handleLocalDragLeave,drop:e.handleLocalDrop}},[e.localLoading?a("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[a("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.localItems.length===0?a("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._v(" 此目录为空 ")]):a("table",{staticClass:"w-full text-sm"},[e._m(1),a("tbody",e._l(e.localItems,function(s){return a("tr",{key:s.path,staticClass:"cursor-pointer border-b border-[#3c3c3c]/50 hover:bg-[#2a2a2a]",class:{"bg-[#094771]":e.selectedLocalPath===s.path},attrs:{draggable:!s.is_directory},on:{click:function(r){return e.selectLocalItem(s)},dblclick:function(r){return e.openLocalItem(s)},contextmenu:function(r){return r.preventDefault(),e.showLocalContextMenu(r,s)},dragstart:function(r){return e.handleLocalDragStart(r,s)}}},[a("td",{staticClass:"px-3 py-1"},[a("div",{staticClass:"flex items-center gap-2"},[a("i",{staticClass:"text-xs text-textMuted w-4",class:s.is_directory?"fa-solid fa-folder text-yellow-500":e.getFileIcon(s.name)}),a("span",{staticClass:"text-[#cccccc] truncate",attrs:{title:s.name}},[e._v(e._s(s.name))])])]),a("td",{staticClass:"px-3 py-1 text-[#808080] text-xs"},[e._v(e._s(s.is_directory?"文件夹":"文件"))]),a("td",{staticClass:"px-3 py-1 text-[#808080] text-xs text-right"},[e._v(e._s(s.is_directory?"-":e.formatSize(s.size)))]),a("td",{staticClass:"px-3 py-1 text-[#808080] text-xs"},[e._v("-")])])}),0)])]),a("div",{directives:[{name:"show",rawName:"v-show",value:e.localContextMenu.visible,expression:"localContextMenu.visible"}],staticClass:"fixed bg-[#252526] border border-[#3c3c3c] rounded shadow-lg py-1 z-50 min-w-[160px]",style:{left:e.localContextMenu.x+"px",top:e.localContextMenu.y+"px"}},[a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-[#cccccc] hover:bg-[#094771] flex items-center gap-2",on:{click:e.copyLocalPath}},[a("i",{staticClass:"fa-solid fa-copy text-xs w-4"}),e._v(" 复制路径 ")]),((i=e.localContextMenu.target)==null?void 0:i.name)!==".."?a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-[#cccccc] hover:bg-[#094771] flex items-center gap-2",on:{click:e.showLocalRenameDialog}},[a("i",{staticClass:"fa-solid fa-pen text-xs w-4"}),e._v(" 重命名 ")]):e._e(),((l=e.localContextMenu.target)==null?void 0:l.name)!==".."?a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-[#094771] flex items-center gap-2",on:{click:e.deleteLocalItem}},[a("i",{staticClass:"fa-solid fa-trash text-xs w-4"}),e._v(" 删除 ")]):e._e(),a("div",{staticClass:"border-t border-[#3c3c3c] my-1"}),((o=e.localContextMenu.target)==null?void 0:o.name)!==".."&&!((n=e.localContextMenu.target)!=null&&n.is_directory)?a("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-[#cccccc] hover:bg-[#094771] flex items-center gap-2",on:{click:e.uploadToZihao}},[a("i",{staticClass:"fa-solid fa-server text-xs w-4"}),e._v(" 上传到梓豪 ")]):e._e()])]),a("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-[#1e1e1e]"},[a("div",{staticClass:"flex border-b border-border bg-sidebar shrink-0"},[e._m(2),a("div",{staticClass:"flex-1"}),a("button",{staticClass:"p-1 mr-2 text-textMuted hover:text-white",attrs:{title:"梓豪配置"},on:{click:e.openZihaoConfig}},[a("i",{staticClass:"fa-solid fa-gear"})])]),a("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[a("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"上级目录"},on:{click:e.goZihaoUp}},[a("i",{staticClass:"fa-solid fa-arrow-up"})]),a("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.refreshZihao}},[a("i",{staticClass:"fa-solid fa-refresh"})]),a("input",{directives:[{name:"model",rawName:"v-model",value:e.zihaoPathInput,expression:"zihaoPathInput"}],staticClass:"flex-1 px-2 py-1 mx-1 bg-[#3c3c3c] border border-[#3c3c3c] rounded text-xs text-[#cccccc] focus:outline-none focus:border-[#0e639c]",attrs:{placeholder:"输入路径后回车跳转..."},domProps:{value:e.zihaoPathInput},on:{keyup:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.navigateZihaoPath.apply(null,arguments)},input:function(s){s.target.composing||(e.zihaoPathInput=s.target.value)}}})]),a("div",{staticClass:"flex-1 overflow-auto py-1",class:{"bg-blue-900/20":e.isDragOver},on:{dragover:function(s){return s.preventDefault(),e.handleZihaoDragOver.apply(null,arguments)},dragleave:e.handleZihaoDragLeave,drop:e.handleZihaoDrop}},[e.zihaoConfig?e.zihaoLoading?a("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[a("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.zihaoItems.length===0?a("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._v(" 此目录为空 ")]):a("table",{staticClass:"w-full text-sm"},[e._m(3),a("tbody",e._l(e.zihaoItems,function(s){return a("tr",{key:s.path,staticClass:"cursor-pointer border-b border-[#3c3c3c]/50 hover:bg-[#2a2a2a]",class:{"bg-[#094771]":e.selectedZihaoPath===s.path},on:{click:function(r){return e.selectZihaoItem(s)},dblclick:function(r){return e.openZihaoItem(s)},contextmenu:function(r){return r.preventDefault(),e.showZihaoContextMenu(r,s)}}},[a("td",{staticClass:"px-3 py-1"},[a("div",{staticClass:"flex items-center gap-2"},[a("i",{staticClass:"text-xs text-textMuted w-4",class:s.type==="folder"?"fa-solid fa-folder text-yellow-500":e.getFileIcon(s.name)}),a("span",{staticClass:"text-[#cccccc] truncate",attrs:{title:s.name}},[e._v(e._s(s.name))])])]),a("td",{staticClass:"px-3 py-1 text-[#808080] text-xs"},[e._v(e._s(s.type==="folder"?"文件夹":"文件"))]),a("td",{staticClass:"px-3 py-1 text-[#808080] text-xs text-right"},[e._v(e._s(s.type==="file"?e.formatSize(s.size):"-"))]),a("td",{staticClass:"px-3 py-1 text-[#808080] text-xs"},[e._v(e._s(s.modify_time||"-"))])])}),0)]):a("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[a("div",{staticClass:"text-center"},[a("i",{staticClass:"fa-solid fa-server text-4xl mb-4 opacity-30"}),a("p",{staticClass:"mb-2"},[e._v("未配置梓豪平台")]),a("button",{staticClass:"px-4 py-2 bg-[#0e639c] text-white rounded hover:bg-[#1177bb] text-sm",on:{click:e.openZihaoConfig}},[e._v(" 配置梓豪 ")])])])]),a("ZihaoConfigDialog",{ref:"zihaoConfigDialog",on:{success:e.loadZihaoConfig}}),a("ZihaoContextMenu",{ref:"zihaoContextMenu"})],1),a("div",{directives:[{name:"show",rawName:"v-show",value:e.renameDialog.visible,expression:"renameDialog.visible"}],staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",on:{click:function(s){return s.target!==s.currentTarget?null:e.cancelRename.apply(null,arguments)}}},[a("div",{staticClass:"bg-[#252526] border border-[#3c3c3c] rounded p-4 w-80"},[a("p",{staticClass:"text-[#cccccc] text-sm mb-3"},[e._v(e._s(e.renameDialog.title))]),a("input",{directives:[{name:"model",rawName:"v-model",value:e.renameDialog.value,expression:"renameDialog.value"}],ref:"renameInput",staticClass:"w-full px-3 py-2 bg-[#3c3c3c] border border-[#3c3c3c] rounded text-[#cccccc] text-sm focus:outline-none focus:border-[#0e639c]",domProps:{value:e.renameDialog.value},on:{keyup:[function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.confirmRename.apply(null,arguments)},function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"escape",void 0,s.key,void 0)?null:e.cancelRename.apply(null,arguments)}],input:function(s){s.target.composing||e.$set(e.renameDialog,"value",s.target.value)}}}),a("div",{staticClass:"flex justify-end gap-2 mt-4"},[a("button",{staticClass:"px-3 py-1 text-xs text-[#808080] hover:text-white",on:{click:e.cancelRename}},[e._v("取消")]),a("button",{staticClass:"px-3 py-1 text-xs bg-[#0e639c] text-white rounded hover:bg-[#1177bb]",on:{click:e.confirmRename}},[e._v("确定")])])])]),e.uploadProgress.visible?a("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[a("div",{staticClass:"bg-[#252526] border border-[#3c3c3c] rounded p-4 w-80"},[a("p",{staticClass:"text-[#cccccc] text-sm mb-3"},[e._v("正在 "+e._s(e.uploadProgress.isDownload?"下载":"上传")+" "+e._s(e.uploadProgress.filename))]),a("div",{staticClass:"w-full bg-[#3c3c3c] rounded-full h-2"},[a("div",{staticClass:"bg-[#0e639c] h-2 rounded-full transition-all",style:{width:e.uploadProgress.percent+"%"}})]),a("p",{staticClass:"text-[#808080] text-xs mt-2 text-center"},[e._v(e._s(e.uploadProgress.percent.toFixed(2))+"%")])])]):e._e()])},I=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex border-b border-border"},[e("div",{staticClass:"px-4 py-2 text-xs uppercase font-bold text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-folder-open text-accent"}),t._v(" 本地文件 ")])])},function(){var t=this,e=t._self._c;return e("thead",{staticClass:"sticky top-0 bg-[#252526] z-10"},[e("tr",{staticClass:"text-textMuted text-xs border-b border-[#3c3c3c]"},[e("th",{staticClass:"text-left px-3 py-1 font-medium"},[t._v("名称")]),e("th",{staticClass:"text-left px-3 py-1 w-16 font-medium"},[t._v("类型")]),e("th",{staticClass:"text-right px-3 py-1 w-20 font-medium"},[t._v("大小")]),e("th",{staticClass:"text-left px-3 py-1 w-32 font-medium"},[t._v("修改时间")])])])},function(){var t=this,e=t._self._c;return e("div",{staticClass:"px-4 py-2 text-xs uppercase font-bold text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-server text-accent"}),t._v(" 梓豪远程平台 ")])},function(){var t=this,e=t._self._c;return e("thead",{staticClass:"sticky top-0 bg-[#252526] z-10"},[e("tr",{staticClass:"text-textMuted text-xs border-b border-[#3c3c3c]"},[e("th",{staticClass:"text-left px-3 py-1 font-medium"},[t._v("名称")]),e("th",{staticClass:"text-left px-3 py-1 w-16 font-medium"},[t._v("类型")]),e("th",{staticClass:"text-right px-3 py-1 w-20 font-medium"},[t._v("大小")]),e("th",{staticClass:"text-left px-3 py-1 w-32 font-medium"},[t._v("修改时间")])])])}],F=m($,M,I,!1,null,null);const T=F.exports;export{T as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as f}from"./index-
|
|
1
|
+
import{m as f}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sidebar-scroll[data-v-809cca3f]::-webkit-scrollbar{width:8px}.sidebar-scroll[data-v-809cca3f]::-webkit-scrollbar-track{background:transparent}.sidebar-scroll[data-v-809cca3f]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.sidebar-scroll[data-v-809cca3f]::-webkit-scrollbar-thumb:hover{background:#505050}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n,e as o,K as c,d,a as r}from"./index-CUBJZpK-.js";import{C as f}from"./ConfirmDialog-IKK1F-1U.js";const h={name:"GitChangesSidebar",props:{changes:{type:Array,default:()=>[]},selectedPath:{type:String,default:null},isRepo:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},width:{type:Number,default:320}},methods:{getStatusClass(s){return{modified:"bg-blue-600 text-white",added:"bg-green-600 text-white",deleted:"bg-red-600 text-white",untracked:"bg-gray-600 text-white",renamed:"bg-purple-600 text-white"}[s]||"bg-gray-600 text-white"},getFileName(s){return s.split("/").pop()||s.split("\\").pop()||s},getDirPath(s){const t=s.split("/");return t.pop(),t.join("/")||"."}}};var u=function(){var t=this,e=t._self._c;return e("aside",{staticClass:"bg-sidebar border-r border-border flex flex-col shrink-0",style:{width:t.width+"px"}},[e("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[t._m(0),e("button",{staticClass:"ml-auto px-3 py-2 hover:text-white text-textMuted",attrs:{title:"刷新"},on:{click:function(i){return t.$emit("refresh")}}},[e("i",{staticClass:"fa-solid fa-refresh"})]),e("button",{staticClass:"px-3 py-2 hover:text-yellow-400 text-textMuted disabled:opacity-30",attrs:{disabled:t.changes.length===0,title:"撤销全部"},on:{click:function(i){return t.$emit("revert-all")}}},[e("i",{staticClass:"fa-solid fa-undo-alt"})])]),e("div",{staticClass:"flex-1 overflow-y-auto py-1 sidebar-scroll"},[t.loading?e("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[e("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),t._v(" 加载中... ")]):t.isRepo?t.changes.length===0?e("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[t._m(2)]):e("div",t._l(t.changes,function(i){return e("div",{key:i.path,staticClass:"px-3 py-2 cursor-pointer border-b border-border/50 hover:bg-hoverBg transition-colors",class:t.selectedPath===i.path?"bg-hoverBg border-l-2 border-l-accent":"",on:{click:function(a){return t.$emit("select",i)}}},[e("div",{staticClass:"flex items-center gap-2"},[e("span",{staticClass:"text-xs font-bold px-1.5 py-0.5 rounded shrink-0",class:t.getStatusClass(i.status)},[t._v(" "+t._s(i.statusCode)+" ")]),e("div",{staticClass:"flex-1 min-w-0"},[e("div",{staticClass:"text-sm text-textMain truncate",attrs:{title:i.path}},[t._v(" "+t._s(t.getFileName(i.path))+" ")]),e("div",{staticClass:"text-xs text-textMuted truncate",attrs:{title:i.path}},[t._v(" "+t._s(t.getDirPath(i.path))+" ")])]),e("div",{staticClass:"flex items-center gap-1 shrink-0",on:{click:function(a){a.stopPropagation()}}},[e("button",{staticClass:"p-1 text-textMuted hover:text-blue-400 transition-colors",attrs:{title:"打开"},on:{click:function(a){return t.$emit("open-file",i)}}},[e("i",{staticClass:"fa-solid fa-external-link-alt text-xs"})]),e("button",{staticClass:"p-1 text-textMuted hover:text-yellow-400 transition-colors",attrs:{title:"撤销"},on:{click:function(a){return t.$emit("revert",i)}}},[e("i",{staticClass:"fa-solid fa-undo text-xs"})])])])])}),0):e("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[t._m(1)])]),e("div",{staticClass:"border-t border-border px-3 py-2 text-xs text-textMuted"},[e("span",[t._v(t._s(t.changes.length)+" 个文件变更")])])])},g=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[t("i",{staticClass:"fa-brands fa-git-alt"}),s._v(" Git Changes ")])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"text-center"},[t("i",{staticClass:"fa-brands fa-git-alt text-4xl mb-4 opacity-30"}),t("p",[s._v("当前目录不是 Git 仓库")])])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"text-center"},[t("i",{staticClass:"fa-solid fa-check-circle text-4xl mb-4 opacity-30 text-green-500"}),t("p",[s._v("没有待提交的变更")])])}],p=n(h,u,g,!1,null,"809cca3f");const x=p.exports,v={name:"DiffViewer",props:{change:{type:Object,default:null},diffContent:{type:String,default:""},loading:{type:Boolean,default:!1}},data(){return{oldLines:[],newLines:[]}},watch:{diffContent:{immediate:!0,handler(s){this.parseDiff(s)}}},methods:{getStatusClass(s){return{modified:"bg-blue-600 text-white",added:"bg-green-600 text-white",deleted:"bg-red-600 text-white",untracked:"bg-gray-600 text-white",renamed:"bg-purple-600 text-white"}[s]||"bg-gray-600 text-white"},getLinePrefix(s){return s.removed?"-":s.added?"+":" "},getLineClass(s){return s.type==="header"?"bg-inputBg text-blue-400":s.removed?"bg-red-900/50 text-red-300":s.added?"bg-green-900/50 text-green-300":s.empty?"bg-hoverBg":"text-textMain"},parseDiff(s){if(this.oldLines=[],this.newLines=[],!s)return;const t=s.split(`
|
|
2
|
+
`);let e=1,i=1;for(const a of t)if(a.startsWith("@@")){const l=a.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);l&&(e=parseInt(l[1]),i=parseInt(l[2])),this.oldLines.push({lineNum:"",content:a,type:"header"}),this.newLines.push({lineNum:"",content:a,type:"header"})}else a.startsWith("---")||a.startsWith("+++")||a.startsWith("diff ")||a.startsWith("index ")||(a.startsWith("-")?(this.oldLines.push({lineNum:e++,content:a.substring(1),removed:!0}),this.newLines.push({lineNum:"",content:"",empty:!0})):a.startsWith("+")?(this.oldLines.push({lineNum:"",content:"",empty:!0}),this.newLines.push({lineNum:i++,content:a.substring(1),added:!0})):(this.oldLines.push({lineNum:e++,content:a}),this.newLines.push({lineNum:i++,content:a})))}}};var m=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[t.change?e("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[e("div",{staticClass:"flex items-center justify-between px-4 py-2 border-b border-border bg-sidebar"},[e("div",{staticClass:"flex items-center gap-2"},[e("span",{staticClass:"text-xs font-bold px-1.5 py-0.5 rounded",class:t.getStatusClass(t.change.status)},[t._v(" "+t._s(t.change.statusCode)+" ")]),e("span",{staticClass:"text-white text-sm"},[t._v(t._s(t.change.path))])]),e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"px-3 py-1 text-xs bg-blue-600 hover:bg-blue-700 text-white rounded",on:{click:function(i){return t.$emit("open-file",t.change)}}},[e("i",{staticClass:"fa-solid fa-external-link-alt mr-1"}),t._v(" 打开文件 ")]),e("button",{staticClass:"px-3 py-1 text-xs bg-yellow-600 hover:bg-yellow-700 text-white rounded",on:{click:function(i){return t.$emit("revert",t.change)}}},[e("i",{staticClass:"fa-solid fa-undo mr-1"}),t._v(" 撤销 ")])])]),t.loading?e("div",{staticClass:"flex-1 flex items-center justify-center text-textMuted"},[e("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),t._v(" 加载 diff 中... ")]):t.diffContent?e("div",{staticClass:"flex-1 flex overflow-hidden"},[e("div",{staticClass:"flex-1 flex flex-col overflow-hidden border-r border-border"},[e("div",{staticClass:"px-4 py-2 bg-border border-b border-border text-xs text-textMain font-bold"},[t._v(" 旧版本 (Original) ")]),e("div",{staticClass:"flex-1 overflow-auto bg-sidebar"},t._l(t.oldLines,function(i,a){return e("div",{key:"old-"+a,staticClass:"flex font-mono text-sm",class:t.getLineClass(i)},[e("span",{staticClass:"w-12 shrink-0 text-right pr-2 select-none opacity-40"},[t._v(t._s(i.lineNum||""))]),e("span",{staticClass:"flex-1 whitespace-pre"},[e("span",{staticClass:"select-none font-bold w-4 inline-block"},[t._v(t._s(t.getLinePrefix(i)))]),t._v(t._s(i.content))])])}),0)]),e("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[e("div",{staticClass:"px-4 py-2 bg-border border-b border-border text-xs text-textMain font-bold"},[t._v(" 新版本 (Modified) ")]),e("div",{staticClass:"flex-1 overflow-auto bg-sidebar"},t._l(t.newLines,function(i,a){return e("div",{key:"new-"+a,staticClass:"flex font-mono text-sm",class:t.getLineClass(i)},[e("span",{staticClass:"w-12 shrink-0 text-right pr-2 select-none opacity-40"},[t._v(t._s(i.lineNum||""))]),e("span",{staticClass:"flex-1 whitespace-pre"},[e("span",{staticClass:"select-none font-bold w-4 inline-block"},[t._v(t._s(t.getLinePrefix(i)))]),t._v(t._s(i.content))])])}),0)])]):e("div",{staticClass:"flex-1 flex items-center justify-center text-textMuted"},[t._m(1)])]):e("div",{staticClass:"flex-1 flex items-center justify-center text-textMuted"},[t._m(0)])])},b=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"text-center"},[t("i",{staticClass:"fa-solid fa-code text-6xl mb-4 opacity-20"}),t("p",[s._v("点击文件查看变更详情")])])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"text-center"},[t("i",{staticClass:"fa-solid fa-file text-4xl mb-4 opacity-30"}),t("p",[s._v("无法显示此文件的 diff")])])}],C=n(v,m,b,!1,null,null);const _=C.exports,y=console.error;console.error=(...s)=>{var t;(t=s[0])!=null&&t.toString().includes("toUrl")||y(...s)};const w={name:"FileViewerModal",data(){return{visible:!1,fullPath:"",fileStatus:null,loading:!1,saving:!1,editor:null,originalContent:""}},computed:{filePath(){if(!this.fullPath)return"";const s=this.fullPath.split("/");return s[s.length-1]},hasChanges(){return this.editor?this.editor.getValue()!==this.originalContent:!1},statusCode(){return this.fileStatus&&this.fileStatus.statusCode||""},statusClass(){return this.fileStatus&&{modified:"bg-blue-600 text-white",added:"bg-green-600 text-white",deleted:"bg-red-600 text-white",untracked:"bg-gray-600 text-white",renamed:"bg-purple-600 text-white"}[this.fileStatus.status]||"bg-gray-600 text-white"}},beforeDestroy(){this.destroyEditor()},methods:{async open(s,t=null){var e;this.fullPath=s,this.fileStatus=t,this.visible=!0,this.loading=!0;try{const i=await r.getFileContent(s);this.originalContent=((e=i.data)==null?void 0:e.content)||"",this.$nextTick(()=>{this.initEditor(this.originalContent)})}catch(i){console.error("Failed to load file:",i),this.$message.error("加载文件失败")}finally{this.loading=!1}},close(){this.visible=!1},async save(){if(!(!this.fullPath||!this.hasChanges)){this.saving=!0;try{await r.writeFile(this.fullPath,this.editor.getValue()),this.originalContent=this.editor.getValue(),this.$message.success("文件已保存")}catch(s){console.error("Save file failed:",s),this.$message.error("保存文件失败")}finally{this.saving=!1}}},initEditor(s){console.log("-----------initEditor called with content length:",s.length),this.$refs.editorContainer&&(console.log("-----------initEditor called with content length:aaaa",s.length),this.editor=o.create(this.$refs.editorContainer,{value:s||"",language:this.getLanguage(),theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on",scrollbar:{useShadows:!1,vertical:"auto",horizontal:"auto"}}),this.editor.addCommand(c.CtrlCmd|d.KeyS,()=>{this.save()}))},destroyEditor(){this.editor&&(this.editor.dispose(),this.editor=null)},getLanguage(){const s=this.filePath.split(".").pop().toLowerCase();return{js:"javascript",ts:"typescript",html:"html",css:"css",vue:"html",py:"python",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"shell",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",jsx:"javascript",tsx:"typescript"}[s]||"plaintext"}}};var $=function(){var t=this,e=t._self._c;return t.visible?e("div",{staticClass:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",on:{click:function(i){return i.target!==i.currentTarget?null:t.close.apply(null,arguments)}}},[e("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[90%] h-[80%] flex flex-col overflow-hidden"},[e("div",{staticClass:"flex items-center justify-between px-4 py-3 border-b border-border"},[e("div",{staticClass:"flex items-center gap-2"},[t.fileStatus?e("span",{staticClass:"text-xs font-bold px-1.5 py-0.5 rounded",class:t.statusClass},[t._v(" "+t._s(t.statusCode)+" ")]):t._e(),e("span",{staticClass:"text-white text-sm"},[t._v(t._s(t.filePath))])]),e("button",{staticClass:"text-textMuted hover:text-white",on:{click:t.close}},[e("i",{staticClass:"fa-solid fa-times text-lg"})])]),e("div",{staticClass:"flex-1 overflow-hidden bg-contentBg"},[e("div",{ref:"editorContainer",staticClass:"w-full h-full"})]),e("div",{staticClass:"h-8 bg-sidebar border-t border-border flex items-center justify-between px-3"},[e("div",{staticClass:"flex items-center gap-4 text-xs text-textMuted"},[e("span",[t._v(t._s(t.fullPath))]),t.hasChanges?e("span",{staticClass:"text-yellow-500"},[t._v("已修改")]):t._e()]),e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"px-3 py-1 text-xs bg-primary hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded",attrs:{disabled:!t.hasChanges||t.saving},on:{click:t.save}},[t.saving?e("i",{staticClass:"fa-solid fa-spinner fa-spin mr-1"}):e("i",{staticClass:"fa-solid fa-save mr-1"}),t._v(" 保存 ")])])])])]):t._e()},R=[],L=n(w,$,R,!1,null,null);const k=L.exports,M={name:"GitChanges",components:{GitChangesSidebar:x,DiffViewer:_,FileViewerModal:k,ConfirmDialog:f},data(){return{isRepo:!1,gitRoot:null,changes:[],selectedChange:null,diffContent:null,loading:!1,diffLoading:!1,sidebarWidth:320,isResizing:!1,confirmDialog:{visible:!1,message:"",action:null,target:null}}},async created(){await this.checkRepo(),await this.refreshChanges(),document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize)},beforeDestroy(){document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize)},methods:{async checkRepo(){var s,t;try{const e=await r.gitIsRepo();this.isRepo=((s=e.data)==null?void 0:s.isRepo)||!1,this.gitRoot=((t=e.data)==null?void 0:t.gitRoot)||null}catch{this.isRepo=!1}},async refreshChanges(){if(this.isRepo){this.loading=!0;try{const s=await r.gitStatus();this.changes=s.data||[],this.selectedChange&&(this.changes.find(e=>e.path===this.selectedChange.path)||(this.selectedChange=null,this.diffContent=null))}catch(s){console.error("Failed to get git status:",s),this.$message.error("获取变更列表失败")}finally{this.loading=!1}}},async refresh(){await this.refreshChanges(),this.selectedChange&&await this.loadDiff(this.selectedChange)},selectChange(s){this.selectedChange=s,this.loadDiff(s)},async loadDiff(s){var t;this.diffLoading=!0,this.diffContent=null;try{const e=await r.gitDiff(s.path,s.isNew);this.diffContent=((t=e.data)==null?void 0:t.diff)||""}catch(e){console.error("Failed to get diff:",e),this.diffContent=""}finally{this.diffLoading=!1}},async openFile(s){var e;const t=this.gitRoot?`${this.gitRoot.replace(/\\/g,"/")}/${s.path}`:s.path;(e=this.$refs.fileModalRef)==null||e.open(t,s)},revertFile(s){const t=s.isNew?"delete":"revert",e=s.isNew?`确定要删除未跟踪的文件 "${s.path}" 吗?`:`确定要撤销对 "${s.path}" 的修改吗?`;this.confirmDialog={visible:!0,message:e,action:t,target:s}},confirmRevertAll(){this.changes.length!==0&&(this.confirmDialog={visible:!0,message:`确定要撤销所有 ${this.changes.length} 个文件的变更吗?此操作不可恢复。`,action:"revertAll",target:null})},cancelConfirm(){this.confirmDialog.visible=!1},async executeConfirm(){const{action:s,target:t}=this.confirmDialog;this.confirmDialog.visible=!1;try{s==="revertAll"?(await r.gitRevertAll(),await r.gitDiscardUntracked(),this.$message.success("所有变更已撤销")):s==="revert"?(await r.gitRevert(t.path),this.$message.success("文件已撤销")):s==="delete"&&(await r.gitDeleteFile(t.path),this.$message.success("文件已删除")),await this.refreshChanges()}catch(e){console.error("Operation failed:",e),this.$message.error("操作失败: "+(e.message||"未知错误"))}},startResize(s){this.isResizing=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},handleResize(s){if(!this.isResizing)return;const t=s.clientX;t>=200&&t<=500&&(this.sidebarWidth=t)},stopResize(){this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect=""}}};var D=function(){var i;var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden"},[e("git-changes-sidebar",{attrs:{width:t.sidebarWidth,changes:t.changes,"selected-path":(i=t.selectedChange)==null?void 0:i.path,"is-repo":t.isRepo,loading:t.loading},on:{refresh:t.refresh,select:t.selectChange,"open-file":t.openFile,revert:t.revertFile,"revert-all":t.confirmRevertAll}}),e("div",{staticClass:"w-1 bg-border hover:bg-accent cursor-col-resize transition-colors shrink-0",on:{mousedown:t.startResize}}),e("diff-viewer",{attrs:{change:t.selectedChange,"diff-content":t.diffContent,loading:t.diffLoading},on:{"open-file":t.openFile,revert:t.revertFile}}),e("file-viewer-modal",{ref:"fileModalRef"}),e("confirm-dialog",{attrs:{visible:t.confirmDialog.visible,message:t.confirmDialog.message},on:{confirm:t.executeConfirm,cancel:t.cancelConfirm}})],1)},S=[],F=n(M,D,S,!1,null,null);const z=F.exports;export{z as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as r,a as n}from"./index-
|
|
1
|
+
import{n as r,a as n}from"./index-CUBJZpK-.js";import{C as d}from"./ConfirmDialog-IKK1F-1U.js";const f={name:"GitChangesApp",components:{ConfirmDialog:d},data(){return{isRepo:!1,branch:"",changes:[],loading:!1,selectedChange:null,diffLines:[],diffLoading:!1,currentTab:"modified",currentFilter:"all",confirmDialog:{visible:!1,message:"",action:null,target:null}}},computed:{tabs(){return[{key:"modified",label:"已修改",count:this.changes.filter(e=>e.status==="modified").length},{key:"added",label:"已添加",count:this.changes.filter(e=>e.status==="added").length},{key:"untracked",label:"未跟踪",count:this.changes.filter(e=>e.status==="untracked").length}]},filters(){return[{key:"all",label:"全部"},{key:"file",label:"仅文件"},{key:"dir",label:"仅目录"}]},stats(){return{add:this.changes.filter(e=>e.status==="added").length,mod:this.changes.filter(e=>e.status==="modified").length,del:this.changes.filter(e=>e.status==="deleted").length}},filteredChanges(){let e=this.changes;return this.currentTab==="modified"?e=e.filter(t=>t.status==="modified"):this.currentTab==="added"?e=e.filter(t=>t.status==="added"||t.status==="renamed"):this.currentTab==="untracked"&&(e=e.filter(t=>t.status==="untracked")),this.currentFilter==="file"?e=e.filter(t=>!t.path.endsWith("/")):this.currentFilter==="dir"&&(e=e.filter(t=>t.path.endsWith("/"))),e}},async created(){await this.checkRepo(),await this.refreshChanges()},methods:{async checkRepo(){var e,t;try{const s=await n.gitIsRepo();this.isRepo=((e=s.data)==null?void 0:e.isRepo)||!1,this.branch=((t=s.data)==null?void 0:t.branch)||""}catch{this.isRepo=!1}},async refreshChanges(){if(this.isRepo){this.loading=!0;try{const e=await n.gitStatus();this.changes=(e.data||[]).map(t=>{let s=t.status||"modified";return{...t,status:s}}),this.selectedChange&&(this.changes.find(s=>s.path===this.selectedChange.path)||(this.selectedChange=null))}catch(e){console.error("Failed to get git status:",e)}finally{this.loading=!1}}},async refresh(){await this.refreshChanges()},selectChange(e){this.selectedChange=e,this.loadDiff(e)},async loadDiff(e){var t;this.diffLoading=!0,this.diffLines=[];try{const s=await n.gitDiff(e.path,e.isNew);this.diffLines=this.parseDiff(((t=s.data)==null?void 0:t.diff)||"")}catch(s){console.error("Failed to get diff:",s)}finally{this.diffLoading=!1}},parseDiff(e){if(!e)return[];const t=e.split(`
|
|
2
2
|
`);let s=1,a=1;const l=[];for(const i of t)if(i.startsWith("@@")){const c=i.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);c&&(s=parseInt(c[1]),a=parseInt(c[2])),l.push({lineNum:"",sign:"",content:i,type:"header"})}else{if(i.startsWith("---")||i.startsWith("+++")||i.startsWith("diff ")||i.startsWith("index "))continue;i.startsWith("-")?l.push({lineNum:s++,sign:"-",content:i.substring(1),type:"del"}):i.startsWith("+")?l.push({lineNum:a++,sign:"+",content:i.substring(1),type:"add"}):(l.push({lineNum:s++,sign:" ",content:i,type:"context"}),a++)}return l},getStatusClass(e){return{added:"add",modified:"mod",deleted:"del",untracked:"new",renamed:"mod"}[e]||"mod"},getStatusIcon(e){return{added:"fa-solid fa-plus",modified:"fa-solid fa-pen",deleted:"fa-solid fa-trash",untracked:"fa-solid fa-star",renamed:"fa-solid fa-pen"}[e]||"fa-solid fa-pen"},getFileName(e){const t=e.split("/");return t[t.length-1]},getFilePath(e){const t=e.split("/");return t.pop(),t.join("/")},confirmRevertAll(){this.filteredChanges.length!==0&&(this.confirmDialog={visible:!0,message:`确定要撤销所有 ${this.filteredChanges.length} 个文件的变更吗?此操作不可恢复。`,action:"revertAll",target:null})},cancelConfirm(){this.confirmDialog.visible=!1},async executeConfirm(){const{action:e,target:t}=this.confirmDialog;this.confirmDialog.visible=!1;try{e==="revertAll"?(await n.gitRevertAll(),await n.gitDiscardUntracked(),this.$message.success("所有变更已撤销")):e==="revert"?(await n.gitRevert(t.path),this.$message.success("文件已撤销")):e==="delete"&&(await n.gitDeleteFile(t.path),this.$message.success("文件已删除")),await this.refreshChanges()}catch(s){console.error("Operation failed:",s),this.$message.error("操作失败: "+(s.message||"未知错误"))}},openCommit(){this.$message.info("提交功能开发中")}}};var o=function(){var t=this,s=t._self._c;return s("div",{staticClass:"git-changes-app"},[s("header",{staticClass:"header"},[t._m(0),s("span",{staticClass:"header-title"},[t._v("Git 变更")]),s("div",{staticClass:"header-actions"},[s("button",{staticClass:"header-btn",attrs:{title:"刷新"},on:{click:t.refresh}},[s("i",{staticClass:"fa-solid fa-rotate",class:{"fa-spin":t.loading}})])])]),s("div",{staticClass:"change-summary"},[s("div",{staticClass:"summary-stats"},[s("span",{staticClass:"stat-item add"},[s("i",{staticClass:"fa-solid fa-plus"}),t._v(" "+t._s(t.stats.add)+" ")]),s("span",{staticClass:"stat-item mod"},[s("i",{staticClass:"fa-solid fa-pen"}),t._v(" "+t._s(t.stats.mod)+" ")]),s("span",{staticClass:"stat-item del"},[s("i",{staticClass:"fa-solid fa-minus"}),t._v(" "+t._s(t.stats.del)+" ")])]),t.branch?s("div",{staticClass:"branch-info"},[s("i",{staticClass:"fa-solid fa-code-branch"}),s("span",[t._v(t._s(t.branch))])]):t._e()]),s("div",{staticClass:"tab-bar"},t._l(t.tabs,function(a){return s("div",{key:a.key,staticClass:"tab-item",class:{active:t.currentTab===a.key},on:{click:function(l){t.currentTab=a.key}}},[t._v(" "+t._s(a.label)),s("span",{staticClass:"count"},[t._v(t._s(a.count))])])}),0),s("div",{staticClass:"filter-bar"},t._l(t.filters,function(a){return s("div",{key:a.key,staticClass:"filter-chip",class:{active:t.currentFilter===a.key},on:{click:function(l){t.currentFilter=a.key}}},[t._v(" "+t._s(a.label)+" ")])}),0),t.isRepo?t.filteredChanges.length>0?[t.selectedChange?s("div",{ref:"diffViewRef",staticClass:"diff-view"},[s("div",{staticClass:"diff-header"},[s("i",{staticClass:"fa-solid fa-file-code"}),s("span",[t._v(t._s(t.selectedChange.path))]),s("span",{staticStyle:{"margin-left":"auto",color:"var(--accent)"},on:{click:function(a){t.selectedChange=null}}},[t._v("收起")])]),!t.diffLoading&&t.diffLines.length>0?s("div",{staticClass:"diff-content"},t._l(t.diffLines,function(a,l){return s("div",{key:l,staticClass:"diff-line",class:a.type},[s("span",{staticClass:"line-num"},[t._v(t._s(a.lineNum))]),s("span",{staticClass:"line-sign",class:a.type},[t._v(t._s(a.sign))]),s("span",{staticClass:"line-text"},[t._v(t._s(a.content))])])}),0):t._e(),t.diffLoading?s("div",{staticClass:"diff-loading"},[s("span",{staticClass:"loading-spinner"}),t._v(" 加载中... ")]):t._e()]):s("div",{ref:"fileListRef",staticClass:"file-list"},t._l(t.filteredChanges,function(a,l){var i;return s("div",{key:l,staticClass:"change-item",class:{selected:((i=t.selectedChange)==null?void 0:i.path)===a.path},on:{click:function(c){return t.selectChange(a)}}},[s("div",{staticClass:"change-status",class:t.getStatusClass(a.status)},[s("i",{class:t.getStatusIcon(a.status)})]),s("div",{staticClass:"change-info"},[s("div",{staticClass:"change-name"},[t._v(t._s(t.getFileName(a.path)))]),s("div",{staticClass:"change-path"},[t._v(t._s(t.getFilePath(a.path)))])]),a.linesAdded!==void 0||a.linesDeleted!==void 0?s("div",{staticClass:"change-stats"},[a.linesAdded?s("span",{staticClass:"add-line"},[t._v("+"+t._s(a.linesAdded))]):t._e(),a.linesAdded&&a.linesDeleted?s("span",[t._v(" / ")]):t._e(),a.linesDeleted?s("span",{staticClass:"del-line"},[t._v("-"+t._s(a.linesDeleted))]):t._e()]):t._e()])}),0)]:s("div",{staticClass:"file-list"},[t._m(2)]):s("div",{staticClass:"file-list"},[t._m(1)]),s("div",{staticClass:"bottom-actions"},[s("button",{staticClass:"action-btn secondary",attrs:{disabled:t.filteredChanges.length===0},on:{click:t.confirmRevertAll}},[s("i",{staticClass:"fa-solid fa-arrow-rotate-left"}),t._v(" 撤销全部 ")])]),s("confirm-dialog",{attrs:{visible:t.confirmDialog.visible,message:t.confirmDialog.message},on:{confirm:t.executeConfirm,cancel:t.cancelConfirm}})],2)},h=[function(){var e=this,t=e._self._c;return t("a",{staticClass:"header-back",attrs:{href:"/app"}},[t("i",{staticClass:"fa-solid fa-chevron-left"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"empty-state"},[t("div",{staticClass:"empty-icon"},[t("i",{staticClass:"fa-solid fa-folder-open"})]),t("div",{staticClass:"empty-title"},[e._v("非 Git 仓库")]),t("div",{staticClass:"empty-desc"},[e._v("当前目录不是 Git 仓库,无法查看变更")])])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"empty-state"},[t("div",{staticClass:"empty-icon"},[t("i",{staticClass:"fa-solid fa-check"})]),t("div",{staticClass:"empty-title"},[e._v("暂无变更")]),t("div",{staticClass:"empty-desc"},[e._v("工作区干净,没有检测到变更")])])}],u=r(f,o,h,!1,null,"3818a325");const p=u.exports;export{p as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as l}from"./index-
|
|
1
|
+
import{m as l}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|