tianxincode 1.0.48 → 1.0.49
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/README.md +200 -200
- package/dist/cli/commands.js +18 -18
- package/dist/core/ai/agents/caller/prompts/role.txt +50 -50
- package/dist/core/ai/agents/chat/chat.agent.js +30 -30
- package/dist/core/ai/agents/chat/prompts/role.txt +30 -30
- package/dist/core/ai/agents/code/code.agent.js +6 -6
- package/dist/core/ai/agents/code/prompts/role.txt +50 -50
- package/dist/core/ai/agents/common/prompt/role.txt +51 -51
- package/dist/core/ai/agents/common/prompts.js +26 -26
- package/dist/core/ai/agents/design/design.agent.js +6 -6
- package/dist/core/ai/agents/design/prompts/role.txt +36 -36
- package/dist/core/ai/agents/dream/prompts/init.txt +20 -20
- package/dist/core/ai/agents/mem/mem.agent.js +5 -5
- package/dist/core/ai/agents/mem/prompts/role.txt +35 -35
- package/dist/core/ai/agents/skill/prompts/role.txt +61 -61
- package/dist/core/ai/agents/skill/skill.agent.js +26 -26
- package/dist/core/ai/agents/summarizer/prompts/role.txt +30 -30
- package/dist/core/ai/agents/task/prompts/role.txt +50 -50
- package/dist/core/ai/agents/task/task.agent.js +30 -30
- package/dist/core/db/db.service.d.ts.map +1 -1
- package/dist/core/db/db.service.js +2 -0
- package/dist/core/db/db.service.js.map +1 -1
- package/dist/core/db/init_sql/ai_log.init.js +15 -15
- package/dist/core/db/init_sql/code_snippet.init.js +11 -11
- package/dist/core/db/init_sql/config.init.js +15 -15
- package/dist/core/db/init_sql/custom_action.init.js +10 -10
- package/dist/core/db/init_sql/dingding.init.js +9 -9
- package/dist/core/db/init_sql/email.init.js +14 -14
- package/dist/core/db/init_sql/lsp.init.js +8 -8
- package/dist/core/db/init_sql/message_file.init.js +11 -11
- package/dist/core/db/init_sql/project.init.js +20 -20
- package/dist/core/db/init_sql/provider.init.js +35 -35
- package/dist/core/db/init_sql/scheduler.init.js +32 -32
- package/dist/core/db/init_sql/session.init.js +23 -23
- package/dist/core/db/init_sql/spec.init.js +15 -15
- package/dist/core/db/init_sql/waf_gateway.init.js +9 -9
- package/dist/core/db/init_sql/zihao.init.js +11 -11
- package/dist/core/lsp/sql.js +11 -11
- package/dist/core/tools/provider/bash.txt +47 -47
- package/dist/core/tools/provider/code_search.txt +20 -20
- package/dist/core/tools/provider/edit_file.txt +13 -13
- package/dist/core/tools/provider/glob.txt +12 -12
- package/dist/core/tools/provider/grep.txt +14 -14
- package/dist/core/tools/provider/lsp.txt +19 -19
- package/dist/core/tools/provider/memory.txt +21 -21
- package/dist/core/tools/provider/read_file.txt +17 -17
- package/dist/core/tools/provider/todo_read.txt +16 -16
- package/dist/core/tools/provider/todo_write.txt +48 -48
- package/dist/core/tools/provider/web_fetch.txt +17 -17
- package/dist/core/tools/provider/web_search.txt +18 -18
- package/dist/core/tools/provider/write_file.txt +11 -11
- package/dist/gateway/api/skill/detail_skill.d.ts.map +1 -1
- package/dist/gateway/api/skill/detail_skill.js +7 -5
- package/dist/gateway/api/skill/detail_skill.js.map +1 -1
- package/dist/gateway/cli/commands.js +18 -18
- package/dist/modules/ai/agents/chat/prompts/role.txt +30 -30
- package/dist/modules/ai/agents/code/prompts/role.txt +50 -50
- package/dist/modules/ai/agents/mem/prompts/role.txt +35 -35
- package/dist/modules/ai/agents/skill/prompts/role.txt +61 -61
- package/dist/modules/ai/agents/task/prompts/role.txt +50 -50
- package/dist/modules/ai/ai-log.service.js +10 -10
- package/dist/modules/ai/provider/openai/prompt/role.txt +51 -51
- package/dist/modules/ai/summarizer/summarizer.prompts.js +30 -30
- package/dist/modules/config/config.service.js +5 -5
- package/dist/modules/db/db.service.js +252 -252
- package/dist/modules/email/email.config.repository.js +1 -1
- package/dist/modules/repositories/project.repository.d.ts +28 -0
- package/dist/modules/repositories/project.repository.d.ts.map +1 -0
- package/dist/modules/repositories/project.repository.js +47 -0
- package/dist/modules/repositories/project.repository.js.map +1 -0
- package/dist/modules/scheduler/task-log.service.js +1 -1
- package/dist/modules/services/project/project.service.d.ts +14 -0
- package/dist/modules/services/project/project.service.d.ts.map +1 -0
- package/dist/modules/services/project/project.service.js +47 -0
- package/dist/modules/services/project/project.service.js.map +1 -0
- package/dist/modules/skill/skill.txt +36 -36
- package/dist/modules/spec/spec.injector.js +24 -24
- package/dist/modules/tools/provider/bash.txt +47 -47
- package/dist/modules/tools/provider/code_search.txt +20 -20
- package/dist/modules/tools/provider/edit_file.txt +13 -13
- package/dist/modules/tools/provider/glob.txt +12 -12
- package/dist/modules/tools/provider/grep.txt +14 -14
- package/dist/modules/tools/provider/lsp.txt +19 -19
- package/dist/modules/tools/provider/memory.txt +21 -21
- package/dist/modules/tools/provider/read_file.txt +17 -17
- package/dist/modules/tools/provider/todo_read.txt +16 -16
- package/dist/modules/tools/provider/todo_write.txt +48 -48
- package/dist/modules/tools/provider/web_fetch.txt +17 -17
- package/dist/modules/tools/provider/web_search.txt +18 -18
- package/dist/modules/tools/provider/write_file.txt +11 -11
- package/dist/modules/waf-gateway/waf-gateway.module.js +8 -8
- package/dist/modules/waf-gateway/waf-gateway.service.js +12 -12
- package/dist/repositories/project.repository.d.ts +28 -0
- package/dist/repositories/project.repository.d.ts.map +1 -0
- package/dist/repositories/project.repository.js +47 -0
- package/dist/repositories/project.repository.js.map +1 -0
- package/dist/repository/ai_log.repository.js +1 -1
- package/dist/repository/config.repository.js +5 -5
- package/dist/repository/email.repository.js +1 -1
- package/dist/repository/memory.repository.js +1 -1
- package/dist/repository/project.repository.js +3 -3
- package/dist/repository/scheduler.repository.js +2 -2
- package/dist/repository/session.repository.js +1 -1
- package/dist/repository/zihao-config.repository.js +1 -1
- package/dist/services/skill/skill.tool.d.ts.map +1 -1
- package/dist/services/skill/skill.tool.js +6 -1
- package/dist/services/skill/skill.tool.js.map +1 -1
- package/dist/services/skill/skill.txt +36 -36
- package/package.json +76 -76
- package/scripts/copy-txt.js +31 -31
- package/scripts/ink-scroll-demo.tsx +147 -147
- package/tsconfig.test.json +9 -9
- package/web/dist/assets/{ConfirmDialog-B2bVsPFI.js → ConfirmDialog-B03GcCHQ.js} +1 -1
- package/web/dist/assets/PcLayout-CYW3zqcs.css +1 -0
- package/web/dist/assets/{PcLayout-DeXNBHu2.js → PcLayout-ZTdJNg7G.js} +1 -1
- package/web/dist/assets/{aiLogsView-JvjhLmyo.js → aiLogsView-Bt8Xg1Qx.js} +1 -1
- package/web/dist/assets/{cssMode-sYHhwUZh.js → cssMode-CBb6D87U.js} +1 -1
- package/web/dist/assets/{customActionsView-Cvmzxvl4.js → customActionsView-DdjnHzwm.js} +1 -1
- package/web/dist/assets/deployView-CD7ji9IS.css +1 -0
- package/web/dist/assets/{deployView-CjV4ySrf.js → deployView-Cj51_Job.js} +1 -1
- package/web/dist/assets/designView-C3pSX4nP.css +1 -0
- package/web/dist/assets/designView-RT8tKEN9.js +18 -0
- package/web/dist/assets/devWorkflowView-BTozmaiN.js +36 -0
- package/web/dist/assets/devWorkflowView-DYhIfbCB.css +1 -0
- package/web/dist/assets/devWorkflowViewApp-CErbhC2s.css +1 -0
- package/web/dist/assets/{devWorkflowViewApp-DPlFgiS_.js → devWorkflowViewApp-DLslXEq9.js} +3 -3
- package/web/dist/assets/{fileZihao-DvZmuTYu.js → fileZihao-CtZ4bUIH.js} +1 -1
- package/web/dist/assets/{freemarker2-DTyAQBBj.js → freemarker2-CX3jc3l2.js} +1 -1
- package/web/dist/assets/gitChanges-D6QxPcii.css +1 -0
- package/web/dist/assets/{gitChanges-Cpf4HHoF.js → gitChanges-DFRvzL5I.js} +1 -1
- package/web/dist/assets/gitChangesApp-Bjn-MCmr.css +1 -0
- package/web/dist/assets/{gitChangesApp-BOURDd_l.js → gitChangesApp-ZI7-V8oB.js} +2 -2
- package/web/dist/assets/{handlebars-DiWIXxOG.js → handlebars-CTaQD6FN.js} +1 -1
- package/web/dist/assets/{html-BCQWkFzH.js → html-BruJsfYv.js} +1 -1
- package/web/dist/assets/{htmlMode-BbMA34cR.js → htmlMode-wewroXLr.js} +1 -1
- package/web/dist/assets/{index-C_tz4Wda.css → index-C0xmVTIn.css} +1 -1
- package/web/dist/assets/{index-C7axH05o.js → index-Cn73hS12.js} +9 -9
- package/web/dist/assets/{javascript-By4MYHaO.js → javascript-B4ku8P1-.js} +1 -1
- package/web/dist/assets/{jsonMode-5JIz7tDN.js → jsonMode-BIvVuBMG.js} +1 -1
- package/web/dist/assets/{liquid-BQBVii4f.js → liquid-Bo3G0Ep7.js} +1 -1
- package/web/dist/assets/{mdx-Cwk7nqzM.js → mdx-Duv0ylZz.js} +1 -1
- package/web/dist/assets/{mediaChat-DivTDoIv.js → mediaChat-RT7iqqYb.js} +1 -1
- package/web/dist/assets/{python-L_kGfe1T.js → python-CEhCctGm.js} +1 -1
- package/web/dist/assets/{razor-XGuHliMI.js → razor-DPK8nTD7.js} +1 -1
- package/web/dist/assets/{taskView-BcJ3LAxp.js → taskView-sOyebRqn.js} +1 -1
- package/web/dist/assets/{terminalView-q-UKzK0M.js → terminalView-GTYtDlus.js} +2 -2
- package/web/dist/assets/{terminalView-CQVYh6D3.css → terminalView-eZ0agsPP.css} +1 -1
- package/web/dist/assets/{tsMode-SuiD3mJa.js → tsMode-BZvUU1nf.js} +1 -1
- package/web/dist/assets/{typescript-DJcyqRjT.js → typescript-CmEn-k1B.js} +1 -1
- package/web/dist/assets/{wikiView-ygHSGyPp.css → wikiView-C-oqMnJM.css} +1 -1
- package/web/dist/assets/{wikiView-B3GIPUlD.js → wikiView-CRjg-cZ8.js} +1 -1
- package/web/dist/assets/{xml-DQgCzk55.js → xml-bjvdKeyy.js} +1 -1
- package/web/dist/assets/{yaml-DBdEYBPA.js → yaml-N5RXWxJk.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/package.json +28 -28
- package/dist/modules/ai/react/index.d.ts +0 -5
- package/dist/modules/ai/react/index.d.ts.map +0 -1
- package/dist/modules/ai/react/index.js +0 -4
- package/dist/modules/ai/react/index.js.map +0 -1
- package/dist/modules/ai/react/prompt/role.txt +0 -51
- package/dist/modules/ai/react/provider.parser.d.ts +0 -20
- package/dist/modules/ai/react/provider.parser.d.ts.map +0 -1
- package/dist/modules/ai/react/provider.parser.js +0 -88
- package/dist/modules/ai/react/provider.parser.js.map +0 -1
- package/dist/modules/ai/react/react.parser.d.ts +0 -80
- package/dist/modules/ai/react/react.parser.d.ts.map +0 -1
- package/dist/modules/ai/react/react.parser.js +0 -365
- package/dist/modules/ai/react/react.parser.js.map +0 -1
- package/dist/modules/ai/react/react.prompts.d.ts +0 -26
- package/dist/modules/ai/react/react.prompts.d.ts.map +0 -1
- package/dist/modules/ai/react/react.prompts.js +0 -170
- package/dist/modules/ai/react/react.prompts.js.map +0 -1
- package/dist/modules/ai/react/react.types.d.ts +0 -50
- package/dist/modules/ai/react/react.types.d.ts.map +0 -1
- package/dist/modules/ai/react/react.types.js +0 -2
- package/dist/modules/ai/react/react.types.js.map +0 -1
- package/dist/modules/ai/react/react.validator.d.ts +0 -14
- package/dist/modules/ai/react/react.validator.d.ts.map +0 -1
- package/dist/modules/ai/react/react.validator.js +0 -53
- package/dist/modules/ai/react/react.validator.js.map +0 -1
- package/dist/modules/ai/react.agent.d.ts +0 -82
- package/dist/modules/ai/react.agent.d.ts.map +0 -1
- package/dist/modules/ai/react.agent.js +0 -220
- package/dist/modules/ai/react.agent.js.map +0 -1
- package/dist/modules/skill/skill.service.d.ts +0 -72
- package/dist/modules/skill/skill.service.d.ts.map +0 -1
- package/dist/modules/skill/skill.service.js +0 -283
- package/dist/modules/skill/skill.service.js.map +0 -1
- package/dist/modules/tools/builtin/bash.d.ts +0 -3
- package/dist/modules/tools/builtin/bash.d.ts.map +0 -1
- package/dist/modules/tools/builtin/bash.js +0 -126
- package/dist/modules/tools/builtin/bash.js.map +0 -1
- package/dist/modules/tools/builtin/bash.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/bash.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/bash.tool.js +0 -52
- package/dist/modules/tools/builtin/bash.tool.js.map +0 -1
- package/dist/modules/tools/builtin/bash.txt +0 -69
- package/dist/modules/tools/builtin/code_search.d.ts +0 -3
- package/dist/modules/tools/builtin/code_search.d.ts.map +0 -1
- package/dist/modules/tools/builtin/code_search.js +0 -86
- package/dist/modules/tools/builtin/code_search.js.map +0 -1
- package/dist/modules/tools/builtin/code_search.txt +0 -41
- package/dist/modules/tools/builtin/edit-file.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/edit-file.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/edit-file.tool.js +0 -58
- package/dist/modules/tools/builtin/edit-file.tool.js.map +0 -1
- package/dist/modules/tools/builtin/edit_file.d.ts +0 -3
- package/dist/modules/tools/builtin/edit_file.d.ts.map +0 -1
- package/dist/modules/tools/builtin/edit_file.js +0 -105
- package/dist/modules/tools/builtin/edit_file.js.map +0 -1
- package/dist/modules/tools/builtin/edit_file.txt +0 -61
- package/dist/modules/tools/builtin/glob.d.ts +0 -3
- package/dist/modules/tools/builtin/glob.d.ts.map +0 -1
- package/dist/modules/tools/builtin/glob.js +0 -85
- package/dist/modules/tools/builtin/glob.js.map +0 -1
- package/dist/modules/tools/builtin/glob.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/glob.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/glob.tool.js +0 -81
- package/dist/modules/tools/builtin/glob.tool.js.map +0 -1
- package/dist/modules/tools/builtin/glob.txt +0 -33
- package/dist/modules/tools/builtin/grep.d.ts +0 -3
- package/dist/modules/tools/builtin/grep.d.ts.map +0 -1
- package/dist/modules/tools/builtin/grep.js +0 -94
- package/dist/modules/tools/builtin/grep.js.map +0 -1
- package/dist/modules/tools/builtin/grep.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/grep.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/grep.tool.js +0 -96
- package/dist/modules/tools/builtin/grep.tool.js.map +0 -1
- package/dist/modules/tools/builtin/grep.txt +0 -37
- package/dist/modules/tools/builtin/index.d.ts +0 -8
- package/dist/modules/tools/builtin/index.d.ts.map +0 -1
- package/dist/modules/tools/builtin/index.js +0 -80
- package/dist/modules/tools/builtin/index.js.map +0 -1
- package/dist/modules/tools/builtin/lsp.d.ts +0 -7
- package/dist/modules/tools/builtin/lsp.d.ts.map +0 -1
- package/dist/modules/tools/builtin/lsp.js +0 -126
- package/dist/modules/tools/builtin/lsp.js.map +0 -1
- package/dist/modules/tools/builtin/lsp.txt +0 -45
- package/dist/modules/tools/builtin/memory.d.ts +0 -3
- package/dist/modules/tools/builtin/memory.d.ts.map +0 -1
- package/dist/modules/tools/builtin/memory.js +0 -77
- package/dist/modules/tools/builtin/memory.js.map +0 -1
- package/dist/modules/tools/builtin/memory.txt +0 -58
- package/dist/modules/tools/builtin/read-file.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/read-file.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/read-file.tool.js +0 -46
- package/dist/modules/tools/builtin/read-file.tool.js.map +0 -1
- package/dist/modules/tools/builtin/read_file.d.ts +0 -3
- package/dist/modules/tools/builtin/read_file.d.ts.map +0 -1
- package/dist/modules/tools/builtin/read_file.js +0 -107
- package/dist/modules/tools/builtin/read_file.js.map +0 -1
- package/dist/modules/tools/builtin/read_file.txt +0 -38
- package/dist/modules/tools/builtin/todo_read.d.ts +0 -6
- package/dist/modules/tools/builtin/todo_read.d.ts.map +0 -1
- package/dist/modules/tools/builtin/todo_read.js +0 -25
- package/dist/modules/tools/builtin/todo_read.js.map +0 -1
- package/dist/modules/tools/builtin/todo_read.txt +0 -34
- package/dist/modules/tools/builtin/todo_write.d.ts +0 -6
- package/dist/modules/tools/builtin/todo_write.d.ts.map +0 -1
- package/dist/modules/tools/builtin/todo_write.js +0 -46
- package/dist/modules/tools/builtin/todo_write.js.map +0 -1
- package/dist/modules/tools/builtin/todo_write.txt +0 -67
- package/dist/modules/tools/builtin/web_fetch.d.ts +0 -3
- package/dist/modules/tools/builtin/web_fetch.d.ts.map +0 -1
- package/dist/modules/tools/builtin/web_fetch.js +0 -52
- package/dist/modules/tools/builtin/web_fetch.js.map +0 -1
- package/dist/modules/tools/builtin/web_fetch.txt +0 -38
- package/dist/modules/tools/builtin/web_search.d.ts +0 -3
- package/dist/modules/tools/builtin/web_search.d.ts.map +0 -1
- package/dist/modules/tools/builtin/web_search.js +0 -100
- package/dist/modules/tools/builtin/web_search.js.map +0 -1
- package/dist/modules/tools/builtin/web_search.txt +0 -43
- package/dist/modules/tools/builtin/write-file.tool.d.ts +0 -6
- package/dist/modules/tools/builtin/write-file.tool.d.ts.map +0 -1
- package/dist/modules/tools/builtin/write-file.tool.js +0 -38
- package/dist/modules/tools/builtin/write-file.tool.js.map +0 -1
- package/dist/modules/tools/builtin/write_file.d.ts +0 -3
- package/dist/modules/tools/builtin/write_file.d.ts.map +0 -1
- package/dist/modules/tools/builtin/write_file.js +0 -61
- package/dist/modules/tools/builtin/write_file.js.map +0 -1
- package/dist/modules/tools/builtin/write_file.txt +0 -58
- package/dist/modules/tools/provider/openai/tools.d.ts +0 -3
- package/dist/modules/tools/provider/openai/tools.d.ts.map +0 -1
- package/dist/modules/tools/provider/openai/tools.js +0 -212
- package/dist/modules/tools/provider/openai/tools.js.map +0 -1
- package/dist/modules/tools/provider/skill.d.ts +0 -6
- package/dist/modules/tools/provider/skill.d.ts.map +0 -1
- package/dist/modules/tools/provider/skill.js +0 -64
- package/dist/modules/tools/provider/skill.js.map +0 -1
- package/web/dist/assets/PcLayout-L-XuK1oQ.css +0 -1
- package/web/dist/assets/deployView-hCh3_M8H.css +0 -1
- package/web/dist/assets/designView-CqZ75hOS.css +0 -1
- package/web/dist/assets/designView-DrUNRVEE.js +0 -18
- package/web/dist/assets/devWorkflowView-BpdJTMEb.js +0 -36
- package/web/dist/assets/devWorkflowView-D7EKjoLj.css +0 -1
- package/web/dist/assets/devWorkflowViewApp-BYYMIdCm.css +0 -1
- package/web/dist/assets/gitChanges-BYj-Y2K-.css +0 -1
- package/web/dist/assets/gitChangesApp-Btw-XKcP.css +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{n as p,h as g,g as m,w as h,i as v,a as o}from"./index-C7axH05o.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,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=`
|
|
2
2
|
|
|
3
3
|
注意:当前方案是「${this.parentInfo.name}」的子方案,请参考父方案内容。父方案路径:${this.parentInfo.specPath}`);const t=`先在 ${this.specFilePath} 生成方案,先不要修改代码。${s}
|
|
4
4
|
|
|
5
|
-
用户输入: ${e}`;this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:e,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),h.send("chat",{message:t,sessionId:this.sessionId,modelName:this.modelName||void 0})},stopGeneration(){this.sessionId&&(this.isProcessing=!1,this.stopping=!0,h.send("stop",{sessionId:this.sessionId}))},appendCommand(e){var s;this.inputMessage=e+" ",(s=this.$refs.inputField)==null||s.focus()},onFileSelected(e){var s;this.inputMessage=this.inputMessage+e+" ",this.showFileDrawer=!1,(s=this.$refs.inputField)==null||s.focus()},closeAllDrawers(){this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(e){return e?m(e):""},getTodoStatusIcon(e){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[e]||"⬜"},formatToolArgs(e){var s;try{const t=JSON.parse(((s=e==null?void 0:e.function)==null?void 0:s.arguments)||"{}");return t.file_path?t.file_path:t.command?t.command:""}catch{return""}},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var F=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step2-design"},[t("div",{staticClass:"mode-tabs"},[t("button",{staticClass:"tab-btn",class:{active:s.mode==="chat"},on:{click:function(i){s.mode="chat"}}},[t("i",{staticClass:"fa-solid fa-robot"}),s._v(" AI方案助手 ")]),t("button",{staticClass:"tab-btn",class:{active:s.mode==="spec"},on:{click:function(i){s.mode="spec"}}},[t("i",{staticClass:"fa-solid fa-file-alt"}),s._v(" 方案 ")])]),s.mode==="chat"?t("div",{staticClass:"chat-mode"},[t("div",{staticClass:"chat-toolbar"},[t("span",{staticClass:"model-name",on:{click:function(i){s.showModelDrawer=!0}}},[s._v(" "+s._s(s.modelName||"gpt-4o")+" "),t("i",{staticClass:"fa-solid fa-chevron-down"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"})])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[s.logItems.length?s._e():t("div",{staticClass:"empty-state"},[t("p",[s._v("描述你的需求,AI将协助完善方案")])]),s._l(s.logItems,function(i,r){return[i.type==="chat"?t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[s._v(s._s(i.content))])]):i.type==="think"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.content))}})]):i.type==="step"?t("div",{staticClass:"step-block"},[i.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.thought))}})]):s._e(),s._l(i.toolCalls,function(a,n){var l;return t("div",{key:"tc-"+n,staticClass:"tool-log",class:i.success!==!1?"tool-success":"tool-fail"},[t("span",[s._v(s._s(i.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[s._v(s._s(((l=a==null?void 0:a.function)==null?void 0:l.name)||"unknown"))]),t("span",{staticClass:"tool-args"},[s._v(s._s(s.formatToolArgs(a)))])])})],2):i.type==="system"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble system"},[s._v(s._s(i.content))])]):i.type==="todos"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},s._l(i.todos,function(a,n){return t("div",{key:n,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[s._v(s._s(s.getTodoStatusIcon(a.status)))]),t("span",[s._v(s._s(a.name))])])}),0)]):s._e()]}),s.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[s._v("思考中...")])]):s._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"描述需求... (Enter发送)"},domProps:{value:s.inputMessage},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")||i.ctrlKey||i.shiftKey||i.altKey||i.metaKey?null:(i.preventDefault(),s.sendMessage.apply(null,arguments))},input:function(i){i.target.composing||(s.inputMessage=i.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":s.isProcessing},attrs:{disabled:!s.inputMessage.trim()&&!s.isProcessing},on:{click:function(i){s.isProcessing?s.stopGeneration():s.sendMessage()}}},[t("i",{class:s.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"status-bar"},[t("span",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:s.isProcessing}}),s._v(" "+s._s(s.isProcessing?"处理中...":"就绪")+" ")]),t("span",[s._v("Token: "+s._s(s.promptTokens||0))])])]):t("div",{staticClass:"spec-mode"},[t("div",{staticClass:"spec-tabs"},[t("button",{staticClass:"spec-tab-btn",class:{active:s.specView==="edit"},on:{click:function(i){s.specView="edit"}}},[t("i",{staticClass:"fa-solid fa-edit"}),s._v(" 编辑 ")]),t("button",{staticClass:"spec-tab-btn",class:{active:s.specView==="preview"},on:{click:function(i){s.specView="preview"}}},[t("i",{staticClass:"fa-solid fa-eye"}),s._v(" 预览 ")])]),s.specView==="edit"?t("div",{staticClass:"editor-area"},[t("div",{staticClass:"editor-toolbar"},[t("button",{staticClass:"toolbar-btn primary",on:{click:s.saveSpec}},[t("i",{staticClass:"fa-solid fa-save"}),s._v(" 保存 ")])]),t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.specContent,expression:"specContent"}],staticClass:"markdown-editor",attrs:{placeholder:"输入方案内容..."},domProps:{value:s.specContent},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"s",void 0,i.key,void 0)||!i.ctrlKey?null:(i.preventDefault(),s.saveSpec.apply(null,arguments))},input:function(i){i.target.composing||(s.specContent=i.target.value)}}})]):t("div",{staticClass:"preview-area"},[t("div",{staticClass:"preview-content",domProps:{innerHTML:s._s(s.renderedContent)}})])]),t("div",{staticClass:"drawer-overlay",class:{show:s.showModelDrawer||s.showCommandDrawer||s.showFileDrawer},on:{click:s.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:s.showFileDrawer},on:{select:s.onFileSelected,close:function(i){s.showFileDrawer=!1}}}),t("div",{staticClass:"model-drawer",class:{show:s.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},s._l(s.models,function(i){return t("div",{key:i.id,staticClass:"command-item",class:{active:i.name===s.modelName},on:{click:function(r){return s.selectModel(i)}}},[s._m(0,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[s._v(s._s(i.name))]),t("div",{staticClass:"command-desc"},[s._v(s._s(i.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:s.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/compact"),s.showCommandDrawer=!1}}},[s._m(1),s._m(2)]),t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/clear"),s.showCommandDrawer=!1}}},[s._m(3),s._m(4)])])])],1)},T=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-microchip"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("压缩会话")]),s("div",{staticClass:"command-desc"},[e._v("减少上下文长度")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-trash"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("清空对话")]),s("div",{staticClass:"command-desc"},[e._v("清空当前会话内容")])])}],j=p(q,F,T,!1,null,"3caa49bb");const B=j.exports,N={name:"AppStep3Code",components:{FileSelectDrawer:g},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",isProcessing:!1,stopping:!1,logItems:[],sessionId:"",modelName:"",promptTokens:0,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,models:[],logSeq:0,wsUnsubscribe:null}},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(){h.init(),await this.loadModels(),await this.loadDefaultModel(),await this.loadSession()},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{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 loadSession(){var e;if(!this.category||!this.name){this.sessionId="";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.codeSessionId||""}else this.sessionId="";this.sessionId&&(await this.loadMessages(),this.subscribeSession())}catch{this.sessionId=""}},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.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)||"发生错误")}}))},insertGenerateCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案开发相应功能,先不要修改方案文档。`)},async sendMessage(){const e=this.inputMessage.trim();!e||this.isProcessing||!this.sessionId||(this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:e,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),h.send("chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0}))},stopGeneration(){this.sessionId&&(this.isProcessing=!1,this.stopping=!0,h.send("stop",{sessionId:this.sessionId}))},appendCommand(e){var s;this.inputMessage=e+" ",(s=this.$refs.inputField)==null||s.focus()},openFileSelect(){this.showFileDrawer=!0},onFileSelected(e){var s;this.inputMessage=this.inputMessage+e+" ",this.showFileDrawer=!1,(s=this.$refs.inputField)==null||s.focus()},closeAllDrawers(){this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(e){return e?m(e):""},getTodoStatusIcon(e){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[e]||"⬜"},formatToolArgs(e){var s;try{const t=JSON.parse(((s=e==null?void 0:e.function)==null?void 0:s.arguments)||"{}");return t.file_path?t.file_path:t.command?t.command:""}catch{return""}},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var x=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step3-code"},[t("div",{staticClass:"chat-toolbar"},[t("span",{staticClass:"model-name",on:{click:function(i){s.showModelDrawer=!0}}},[s._v(" "+s._s(s.modelName||"gpt-4o")+" "),t("i",{staticClass:"fa-solid fa-chevron-down"})]),t("button",{staticClass:"toolbar-btn",attrs:{disabled:s.isProcessing},on:{click:s.insertGenerateCommand}},[t("i",{staticClass:"fa-solid fa-code"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"})])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[s.logItems.length?s._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-code"}),t("p",[s._v("描述代码需求,AI将生成代码")])]),s._l(s.logItems,function(i,r){return[i.type==="chat"?t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[s._v(s._s(i.content))])]):i.type==="think"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.content))}})]):i.type==="step"?t("div",{staticClass:"step-block"},[i.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.thought))}})]):s._e(),s._l(i.toolCalls,function(a,n){var l;return t("div",{key:"tc-"+n,staticClass:"tool-log",class:i.success!==!1?"tool-success":"tool-fail"},[t("span",[s._v(s._s(i.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[s._v(s._s(((l=a==null?void 0:a.function)==null?void 0:l.name)||"unknown"))]),t("span",{staticClass:"tool-args"},[s._v(s._s(s.formatToolArgs(a)))])])})],2):i.type==="system"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble system"},[s._v(s._s(i.content))])]):i.type==="todos"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},s._l(i.todos,function(a,n){return t("div",{key:n,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[s._v(s._s(s.getTodoStatusIcon(a.status)))]),t("span",[s._v(s._s(a.name))])])}),0)]):s._e()]}),s.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[s._v("生成中...")])]):s._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"描述代码需求... (Enter发送)"},domProps:{value:s.inputMessage},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")||i.ctrlKey||i.shiftKey||i.altKey||i.metaKey?null:(i.preventDefault(),s.sendMessage.apply(null,arguments))},input:function(i){i.target.composing||(s.inputMessage=i.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":s.isProcessing},attrs:{disabled:!s.inputMessage.trim()&&!s.isProcessing},on:{click:function(i){s.isProcessing?s.stopGeneration():s.sendMessage()}}},[t("i",{class:s.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"status-bar"},[t("span",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:s.isProcessing}}),s._v(" "+s._s(s.isProcessing?"生成中...":"就绪")+" ")]),t("span",[s._v("Token: "+s._s(s.promptTokens||0))])]),t("div",{staticClass:"drawer-overlay",class:{show:s.showModelDrawer||s.showCommandDrawer||s.showFileDrawer},on:{click:s.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:s.showFileDrawer},on:{select:s.onFileSelected,close:function(i){s.showFileDrawer=!1}}}),t("div",{staticClass:"model-drawer",class:{show:s.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},s._l(s.models,function(i){return t("div",{key:i.id,staticClass:"command-item",class:{active:i.name===s.modelName},on:{click:function(r){return s.selectModel(i)}}},[s._m(0,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[s._v(s._s(i.name))]),t("div",{staticClass:"command-desc"},[s._v(s._s(i.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:s.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/compact"),s.showCommandDrawer=!1}}},[s._m(1),s._m(2)]),t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/clear"),s.showCommandDrawer=!1}}},[s._m(3),s._m(4)]),t("div",{staticClass:"command-item",on:{click:function(i){s.openFileSelect(),s.showCommandDrawer=!1}}},[s._m(5),s._m(6)])])])],1)},A=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-microchip"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("压缩会话")]),s("div",{staticClass:"command-desc"},[e._v("减少上下文长度")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-trash"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("清空对话")]),s("div",{staticClass:"command-desc"},[e._v("清空当前会话内容")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-file-circle-plus"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("选择文件")]),s("div",{staticClass:"command-desc"},[e._v("添加参考文件到上下文")])])}],R=p(N,x,A,!1,null,"e98624b2");const V=R.exports,U={name:"AppStep4Test",components:{FileSelectDrawer:g},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",isProcessing:!1,stopping:!1,logItems:[],sessionId:"",modelName:"",promptTokens:0,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,models:[],logSeq:0,wsUnsubscribe:null}},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(){h.init(),await this.loadModels(),await this.loadDefaultModel(),await this.loadSession()},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{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 loadSession(){var e;if(!this.category||!this.name){this.sessionId="";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.testSessionId||""}else this.sessionId="";this.sessionId&&(await this.loadMessages(),this.subscribeSession())}catch{this.sessionId=""}},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.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)||"发生错误")}}))},insertTestCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案测试相应功能是否实现。`)},async sendMessage(){const e=this.inputMessage.trim();!e||this.isProcessing||!this.sessionId||(this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:e,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),h.send("chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0}))},stopGeneration(){this.sessionId&&(this.isProcessing=!1,this.stopping=!0,h.send("stop",{sessionId:this.sessionId}))},appendCommand(e){var s;this.inputMessage=e+" ",(s=this.$refs.inputField)==null||s.focus()},openFileSelect(){this.showFileDrawer=!0},onFileSelected(e){var s;this.inputMessage=this.inputMessage+e+" ",this.showFileDrawer=!1,(s=this.$refs.inputField)==null||s.focus()},closeAllDrawers(){this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(e){return e?m(e):""},getTodoStatusIcon(e){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[e]||"⬜"},formatToolArgs(e){var s;try{const t=JSON.parse(((s=e==null?void 0:e.function)==null?void 0:s.arguments)||"{}");return t.file_path?t.file_path:t.command?t.command:""}catch{return""}},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var L=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step4-test"},[t("div",{staticClass:"chat-toolbar"},[t("span",{staticClass:"model-name",on:{click:function(i){s.showModelDrawer=!0}}},[s._v(" "+s._s(s.modelName||"gpt-4o")+" "),t("i",{staticClass:"fa-solid fa-chevron-down"})]),t("button",{staticClass:"toolbar-btn",attrs:{disabled:s.isProcessing},on:{click:s.insertTestCommand}},[t("i",{staticClass:"fa-solid fa-check-circle"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"})])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[s.logItems.length?s._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-clipboard-check"}),t("p",[s._v("描述测试需求,AI将进行验收测试")])]),s._l(s.logItems,function(i,r){return[i.type==="chat"?t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[s._v(s._s(i.content))])]):i.type==="think"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.content))}})]):i.type==="step"?t("div",{staticClass:"step-block"},[i.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.thought))}})]):s._e(),s._l(i.toolCalls,function(a,n){var l;return t("div",{key:"tc-"+n,staticClass:"tool-log",class:i.success!==!1?"tool-success":"tool-fail"},[t("span",[s._v(s._s(i.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[s._v(s._s(((l=a==null?void 0:a.function)==null?void 0:l.name)||"unknown"))]),t("span",{staticClass:"tool-args"},[s._v(s._s(s.formatToolArgs(a)))])])})],2):i.type==="system"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble system"},[s._v(s._s(i.content))])]):i.type==="todos"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},s._l(i.todos,function(a,n){return t("div",{key:n,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[s._v(s._s(s.getTodoStatusIcon(a.status)))]),t("span",[s._v(s._s(a.name))])])}),0)]):s._e()]}),s.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[s._v("测试中...")])]):s._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"描述测试需求... (Enter发送)"},domProps:{value:s.inputMessage},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")||i.ctrlKey||i.shiftKey||i.altKey||i.metaKey?null:(i.preventDefault(),s.sendMessage.apply(null,arguments))},input:function(i){i.target.composing||(s.inputMessage=i.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":s.isProcessing},attrs:{disabled:!s.inputMessage.trim()&&!s.isProcessing},on:{click:function(i){s.isProcessing?s.stopGeneration():s.sendMessage()}}},[t("i",{class:s.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"status-bar"},[t("span",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:s.isProcessing}}),s._v(" "+s._s(s.isProcessing?"测试中...":"就绪")+" ")]),t("span",[s._v("Token: "+s._s(s.promptTokens||0))])]),t("div",{staticClass:"drawer-overlay",class:{show:s.showModelDrawer||s.showCommandDrawer||s.showFileDrawer},on:{click:s.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:s.showFileDrawer},on:{select:s.onFileSelected,close:function(i){s.showFileDrawer=!1}}}),t("div",{staticClass:"model-drawer",class:{show:s.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},s._l(s.models,function(i){return t("div",{key:i.id,staticClass:"command-item",class:{active:i.name===s.modelName},on:{click:function(r){return s.selectModel(i)}}},[s._m(0,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[s._v(s._s(i.name))]),t("div",{staticClass:"command-desc"},[s._v(s._s(i.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:s.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/compact"),s.showCommandDrawer=!1}}},[s._m(1),s._m(2)]),t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/clear"),s.showCommandDrawer=!1}}},[s._m(3),s._m(4)]),t("div",{staticClass:"command-item",on:{click:function(i){s.openFileSelect(),s.showCommandDrawer=!1}}},[s._m(5),s._m(6)])])])],1)},K=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-microchip"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("压缩会话")]),s("div",{staticClass:"command-desc"},[e._v("减少上下文长度")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-trash"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("清空对话")]),s("div",{staticClass:"command-desc"},[e._v("清空当前会话内容")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-file-circle-plus"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("选择文件")]),s("div",{staticClass:"command-desc"},[e._v("添加参考文件到上下文")])])}],O=p(U,L,K,!1,null,"16780a20");const E=O.exports,W={name:"SubSchemeDialogApp",props:{visible:{type:Boolean,default:!1},category:{type:String,default:""},parentName:{type:String,default:""},defaultName:{type:String,default:""}},data(){return{name:""}},watch:{visible(e){e&&(this.name=this.defaultName)}},methods:{onConfirm(){const e=this.name.trim();e&&(this.$emit("confirm",e),this.$emit("update:visible",!1))},onCancel(){this.$emit("cancel"),this.$emit("update:visible",!1)}}};var H=function(){var s=this,t=s._self._c;return t("div",[t("div",{staticClass:"dialog-overlay",class:{show:s.visible},on:{click:s.onCancel}}),t("div",{staticClass:"dialog-sheet",class:{show:s.visible}},[t("div",{staticClass:"dialog-header"},[t("span",{staticClass:"dialog-title"},[s._v("新建子方案")]),t("button",{staticClass:"dialog-close",on:{click:s.onCancel}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"dialog-body"},[t("div",{staticClass:"form-group"},[t("label",[s._v("方案名称")]),t("input",{directives:[{name:"model",rawName:"v-model",value:s.name,expression:"name"}],staticClass:"form-input",attrs:{placeholder:"请输入子方案名称"},domProps:{value:s.name},on:{keyup:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")?null:s.onConfirm.apply(null,arguments)},input:function(i){i.target.composing||(s.name=i.target.value)}}})]),t("div",{staticClass:"form-group"},[t("label",[s._v("所属大类")]),t("div",{staticClass:"form-text"},[s._v(s._s(s.category))])]),t("div",{staticClass:"form-group"},[t("label",[s._v("父方案")]),t("div",{staticClass:"form-text"},[s._v(s._s(s.parentName))])])]),t("div",{staticClass:"dialog-actions"},[t("button",{staticClass:"btn-cancel",on:{click:s.onCancel}},[s._v("取消")]),t("button",{staticClass:"btn-confirm",attrs:{disabled:!s.name.trim()},on:{click:s.onConfirm}},[s._v("确认")])])])])},G=[],J=p(W,H,G,!1,null,"d31752c1");const X=J.exports,z={name:"DevWorkflowViewApp",components:{AppWorkflowStep:$,AppStep1Req:M,AppStep2Design:B,AppStep3Code:V,AppStep4Test:E,SubSchemeDialogApp:X},data(){return{currentCategory:"",currentProject:"",currentStep:1,categories:[],projects:{},reqBasePath:"",subSchemeDialogVisible:!1,subSchemeDefaultName:""}},computed:{projectKey(){return!this.currentCategory||!this.currentProject?"":`${this.currentCategory}/${this.currentProject}`}},async created(){var r,a,n;const e=(r=this.$route.query)==null?void 0:r.category,s=(a=this.$route.query)==null?void 0:a.project,t=parseInt((n=this.$route.query)==null?void 0:n.step)||1,i=!!(e&&s);await this.loadCategories(),i?(this.currentCategory=e,this.currentProject=s,this.currentStep=t):await this.loadState()},watch:{currentProject(e){var t;const s=((t=this.$route.meta)==null?void 0:t.title)||"软件研发";e?document.title=`${e} · ${s} - TXCode`:document.title=`${s} - TXCode`}},methods:{async loadState(){try{const s=(await o.getWorkflowState()).data;s&&(this.currentCategory=s.currentCategory||"",this.currentProject=s.currentProject||"",this.currentStep=s.currentStep||1)}catch(e){console.error("Load workflow state failed:",e)}},async saveState(){try{await o.updateWorkflowState(this.currentCategory,this.currentProject,this.currentStep)}catch(e){console.error("Save workflow state failed:",e)}},async loadCategories(){var e,s;try{const i=((e=(await o.getCwd()).data)==null?void 0:e.current_path)||"";this.reqBasePath=i?`${i}/.txcode/req`:"";const a=((s=(await o.browseFilesystem(this.reqBasePath)).data)==null?void 0:s.items)||[];this.categories=a.filter(n=>n.is_directory).map(n=>n.name),this.categories.sort(),this.currentCategory&&this.categories.includes(this.currentCategory)&&await this.loadProjectsForCategory(this.currentCategory)}catch(t){console.error("Load categories failed:",t),this.categories=[]}},async loadProjectsForCategory(e){var s;if(e)try{const t=`${this.reqBasePath}/${e}`,r=((s=(await o.browseFilesystem(t)).data)==null?void 0:s.items)||[];this.projects={},r.filter(a=>a.is_directory).forEach(a=>{const n=`${e}/${a.name}`;this.projects[n]={name:a.name,stepStatus:{}}})}catch(t){console.error("Load projects failed:",t)}},async onCategoryChange(e){this.currentCategory=e,this.currentProject="",this.currentStep=1,e?await this.loadProjectsForCategory(e):this.projects={},await this.saveState()},onProjectChange(e){this.currentProject=e,this.currentProject?this.currentStep=2:this.currentStep>1&&(this.currentStep=1),this.saveState()},onStepChange(e){!this.currentProject&&e>1||(this.currentStep=e,this.saveState())},async createCategory(e){if(!this.categories.includes(e))try{const s=`${this.reqBasePath}/${e}`;await o.createDirectory(s),this.categories.push(e),this.categories.sort()}catch(s){console.error("Create category failed:",s)}},async createRequirement({category:e,name:s}){var a,n,l;if(this.projects[s])return;try{const c=`${this.reqBasePath}/${e}/${s}`;await o.createDirectory(c)}catch(c){console.error("Create requirement directory failed:",c)}const t=`# ${s}方案
|
|
5
|
+
用户输入: ${e}`;this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:e,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),h.send("chat",{message:t,sessionId:this.sessionId,modelName:this.modelName||void 0})},stopGeneration(){this.sessionId&&(this.isProcessing=!1,this.stopping=!0,h.send("stop",{sessionId:this.sessionId}))},appendCommand(e){var s;this.inputMessage=e+" ",(s=this.$refs.inputField)==null||s.focus()},onFileSelected(e){var s;this.inputMessage=this.inputMessage+e+" ",this.showFileDrawer=!1,(s=this.$refs.inputField)==null||s.focus()},closeAllDrawers(){this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(e){return e?m(e):""},getTodoStatusIcon(e){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[e]||"⬜"},formatToolArgs(e){var s;try{const t=JSON.parse(((s=e==null?void 0:e.function)==null?void 0:s.arguments)||"{}");return t.file_path?t.file_path:t.command?t.command:""}catch{return""}},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var F=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step2-design"},[t("div",{staticClass:"mode-tabs"},[t("button",{staticClass:"tab-btn",class:{active:s.mode==="chat"},on:{click:function(i){s.mode="chat"}}},[t("i",{staticClass:"fa-solid fa-robot"}),s._v(" AI方案助手 ")]),t("button",{staticClass:"tab-btn",class:{active:s.mode==="spec"},on:{click:function(i){s.mode="spec"}}},[t("i",{staticClass:"fa-solid fa-file-alt"}),s._v(" 方案 ")])]),s.mode==="chat"?t("div",{staticClass:"chat-mode"},[t("div",{staticClass:"chat-toolbar"},[t("span",{staticClass:"model-name",on:{click:function(i){s.showModelDrawer=!0}}},[s._v(" "+s._s(s.modelName||"gpt-4o")+" "),t("i",{staticClass:"fa-solid fa-chevron-down"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"})])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[s.logItems.length?s._e():t("div",{staticClass:"empty-state"},[t("p",[s._v("描述你的需求,AI将协助完善方案")])]),s._l(s.logItems,function(i,r){return[i.type==="chat"?t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[s._v(s._s(i.content))])]):i.type==="think"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.content))}})]):i.type==="step"?t("div",{staticClass:"step-block"},[i.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.thought))}})]):s._e(),s._l(i.toolCalls,function(a,n){var l;return t("div",{key:"tc-"+n,staticClass:"tool-log",class:i.success!==!1?"tool-success":"tool-fail"},[t("span",[s._v(s._s(i.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[s._v(s._s(((l=a==null?void 0:a.function)==null?void 0:l.name)||"unknown"))]),t("span",{staticClass:"tool-args"},[s._v(s._s(s.formatToolArgs(a)))])])})],2):i.type==="system"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble system"},[s._v(s._s(i.content))])]):i.type==="todos"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},s._l(i.todos,function(a,n){return t("div",{key:n,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[s._v(s._s(s.getTodoStatusIcon(a.status)))]),t("span",[s._v(s._s(a.name))])])}),0)]):s._e()]}),s.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[s._v("思考中...")])]):s._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"描述需求... (Enter发送)"},domProps:{value:s.inputMessage},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")||i.ctrlKey||i.shiftKey||i.altKey||i.metaKey?null:(i.preventDefault(),s.sendMessage.apply(null,arguments))},input:function(i){i.target.composing||(s.inputMessage=i.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":s.isProcessing},attrs:{disabled:!s.inputMessage.trim()&&!s.isProcessing},on:{click:function(i){s.isProcessing?s.stopGeneration():s.sendMessage()}}},[t("i",{class:s.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"status-bar"},[t("span",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:s.isProcessing}}),s._v(" "+s._s(s.isProcessing?"处理中...":"就绪")+" ")]),t("span",[s._v("Token: "+s._s(s.promptTokens||0))])])]):t("div",{staticClass:"spec-mode"},[t("div",{staticClass:"spec-tabs"},[t("button",{staticClass:"spec-tab-btn",class:{active:s.specView==="edit"},on:{click:function(i){s.specView="edit"}}},[t("i",{staticClass:"fa-solid fa-edit"}),s._v(" 编辑 ")]),t("button",{staticClass:"spec-tab-btn",class:{active:s.specView==="preview"},on:{click:function(i){s.specView="preview"}}},[t("i",{staticClass:"fa-solid fa-eye"}),s._v(" 预览 ")])]),s.specView==="edit"?t("div",{staticClass:"editor-area"},[t("div",{staticClass:"editor-toolbar"},[t("button",{staticClass:"toolbar-btn primary",on:{click:s.saveSpec}},[t("i",{staticClass:"fa-solid fa-save"}),s._v(" 保存 ")])]),t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.specContent,expression:"specContent"}],staticClass:"markdown-editor",attrs:{placeholder:"输入方案内容..."},domProps:{value:s.specContent},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"s",void 0,i.key,void 0)||!i.ctrlKey?null:(i.preventDefault(),s.saveSpec.apply(null,arguments))},input:function(i){i.target.composing||(s.specContent=i.target.value)}}})]):t("div",{staticClass:"preview-area"},[t("div",{staticClass:"preview-content",domProps:{innerHTML:s._s(s.renderedContent)}})])]),t("div",{staticClass:"drawer-overlay",class:{show:s.showModelDrawer||s.showCommandDrawer||s.showFileDrawer},on:{click:s.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:s.showFileDrawer},on:{select:s.onFileSelected,close:function(i){s.showFileDrawer=!1}}}),t("div",{staticClass:"model-drawer",class:{show:s.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},s._l(s.models,function(i){return t("div",{key:i.id,staticClass:"command-item",class:{active:i.name===s.modelName},on:{click:function(r){return s.selectModel(i)}}},[s._m(0,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[s._v(s._s(i.name))]),t("div",{staticClass:"command-desc"},[s._v(s._s(i.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:s.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/compact"),s.showCommandDrawer=!1}}},[s._m(1),s._m(2)]),t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/clear"),s.showCommandDrawer=!1}}},[s._m(3),s._m(4)])])])],1)},T=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-microchip"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("压缩会话")]),s("div",{staticClass:"command-desc"},[e._v("减少上下文长度")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-trash"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("清空对话")]),s("div",{staticClass:"command-desc"},[e._v("清空当前会话内容")])])}],j=p(q,F,T,!1,null,"8d203a9e");const B=j.exports,N={name:"AppStep3Code",components:{FileSelectDrawer:g},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",isProcessing:!1,stopping:!1,logItems:[],sessionId:"",modelName:"",promptTokens:0,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,models:[],logSeq:0,wsUnsubscribe:null}},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(){h.init(),await this.loadModels(),await this.loadDefaultModel(),await this.loadSession()},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{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 loadSession(){var e;if(!this.category||!this.name){this.sessionId="";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.codeSessionId||""}else this.sessionId="";this.sessionId&&(await this.loadMessages(),this.subscribeSession())}catch{this.sessionId=""}},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.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)||"发生错误")}}))},insertGenerateCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案开发相应功能,先不要修改方案文档。`)},async sendMessage(){const e=this.inputMessage.trim();!e||this.isProcessing||!this.sessionId||(this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:e,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),h.send("chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0}))},stopGeneration(){this.sessionId&&(this.isProcessing=!1,this.stopping=!0,h.send("stop",{sessionId:this.sessionId}))},appendCommand(e){var s;this.inputMessage=e+" ",(s=this.$refs.inputField)==null||s.focus()},openFileSelect(){this.showFileDrawer=!0},onFileSelected(e){var s;this.inputMessage=this.inputMessage+e+" ",this.showFileDrawer=!1,(s=this.$refs.inputField)==null||s.focus()},closeAllDrawers(){this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(e){return e?m(e):""},getTodoStatusIcon(e){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[e]||"⬜"},formatToolArgs(e){var s;try{const t=JSON.parse(((s=e==null?void 0:e.function)==null?void 0:s.arguments)||"{}");return t.file_path?t.file_path:t.command?t.command:""}catch{return""}},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var x=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step3-code"},[t("div",{staticClass:"chat-toolbar"},[t("span",{staticClass:"model-name",on:{click:function(i){s.showModelDrawer=!0}}},[s._v(" "+s._s(s.modelName||"gpt-4o")+" "),t("i",{staticClass:"fa-solid fa-chevron-down"})]),t("button",{staticClass:"toolbar-btn",attrs:{disabled:s.isProcessing},on:{click:s.insertGenerateCommand}},[t("i",{staticClass:"fa-solid fa-code"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"})])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[s.logItems.length?s._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-code"}),t("p",[s._v("描述代码需求,AI将生成代码")])]),s._l(s.logItems,function(i,r){return[i.type==="chat"?t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[s._v(s._s(i.content))])]):i.type==="think"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.content))}})]):i.type==="step"?t("div",{staticClass:"step-block"},[i.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.thought))}})]):s._e(),s._l(i.toolCalls,function(a,n){var l;return t("div",{key:"tc-"+n,staticClass:"tool-log",class:i.success!==!1?"tool-success":"tool-fail"},[t("span",[s._v(s._s(i.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[s._v(s._s(((l=a==null?void 0:a.function)==null?void 0:l.name)||"unknown"))]),t("span",{staticClass:"tool-args"},[s._v(s._s(s.formatToolArgs(a)))])])})],2):i.type==="system"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble system"},[s._v(s._s(i.content))])]):i.type==="todos"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},s._l(i.todos,function(a,n){return t("div",{key:n,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[s._v(s._s(s.getTodoStatusIcon(a.status)))]),t("span",[s._v(s._s(a.name))])])}),0)]):s._e()]}),s.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[s._v("生成中...")])]):s._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"描述代码需求... (Enter发送)"},domProps:{value:s.inputMessage},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")||i.ctrlKey||i.shiftKey||i.altKey||i.metaKey?null:(i.preventDefault(),s.sendMessage.apply(null,arguments))},input:function(i){i.target.composing||(s.inputMessage=i.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":s.isProcessing},attrs:{disabled:!s.inputMessage.trim()&&!s.isProcessing},on:{click:function(i){s.isProcessing?s.stopGeneration():s.sendMessage()}}},[t("i",{class:s.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"status-bar"},[t("span",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:s.isProcessing}}),s._v(" "+s._s(s.isProcessing?"生成中...":"就绪")+" ")]),t("span",[s._v("Token: "+s._s(s.promptTokens||0))])]),t("div",{staticClass:"drawer-overlay",class:{show:s.showModelDrawer||s.showCommandDrawer||s.showFileDrawer},on:{click:s.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:s.showFileDrawer},on:{select:s.onFileSelected,close:function(i){s.showFileDrawer=!1}}}),t("div",{staticClass:"model-drawer",class:{show:s.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},s._l(s.models,function(i){return t("div",{key:i.id,staticClass:"command-item",class:{active:i.name===s.modelName},on:{click:function(r){return s.selectModel(i)}}},[s._m(0,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[s._v(s._s(i.name))]),t("div",{staticClass:"command-desc"},[s._v(s._s(i.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:s.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/compact"),s.showCommandDrawer=!1}}},[s._m(1),s._m(2)]),t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/clear"),s.showCommandDrawer=!1}}},[s._m(3),s._m(4)]),t("div",{staticClass:"command-item",on:{click:function(i){s.openFileSelect(),s.showCommandDrawer=!1}}},[s._m(5),s._m(6)])])])],1)},A=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-microchip"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("压缩会话")]),s("div",{staticClass:"command-desc"},[e._v("减少上下文长度")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-trash"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("清空对话")]),s("div",{staticClass:"command-desc"},[e._v("清空当前会话内容")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-file-circle-plus"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("选择文件")]),s("div",{staticClass:"command-desc"},[e._v("添加参考文件到上下文")])])}],R=p(N,x,A,!1,null,"2bceec20");const V=R.exports,U={name:"AppStep4Test",components:{FileSelectDrawer:g},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",isProcessing:!1,stopping:!1,logItems:[],sessionId:"",modelName:"",promptTokens:0,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,models:[],logSeq:0,wsUnsubscribe:null}},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(){h.init(),await this.loadModels(),await this.loadDefaultModel(),await this.loadSession()},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{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 loadSession(){var e;if(!this.category||!this.name){this.sessionId="";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.testSessionId||""}else this.sessionId="";this.sessionId&&(await this.loadMessages(),this.subscribeSession())}catch{this.sessionId=""}},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.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)||"发生错误")}}))},insertTestCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案测试相应功能是否实现。`)},async sendMessage(){const e=this.inputMessage.trim();!e||this.isProcessing||!this.sessionId||(this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:e,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),h.send("chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0}))},stopGeneration(){this.sessionId&&(this.isProcessing=!1,this.stopping=!0,h.send("stop",{sessionId:this.sessionId}))},appendCommand(e){var s;this.inputMessage=e+" ",(s=this.$refs.inputField)==null||s.focus()},openFileSelect(){this.showFileDrawer=!0},onFileSelected(e){var s;this.inputMessage=this.inputMessage+e+" ",this.showFileDrawer=!1,(s=this.$refs.inputField)==null||s.focus()},closeAllDrawers(){this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(e){return e?m(e):""},getTodoStatusIcon(e){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[e]||"⬜"},formatToolArgs(e){var s;try{const t=JSON.parse(((s=e==null?void 0:e.function)==null?void 0:s.arguments)||"{}");return t.file_path?t.file_path:t.command?t.command:""}catch{return""}},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var L=function(){var s=this,t=s._self._c;return t("div",{staticClass:"step4-test"},[t("div",{staticClass:"chat-toolbar"},[t("span",{staticClass:"model-name",on:{click:function(i){s.showModelDrawer=!0}}},[s._v(" "+s._s(s.modelName||"gpt-4o")+" "),t("i",{staticClass:"fa-solid fa-chevron-down"})]),t("button",{staticClass:"toolbar-btn",attrs:{disabled:s.isProcessing},on:{click:s.insertTestCommand}},[t("i",{staticClass:"fa-solid fa-check-circle"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})]),t("button",{staticClass:"toolbar-btn",on:{click:function(i){s.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"})])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[s.logItems.length?s._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-clipboard-check"}),t("p",[s._v("描述测试需求,AI将进行验收测试")])]),s._l(s.logItems,function(i,r){return[i.type==="chat"?t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[s._v(s._s(i.content))])]):i.type==="think"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.content))}})]):i.type==="step"?t("div",{staticClass:"step-block"},[i.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:s._s(s.renderMarkdown(i.thought))}})]):s._e(),s._l(i.toolCalls,function(a,n){var l;return t("div",{key:"tc-"+n,staticClass:"tool-log",class:i.success!==!1?"tool-success":"tool-fail"},[t("span",[s._v(s._s(i.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[s._v(s._s(((l=a==null?void 0:a.function)==null?void 0:l.name)||"unknown"))]),t("span",{staticClass:"tool-args"},[s._v(s._s(s.formatToolArgs(a)))])])})],2):i.type==="system"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble system"},[s._v(s._s(i.content))])]):i.type==="todos"?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},s._l(i.todos,function(a,n){return t("div",{key:n,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[s._v(s._s(s.getTodoStatusIcon(a.status)))]),t("span",[s._v(s._s(a.name))])])}),0)]):s._e()]}),s.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[s._v("测试中...")])]):s._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"描述测试需求... (Enter发送)"},domProps:{value:s.inputMessage},on:{keydown:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")||i.ctrlKey||i.shiftKey||i.altKey||i.metaKey?null:(i.preventDefault(),s.sendMessage.apply(null,arguments))},input:function(i){i.target.composing||(s.inputMessage=i.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":s.isProcessing},attrs:{disabled:!s.inputMessage.trim()&&!s.isProcessing},on:{click:function(i){s.isProcessing?s.stopGeneration():s.sendMessage()}}},[t("i",{class:s.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"status-bar"},[t("span",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:s.isProcessing}}),s._v(" "+s._s(s.isProcessing?"测试中...":"就绪")+" ")]),t("span",[s._v("Token: "+s._s(s.promptTokens||0))])]),t("div",{staticClass:"drawer-overlay",class:{show:s.showModelDrawer||s.showCommandDrawer||s.showFileDrawer},on:{click:s.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:s.showFileDrawer},on:{select:s.onFileSelected,close:function(i){s.showFileDrawer=!1}}}),t("div",{staticClass:"model-drawer",class:{show:s.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},s._l(s.models,function(i){return t("div",{key:i.id,staticClass:"command-item",class:{active:i.name===s.modelName},on:{click:function(r){return s.selectModel(i)}}},[s._m(0,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[s._v(s._s(i.name))]),t("div",{staticClass:"command-desc"},[s._v(s._s(i.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:s.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title"},[s._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(i){s.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/compact"),s.showCommandDrawer=!1}}},[s._m(1),s._m(2)]),t("div",{staticClass:"command-item",on:{click:function(i){s.appendCommand("/clear"),s.showCommandDrawer=!1}}},[s._m(3),s._m(4)]),t("div",{staticClass:"command-item",on:{click:function(i){s.openFileSelect(),s.showCommandDrawer=!1}}},[s._m(5),s._m(6)])])])],1)},K=[function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-microchip"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("压缩会话")]),s("div",{staticClass:"command-desc"},[e._v("减少上下文长度")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-trash"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("清空对话")]),s("div",{staticClass:"command-desc"},[e._v("清空当前会话内容")])])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-icon"},[s("i",{staticClass:"fa-solid fa-file-circle-plus"})])},function(){var e=this,s=e._self._c;return s("div",{staticClass:"command-info"},[s("div",{staticClass:"command-name"},[e._v("选择文件")]),s("div",{staticClass:"command-desc"},[e._v("添加参考文件到上下文")])])}],O=p(U,L,K,!1,null,"32cf5f82");const E=O.exports,W={name:"SubSchemeDialogApp",props:{visible:{type:Boolean,default:!1},category:{type:String,default:""},parentName:{type:String,default:""},defaultName:{type:String,default:""}},data(){return{name:""}},watch:{visible(e){e&&(this.name=this.defaultName)}},methods:{onConfirm(){const e=this.name.trim();e&&(this.$emit("confirm",e),this.$emit("update:visible",!1))},onCancel(){this.$emit("cancel"),this.$emit("update:visible",!1)}}};var H=function(){var s=this,t=s._self._c;return t("div",[t("div",{staticClass:"dialog-overlay",class:{show:s.visible},on:{click:s.onCancel}}),t("div",{staticClass:"dialog-sheet",class:{show:s.visible}},[t("div",{staticClass:"dialog-header"},[t("span",{staticClass:"dialog-title"},[s._v("新建子方案")]),t("button",{staticClass:"dialog-close",on:{click:s.onCancel}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"dialog-body"},[t("div",{staticClass:"form-group"},[t("label",[s._v("方案名称")]),t("input",{directives:[{name:"model",rawName:"v-model",value:s.name,expression:"name"}],staticClass:"form-input",attrs:{placeholder:"请输入子方案名称"},domProps:{value:s.name},on:{keyup:function(i){return!i.type.indexOf("key")&&s._k(i.keyCode,"enter",13,i.key,"Enter")?null:s.onConfirm.apply(null,arguments)},input:function(i){i.target.composing||(s.name=i.target.value)}}})]),t("div",{staticClass:"form-group"},[t("label",[s._v("所属大类")]),t("div",{staticClass:"form-text"},[s._v(s._s(s.category))])]),t("div",{staticClass:"form-group"},[t("label",[s._v("父方案")]),t("div",{staticClass:"form-text"},[s._v(s._s(s.parentName))])])]),t("div",{staticClass:"dialog-actions"},[t("button",{staticClass:"btn-cancel",on:{click:s.onCancel}},[s._v("取消")]),t("button",{staticClass:"btn-confirm",attrs:{disabled:!s.name.trim()},on:{click:s.onConfirm}},[s._v("确认")])])])])},G=[],J=p(W,H,G,!1,null,"5af5fd68");const X=J.exports,z={name:"DevWorkflowViewApp",components:{AppWorkflowStep:$,AppStep1Req:M,AppStep2Design:B,AppStep3Code:V,AppStep4Test:E,SubSchemeDialogApp:X},data(){return{currentCategory:"",currentProject:"",currentStep:1,categories:[],projects:{},reqBasePath:"",subSchemeDialogVisible:!1,subSchemeDefaultName:""}},computed:{projectKey(){return!this.currentCategory||!this.currentProject?"":`${this.currentCategory}/${this.currentProject}`}},async created(){var r,a,n;const e=(r=this.$route.query)==null?void 0:r.category,s=(a=this.$route.query)==null?void 0:a.project,t=parseInt((n=this.$route.query)==null?void 0:n.step)||1,i=!!(e&&s);await this.loadCategories(),i?(this.currentCategory=e,this.currentProject=s,this.currentStep=t):await this.loadState()},watch:{currentProject(e){var t;const s=((t=this.$route.meta)==null?void 0:t.title)||"软件研发";e?document.title=`${e} · ${s} - TXCode`:document.title=`${s} - TXCode`}},methods:{async loadState(){try{const s=(await o.getWorkflowState()).data;s&&(this.currentCategory=s.currentCategory||"",this.currentProject=s.currentProject||"",this.currentStep=s.currentStep||1)}catch(e){console.error("Load workflow state failed:",e)}},async saveState(){try{await o.updateWorkflowState(this.currentCategory,this.currentProject,this.currentStep)}catch(e){console.error("Save workflow state failed:",e)}},async loadCategories(){var e,s;try{const i=((e=(await o.getCwd()).data)==null?void 0:e.current_path)||"";this.reqBasePath=i?`${i}/.txcode/req`:"";const a=((s=(await o.browseFilesystem(this.reqBasePath)).data)==null?void 0:s.items)||[];this.categories=a.filter(n=>n.is_directory).map(n=>n.name),this.categories.sort(),this.currentCategory&&this.categories.includes(this.currentCategory)&&await this.loadProjectsForCategory(this.currentCategory)}catch(t){console.error("Load categories failed:",t),this.categories=[]}},async loadProjectsForCategory(e){var s;if(e)try{const t=`${this.reqBasePath}/${e}`,r=((s=(await o.browseFilesystem(t)).data)==null?void 0:s.items)||[];this.projects={},r.filter(a=>a.is_directory).forEach(a=>{const n=`${e}/${a.name}`;this.projects[n]={name:a.name,stepStatus:{}}})}catch(t){console.error("Load projects failed:",t)}},async onCategoryChange(e){this.currentCategory=e,this.currentProject="",this.currentStep=1,e?await this.loadProjectsForCategory(e):this.projects={},await this.saveState()},onProjectChange(e){this.currentProject=e,this.currentProject?this.currentStep=2:this.currentStep>1&&(this.currentStep=1),this.saveState()},onStepChange(e){!this.currentProject&&e>1||(this.currentStep=e,this.saveState())},async createCategory(e){if(!this.categories.includes(e))try{const s=`${this.reqBasePath}/${e}`;await o.createDirectory(s),this.categories.push(e),this.categories.sort()}catch(s){console.error("Create category failed:",s)}},async createRequirement({category:e,name:s}){var a,n,l;if(this.projects[s])return;try{const c=`${this.reqBasePath}/${e}/${s}`;await o.createDirectory(c)}catch(c){console.error("Create requirement directory failed:",c)}const t=`# ${s}方案
|
|
6
6
|
|
|
7
7
|
> 所属大类:${e}
|
|
8
8
|
|
|
@@ -23,4 +23,4 @@ import{n as p,h as g,g as m,w as h,i as v,a as o}from"./index-C7axH05o.js";const
|
|
|
23
23
|
|
|
24
24
|
## 功能点
|
|
25
25
|
|
|
26
|
-
`;try{const d=`${this.reqBasePath}/${t}/${e}/${e}_方案.md`;await o.writeFile(d,r)}catch(d){console.error("Write spec file failed:",d)}let a={designSessionId:"",codeSessionId:"",testSessionId:""};try{const[d,f,C]=await Promise.all([o.createSession(`workflow:${t}/${e}:design`),o.createSession(`workflow:${t}/${e}:code`),o.createSession(`workflow:${t}/${e}:test`)]);a={designSessionId:((l=d.data)==null?void 0:l.id)||"",codeSessionId:((c=f.data)==null?void 0:c.id)||"",testSessionId:((u=C.data)==null?void 0:u.id)||"",parent:{name:s,specPath:i}};const _=`${this.reqBasePath}/${t}/${e}/session.json`;await o.writeFile(_,JSON.stringify(a,null,2))}catch(d){console.error("Create sessions failed:",d)}const n=`${t}/${e}`;this.$set(this.projects,n,{name:e,stepStatus:{}}),this.$router.push({path:"/views/app/DevWorkflowViewApp",query:{category:t,project:e,step:2}})},async onSaveSpec(e){if(!this.projectKey)return;const s=`${this.reqBasePath}/${this.currentCategory}/${this.currentProject}/${this.currentProject}_方案.md`;try{await o.writeFile(s,e)}catch(t){console.error("Save spec failed:",t)}},async refreshSpec(){this.currentCategory&&this.currentProject&&await this.loadProjectsForCategory(this.currentCategory)}}};var Q=function(){var s=this,t=s._self._c;return t("div",{staticClass:"dev-workflow-view"},[t("AppWorkflowStep",{attrs:{"current-step":s.currentStep},on:{"step-change":s.onStepChange}}),s.currentStep===2&&s.currentProject?t("div",{staticClass:"step-toolbar"},[t("button",{staticClass:"btn-sub-scheme",on:{click:s.createSubScheme}},[t("i",{staticClass:"fa-solid fa-plus"}),s._v(" 新建子方案 ")])]):s._e(),t("div",{staticClass:"step-content"},[s.currentStep===1?t("AppStep1Req",{attrs:{categories:s.categories,projects:s.projects,"req-base-path":s.reqBasePath,"current-category":s.currentCategory,"current-project":s.currentProject},on:{"category-change":s.onCategoryChange,"project-change":s.onProjectChange,"create-category":s.createCategory,"create-requirement":s.createRequirement}}):s.currentStep===2?t("AppStep2Design",{attrs:{category:s.currentCategory,name:s.currentProject,"req-base-path":s.reqBasePath},on:{"save-spec":s.onSaveSpec,"spec-updated":s.refreshSpec}}):s.currentStep===3?t("AppStep3Code",{attrs:{category:s.currentCategory,name:s.currentProject,"req-base-path":s.reqBasePath}}):s.currentStep===4?t("AppStep4Test",{attrs:{category:s.currentCategory,name:s.currentProject,"req-base-path":s.reqBasePath}}):s._e()],1),t("div",{staticClass:"status-bar"},[s.projectKey?t("span",[s._v(s._s(s.projectKey))]):t("span",[s._v("选择需求开始")])]),t("SubSchemeDialogApp",{attrs:{visible:s.subSchemeDialogVisible,category:s.currentCategory,"parent-name":s.currentProject,"default-name":s.subSchemeDefaultName},on:{"update:visible":function(i){s.subSchemeDialogVisible=i},confirm:s.onSubSchemeConfirm,cancel:function(i){s.subSchemeDialogVisible=!1}}})],1)},Y=[],Z=p(z,Q,Y,!1,null,"
|
|
26
|
+
`;try{const d=`${this.reqBasePath}/${t}/${e}/${e}_方案.md`;await o.writeFile(d,r)}catch(d){console.error("Write spec file failed:",d)}let a={designSessionId:"",codeSessionId:"",testSessionId:""};try{const[d,f,C]=await Promise.all([o.createSession(`workflow:${t}/${e}:design`),o.createSession(`workflow:${t}/${e}:code`),o.createSession(`workflow:${t}/${e}:test`)]);a={designSessionId:((l=d.data)==null?void 0:l.id)||"",codeSessionId:((c=f.data)==null?void 0:c.id)||"",testSessionId:((u=C.data)==null?void 0:u.id)||"",parent:{name:s,specPath:i}};const _=`${this.reqBasePath}/${t}/${e}/session.json`;await o.writeFile(_,JSON.stringify(a,null,2))}catch(d){console.error("Create sessions failed:",d)}const n=`${t}/${e}`;this.$set(this.projects,n,{name:e,stepStatus:{}}),this.$router.push({path:"/views/app/DevWorkflowViewApp",query:{category:t,project:e,step:2}})},async onSaveSpec(e){if(!this.projectKey)return;const s=`${this.reqBasePath}/${this.currentCategory}/${this.currentProject}/${this.currentProject}_方案.md`;try{await o.writeFile(s,e)}catch(t){console.error("Save spec failed:",t)}},async refreshSpec(){this.currentCategory&&this.currentProject&&await this.loadProjectsForCategory(this.currentCategory)}}};var Q=function(){var s=this,t=s._self._c;return t("div",{staticClass:"dev-workflow-view"},[t("AppWorkflowStep",{attrs:{"current-step":s.currentStep},on:{"step-change":s.onStepChange}}),s.currentStep===2&&s.currentProject?t("div",{staticClass:"step-toolbar"},[t("button",{staticClass:"btn-sub-scheme",on:{click:s.createSubScheme}},[t("i",{staticClass:"fa-solid fa-plus"}),s._v(" 新建子方案 ")])]):s._e(),t("div",{staticClass:"step-content"},[s.currentStep===1?t("AppStep1Req",{attrs:{categories:s.categories,projects:s.projects,"req-base-path":s.reqBasePath,"current-category":s.currentCategory,"current-project":s.currentProject},on:{"category-change":s.onCategoryChange,"project-change":s.onProjectChange,"create-category":s.createCategory,"create-requirement":s.createRequirement}}):s.currentStep===2?t("AppStep2Design",{attrs:{category:s.currentCategory,name:s.currentProject,"req-base-path":s.reqBasePath},on:{"save-spec":s.onSaveSpec,"spec-updated":s.refreshSpec}}):s.currentStep===3?t("AppStep3Code",{attrs:{category:s.currentCategory,name:s.currentProject,"req-base-path":s.reqBasePath}}):s.currentStep===4?t("AppStep4Test",{attrs:{category:s.currentCategory,name:s.currentProject,"req-base-path":s.reqBasePath}}):s._e()],1),t("div",{staticClass:"status-bar"},[s.projectKey?t("span",[s._v(s._s(s.projectKey))]):t("span",[s._v("选择需求开始")])]),t("SubSchemeDialogApp",{attrs:{visible:s.subSchemeDialogVisible,category:s.currentCategory,"parent-name":s.currentProject,"default-name":s.subSchemeDefaultName},on:{"update:visible":function(i){s.subSchemeDialogVisible=i},confirm:s.onSubSchemeConfirm,cancel:function(i){s.subSchemeDialogVisible=!1}}})],1)},Y=[],Z=p(z,Q,Y,!1,null,"9d2a2db4");const es=Z.exports;export{es as default};
|
|
@@ -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-Cn73hS12.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-Cn73hS12.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-45b2ddc3]::-webkit-scrollbar{width:8px}.sidebar-scroll[data-v-45b2ddc3]::-webkit-scrollbar-track{background:transparent}.sidebar-scroll[data-v-45b2ddc3]::-webkit-scrollbar-thumb{background:#404040;border-radius:4px}.sidebar-scroll[data-v-45b2ddc3]::-webkit-scrollbar-thumb:hover{background:#505050}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n,e as o,K as c,d,a as r}from"./index-
|
|
1
|
+
import{n,e as o,K as c,d,a as r}from"./index-Cn73hS12.js";import{C as f}from"./ConfirmDialog-B03GcCHQ.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-[#2a2a2a] transition-colors",class:t.selectedPath===i.path?"bg-[#2a2a2a] 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-gray-200 truncate",attrs:{title:i.path}},[t._v(" "+t._s(t.getFileName(i.path))+" ")]),e("div",{staticClass:"text-xs text-gray-500 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-gray-500 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-gray-500 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,"45b2ddc3");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-[#1a1a1a] text-blue-400":s.removed?"bg-red-900/50 text-red-300":s.added?"bg-green-900/50 text-green-300":s.empty?"bg-[#252525]":"text-gray-200"},parseDiff(s){if(this.oldLines=[],this.newLines=[],!s)return;const t=s.split(`
|
|
2
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-[#3c3c3c] border-b border-border text-xs text-gray-300 font-bold"},[t._v(" 旧版本 (Original) ")]),e("div",{staticClass:"flex-1 overflow-auto bg-[#2d2d2d]"},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-[#3c3c3c] border-b border-border text-xs text-gray-300 font-bold"},[t._v(" 新版本 (Modified) ")]),e("div",{staticClass:"flex-1 overflow-auto bg-[#2d2d2d]"},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-gray-400 hover:text-white",on:{click:t.close}},[e("i",{staticClass:"fa-solid fa-times text-lg"})])]),e("div",{staticClass:"flex-1 overflow-hidden bg-[#1e1e1e]"},[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-gray-400"},[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,D={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 S=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)},F=[],j=n(D,S,F,!1,null,null);const z=j.exports;export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.git-changes-app[data-v-3818a325]{display:flex;flex-direction:column;height:100vh;max-width:430px;margin:0 auto;background:var(--bg-primary, #0a0a09)}.header[data-v-3818a325]{background:var(--bg-secondary, #121212);padding:12px 16px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border-color, #27272a);flex-shrink:0}.header-back[data-v-3818a325]{color:var(--text-muted, #84848a);font-size:18px;text-decoration:none;padding:8px;margin:-8px}.header-title[data-v-3818a325]{font-size:16px;font-weight:500}.header-actions[data-v-3818a325]{display:flex;gap:8px}.header-btn[data-v-3818a325]{color:var(--text-muted, #84848a);font-size:16px;padding:8px;background:none;border:none;cursor:pointer;transition:color .2s}.header-btn[data-v-3818a325]:hover{color:var(--text-primary, #f4f4f5)}.change-summary[data-v-3818a325]{background:var(--bg-secondary, #121212);padding:12px 16px;border-bottom:1px solid var(--border-color, #27272a);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.summary-stats[data-v-3818a325]{display:flex;gap:16px}.stat-item[data-v-3818a325]{display:flex;align-items:center;gap:6px;font-size:13px}.stat-item.add[data-v-3818a325]{color:var(--success, #22c55e)}.stat-item.mod[data-v-3818a325]{color:var(--warning, #f59e0b)}.stat-item.del[data-v-3818a325]{color:var(--danger, #ef4444)}.branch-info[data-v-3818a325]{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted, #84848a)}.branch-info i[data-v-3818a325]{color:var(--accent, #3b82f6)}.tab-bar[data-v-3818a325]{background:var(--bg-secondary, #121212);padding:0 16px;display:flex;gap:24px;border-bottom:1px solid var(--border-color, #27272a);flex-shrink:0}.tab-item[data-v-3818a325]{padding:12px 0;font-size:14px;color:var(--text-muted, #84848a);border-bottom:2px solid transparent;cursor:pointer;transition:all .2s}.tab-item.active[data-v-3818a325]{color:var(--text-primary, #f4f4f5);border-bottom-color:var(--accent, #3b82f6)}.tab-item .count[data-v-3818a325]{margin-left:6px;font-size:12px;padding:2px 6px;background:var(--bg-tertiary, #18191b);border-radius:10px}.tab-item.active .count[data-v-3818a325]{background:var(--accent, #3b82f6);color:#fff}.filter-bar[data-v-3818a325]{background:var(--bg-secondary, #121212);padding:8px 16px;display:flex;gap:8px;border-bottom:1px solid var(--border-color, #27272a);flex-shrink:0;overflow-x:auto}.filter-bar[data-v-3818a325]::-webkit-scrollbar{display:none}.filter-chip[data-v-3818a325]{padding:6px 12px;font-size:12px;border-radius:16px;border:1px solid var(--border-color, #27272a);background:transparent;color:var(--text-muted, #84848a);cursor:pointer;white-space:nowrap;transition:all .2s;flex-shrink:0}.filter-chip.active[data-v-3818a325]{background:var(--accent, #3b82f6);border-color:var(--accent, #3b82f6);color:#fff}.file-list[data-v-3818a325]{flex:1;overflow-y:auto}.change-item[data-v-3818a325]{display:flex;align-items:center;padding:14px 16px;gap:12px;border-bottom:1px solid var(--border-color, #27272a);transition:background .2s;cursor:pointer}.change-item[data-v-3818a325]:active{background:var(--bg-secondary, #121212)}.change-item:active .change-name[data-v-3818a325],.change-item:active .change-path[data-v-3818a325]{color:var(--text-secondary, #d4d4d8)}.change-item.selected[data-v-3818a325]{background:var(--bg-secondary, #121212);border-left:3px solid var(--accent, #3b82f6);padding-left:13px}.change-item.selected .change-name[data-v-3818a325],.change-item.selected .change-path[data-v-3818a325]{color:var(--text-primary, #f4f4f5)}.change-status[data-v-3818a325]{width:24px;height:24px;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;flex-shrink:0}.change-status.add[data-v-3818a325]{background:#22c55e26;color:#22c55e}.change-status.mod[data-v-3818a325]{background:#f59e0b26;color:#f59e0b}.change-status.del[data-v-3818a325]{background:#ef444426;color:#ef4444}.change-status.new[data-v-3818a325]{background:#3b82f626;color:#3b82f6}.change-info[data-v-3818a325]{flex:1;min-width:0}.change-name[data-v-3818a325]{font-size:14px;font-weight:500;margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#f4f4f5}.change-path[data-v-3818a325]{font-size:12px;color:#84848a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.change-stats[data-v-3818a325]{font-size:11px;color:var(--text-muted, #84848a);text-align:right;flex-shrink:0}.change-stats .add-line[data-v-3818a325]{color:var(--success, #22c55e)}.change-stats .del-line[data-v-3818a325]{color:var(--danger, #ef4444)}.diff-view[data-v-3818a325]{flex:1;overflow-y:auto;background:var(--bg-tertiary, #18191b);display:flex;flex-direction:column}.diff-header[data-v-3818a325]{background:var(--bg-secondary, #121212);padding:10px 16px;border-bottom:1px solid var(--border-color, #27272a);font-size:13px;color:var(--text-secondary, #d4d4d8);display:flex;align-items:center;gap:8px;flex-shrink:0;position:sticky;top:0;z-index:1}.diff-content[data-v-3818a325]{padding:8px 0;font-family:SF Mono,Fira Code,Monaco,Consolas,monospace;font-size:12px;line-height:1.5;flex:1;overflow-y:auto}.diff-loading[data-v-3818a325]{display:flex;align-items:center;justify-content:center;gap:8px;padding:20px;color:#84848a}.loading-spinner[data-v-3818a325]{width:14px;height:14px;border:2px solid #27272a;border-top-color:#3b82f6;border-radius:50%;animation:spin-3818a325 .8s linear infinite}@keyframes spin-3818a325{to{transform:rotate(360deg)}}.diff-line[data-v-3818a325]{display:flex;padding:2px 12px;white-space:pre-wrap;word-break:break-all;color:#d4d4d8}.diff-line.add[data-v-3818a325]{background:#22c55e33}.diff-line.add .line-sign[data-v-3818a325]{color:#22c55e}.diff-line.add .line-text[data-v-3818a325]{color:#4ade80}.diff-line.del[data-v-3818a325]{background:#ef444433}.diff-line.del .line-sign[data-v-3818a325]{color:#ef4444}.diff-line.del .line-text[data-v-3818a325]{color:#f87171}.diff-line.context[data-v-3818a325],.diff-line.context .line-text[data-v-3818a325]{color:#9ca3af}.diff-line.header[data-v-3818a325]{background:#121212;color:#3b82f6}.diff-line.header .line-text[data-v-3818a325]{color:#3b82f6}.line-num[data-v-3818a325]{width:40px;text-align:right;padding-right:12px;color:#6b7280;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0}.line-sign[data-v-3818a325]{width:16px;text-align:center;flex-shrink:0;color:#9ca3af}.line-sign.add[data-v-3818a325]{color:#22c55e}.line-sign.del[data-v-3818a325]{color:#ef4444}.line-text[data-v-3818a325]{flex:1}.empty-state[data-v-3818a325]{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;text-align:center}.empty-icon[data-v-3818a325]{width:80px;height:80px;background:var(--bg-secondary, #121212);border-radius:50%;display:flex;align-items:center;justify-content:center;margin-bottom:20px}.empty-icon i[data-v-3818a325]{font-size:32px;color:var(--text-muted, #84848a)}.empty-title[data-v-3818a325]{font-size:16px;font-weight:500;margin-bottom:8px}.empty-desc[data-v-3818a325]{font-size:14px;color:var(--text-muted, #84848a)}.bottom-actions[data-v-3818a325]{background:var(--bg-secondary, #121212);border-top:1px solid var(--border-color, #27272a);padding:12px 16px;padding-bottom:max(12px,env(safe-area-inset-bottom));display:flex;gap:12px;flex-shrink:0}.action-btn[data-v-3818a325]{flex:1;padding:12px;border-radius:8px;font-size:14px;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:all .2s}.action-btn[data-v-3818a325]:active{transform:scale(.98)}.action-btn[data-v-3818a325]:disabled{opacity:.5;cursor:not-allowed}.action-btn.primary[data-v-3818a325]{background:var(--accent, #3b82f6);color:#fff}.action-btn.danger[data-v-3818a325]{background:#ef444426;color:var(--danger, #ef4444)}.action-btn.secondary[data-v-3818a325]{background:var(--bg-tertiary, #18191b);color:var(--text-primary, #f4f4f5);border:1px solid var(--border-color, #27272a)}.drawer-overlay[data-v-3818a325]{position:fixed;top:0;left:0;right:0;bottom:0;background:#00000080;opacity:0;visibility:hidden;transition:all .3s;z-index:999}.drawer-overlay.show[data-v-3818a325]{opacity:1;visibility:visible}.commit-drawer[data-v-3818a325]{position:fixed;bottom:0;left:0;right:0;max-width:430px;margin:0 auto;background:var(--bg-secondary, #121212);border-radius:16px 16px 0 0;transform:translateY(100%);transition:transform .3s ease;z-index:1000;max-height:70vh;display:flex;flex-direction:column}.commit-drawer.show[data-v-3818a325]{transform:translateY(0)}.drawer-header[data-v-3818a325]{padding:16px;border-bottom:1px solid var(--border-color, #27272a);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.drawer-title[data-v-3818a325]{font-size:16px;font-weight:500}.drawer-close[data-v-3818a325]{width:32px;height:32px;border-radius:50%;background:var(--bg-tertiary, #18191b);border:none;color:var(--text-muted, #84848a);font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center}.commit-form[data-v-3818a325]{padding:16px;overflow-y:auto}.form-group[data-v-3818a325]{margin-bottom:16px}.form-group label[data-v-3818a325]{display:block;font-size:14px;color:var(--text-secondary, #d4d4d8);margin-bottom:8px}.form-group textarea[data-v-3818a325]{width:100%;padding:12px;background:var(--bg-tertiary, #18191b);border:1px solid var(--border-color, #27272a);border-radius:8px;color:var(--text-primary, #f4f4f5);font-size:14px;resize:none;outline:none}.form-group textarea[data-v-3818a325]:focus{border-color:var(--accent, #3b82f6)}.form-group textarea[data-v-3818a325]::-moz-placeholder{color:var(--text-muted, #84848a)}.form-group textarea[data-v-3818a325]::placeholder{color:var(--text-muted, #84848a)}.commit-preview[data-v-3818a325]{background:var(--bg-tertiary, #18191b);border-radius:8px;padding:12px;margin-bottom:16px}.preview-title[data-v-3818a325]{font-size:13px;color:var(--text-muted, #84848a);margin-bottom:8px}.preview-stats[data-v-3818a325]{display:flex;gap:16px}.submit-btn[data-v-3818a325]{width:100%;padding:14px;background:var(--accent, #3b82f6);border:none;border-radius:10px;color:#fff;font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px}.submit-btn[data-v-3818a325]:disabled{opacity:.5;cursor:not-allowed}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as r,a as n}from"./index-
|
|
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,"
|
|
1
|
+
import{n as r,a as n}from"./index-Cn73hS12.js";import{C as d}from"./ConfirmDialog-B03GcCHQ.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
|
+
`);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-Cn73hS12.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as s}from"./index-
|
|
1
|
+
import{m as s}from"./index-Cn73hS12.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as lt}from"./index-
|
|
1
|
+
import{m as lt}from"./index-Cn73hS12.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|