tianxincode 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/api/config.routes.js +16 -0
  2. package/dist/api/config.routes.js.map +1 -1
  3. package/dist/modules/ai/deepseek.provider.d.ts +1 -0
  4. package/dist/modules/ai/deepseek.provider.d.ts.map +1 -1
  5. package/dist/modules/ai/deepseek.provider.js +6 -2
  6. package/dist/modules/ai/deepseek.provider.js.map +1 -1
  7. package/dist/modules/ai/openai.provider.d.ts +1 -0
  8. package/dist/modules/ai/openai.provider.d.ts.map +1 -1
  9. package/dist/modules/ai/openai.provider.js +6 -2
  10. package/dist/modules/ai/openai.provider.js.map +1 -1
  11. package/dist/modules/ai/provider.d.ts.map +1 -1
  12. package/dist/modules/ai/provider.js +20 -0
  13. package/dist/modules/ai/provider.js.map +1 -1
  14. package/dist/modules/config/config.service.d.ts +3 -1
  15. package/dist/modules/config/config.service.d.ts.map +1 -1
  16. package/dist/modules/config/config.service.js +36 -0
  17. package/dist/modules/config/config.service.js.map +1 -1
  18. package/dist/modules/config/config.types.d.ts +6 -0
  19. package/dist/modules/config/config.types.d.ts.map +1 -1
  20. package/dist/modules/config/config.types.js.map +1 -1
  21. package/dist/modules/db/db.service.d.ts +1 -0
  22. package/dist/modules/db/db.service.d.ts.map +1 -1
  23. package/dist/modules/db/db.service.js +16 -0
  24. package/dist/modules/db/db.service.js.map +1 -1
  25. package/dist/modules/gateway/gateway.service.d.ts.map +1 -1
  26. package/dist/modules/gateway/gateway.service.js +0 -6
  27. package/dist/modules/gateway/gateway.service.js.map +1 -1
  28. package/dist/service/config-export-import.service.d.ts +6 -0
  29. package/dist/service/config-export-import.service.d.ts.map +1 -1
  30. package/dist/service/config-export-import.service.js +12 -0
  31. package/dist/service/config-export-import.service.js.map +1 -1
  32. package/package.json +2 -1
  33. package/web/dist/assets/{AiLogsView-DyWYCMia.js → AiLogsView-D4q7SeY_.js} +1 -1
  34. package/web/dist/assets/{ConfirmDialog-B7xoYLNo.js → ConfirmDialog-BG4cU7oU.js} +1 -1
  35. package/web/dist/assets/{CustomActionsView-Bz0FJhS4.js → CustomActionsView-DTvj_4OE.js} +1 -1
  36. package/web/dist/assets/{DevWorkflowView-CU2_o5uq.js → DevWorkflowView-BjUv5lsU.js} +1 -1
  37. package/web/dist/assets/{DevWorkflowViewApp-pt4oKglX.js → DevWorkflowViewApp-D8czrLj2.js} +1 -1
  38. package/web/dist/assets/{GitChanges-Y__3euKt.js → GitChanges-DxJT8Ng9.js} +1 -1
  39. package/web/dist/assets/{GitChangesApp-n1OxZEvL.js → GitChangesApp-DGRKqsrc.js} +1 -1
  40. package/web/dist/assets/{Layout-CilYY1KK.js → Layout-CIntssMR.js} +1 -1
  41. package/web/dist/assets/{TasksView-CHnpwvyb.js → TasksView-DuTglEsf.js} +1 -1
  42. package/web/dist/assets/{TerminalView-C3s5BbKP.js → TerminalView-RG937_-M.js} +1 -1
  43. package/web/dist/assets/{WikiView-B10BVOEI.js → WikiView-wDIfjQT_.js} +1 -1
  44. package/web/dist/assets/{cssMode-D518Vum_.js → cssMode-DAdY-5X0.js} +1 -1
  45. package/web/dist/assets/{deployView-D4BgJiy-.js → deployView-OlhJU698.js} +1 -1
  46. package/web/dist/assets/{fileZihao-BQ2XDoAg.js → fileZihao-Bm-uB2BS.js} +1 -1
  47. package/web/dist/assets/{freemarker2-DRNJ6FYB.js → freemarker2-OIgEfGdK.js} +1 -1
  48. package/web/dist/assets/{handlebars-mubTvOO1.js → handlebars-CwUrtebj.js} +1 -1
  49. package/web/dist/assets/{html-DS4rz_hZ.js → html-DplPIfs6.js} +1 -1
  50. package/web/dist/assets/{htmlMode-D87cKX8Z.js → htmlMode-BpbIfVaE.js} +1 -1
  51. package/web/dist/assets/{index-BQkX4XfJ.css → index-D4xhVePW.css} +1 -1
  52. package/web/dist/assets/{index-dOZe8hsN.js → index-Dtkc_ka-.js} +50 -50
  53. package/web/dist/assets/{javascript-DyGvY_0Y.js → javascript-B_eZzRqF.js} +1 -1
  54. package/web/dist/assets/{jsonMode-ixGH1Eb2.js → jsonMode-9MZfSMtt.js} +1 -1
  55. package/web/dist/assets/{liquid-BgvfOJcH.js → liquid-Q68k40m8.js} +1 -1
  56. package/web/dist/assets/{mdx-DUbMPmbc.js → mdx-BH-rWx_x.js} +1 -1
  57. package/web/dist/assets/{python-CYK0c6tb.js → python-DvT3SN5P.js} +1 -1
  58. package/web/dist/assets/{razor-CC84D436.js → razor-C2wZYTc7.js} +1 -1
  59. package/web/dist/assets/{tsMode-C-wonHgC.js → tsMode-Cm8eLc0y.js} +1 -1
  60. package/web/dist/assets/{typescript-DzuJLwji.js → typescript-B5qDQjhx.js} +1 -1
  61. package/web/dist/assets/{xml-CMPFw__l.js → xml-CZxclJkM.js} +1 -1
  62. package/web/dist/assets/{yaml-BYzkFta5.js → yaml-BAVixhgZ.js} +1 -1
  63. package/web/dist/index.html +2 -2
@@ -1 +1 @@
1
- import{n as l,a as r}from"./index-dOZe8hsN.js";const n={name:"SelectProjectDialog",props:{visible:{type:Boolean,default:!1}},data(){return{dialogVisible:!1,drives:[],currentPath:"",parentPath:null,items:[],selectedPath:"",projectName:"",loading:!1}},watch:{visible(s){this.dialogVisible=s,s&&this.loadDrives()},dialogVisible(s){this.$emit("update:visible",s)}},methods:{async loadDrives(){console.log("[SelectProjectDialog] loading drives...");try{const s=await r.getDrives();if(console.log("[SelectProjectDialog] drives response:",s),this.drives=s.data.items||[],console.log("[SelectProjectDialog] drives:",this.drives),this.drives.length>0){const e=this.drives[0];console.log("[SelectProjectDialog] firstDrive:",e),await this.browse(e.path||"/")}else await this.browse("/")}catch(s){console.error("加载盘符失败:",s),this.$message.error("加载盘符失败: "+s.message)}},async browse(s){try{const t=(await r.browseFilesystem(s)).data;this.currentPath=t.current_path,this.parentPath=t.parent_path,this.items=t.items||[]}catch(e){console.error("浏览目录失败:",e),this.$message.error("浏览目录失败: "+e.message)}},async selectDrive(s){await this.browse(s)},async selectFolder(s){if(s.is_directory){this.selectedPath=s.path;const e=s.path.replace(/\\/g,"/").split("/");this.projectName=e.filter(t=>t).pop()||"",await this.browse(s.path)}},async goToParent(){this.parentPath&&await this.browse(this.parentPath)},handleClose(){this.dialogVisible=!1,this.resetState()},resetState(){this.selectedPath="",this.projectName="",this.items=[],this.currentPath="",this.parentPath=null},async handleConfirm(){var s;if(!(!this.selectedPath||!this.projectName)){this.loading=!0;try{const e=await r.createProject(this.projectName,this.selectedPath,""),t=(s=e.data)==null?void 0:s.id;t&&(await r.setCurrentProject(t),this.$message.success("项目创建并切换成功"),this.$emit("success",e.data),this.handleClose())}catch(e){console.error("创建项目失败:",e),this.$message.error("创建项目失败: "+e.message)}finally{this.loading=!1}}}}};var c=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"选择项目文件夹",visible:e.dialogVisible,width:"600px","close-on-click-modal":!1,"append-to-body":""},on:{"update:visible":function(a){e.dialogVisible=a},close:e.handleClose}},[t("div",{staticClass:"select-project-dialog"},[e.drives.length>0?t("div",{staticClass:"drive-nav"},e._l(e.drives,function(a){return t("el-button",{key:a.path,attrs:{size:"mini",type:e.currentPath.startsWith(a.path)?"primary":""},on:{click:function(i){return e.selectDrive(a.path)}}},[e._v(" "+e._s(a.name)+" ")])}),1):e._e(),t("div",{staticClass:"file-list-container"},[t("div",{staticClass:"current-path"},[t("span",{staticClass:"path-label"},[e._v("当前路径:")]),t("span",{staticClass:"path-value"},[e._v(e._s(e.currentPath))])]),e.items.length>0?t("div",{staticClass:"file-list"},[e.parentPath?t("div",{staticClass:"file-item parent",on:{click:e.goToParent}},[t("i",{staticClass:"fa-solid fa-arrow-up"}),t("span",[e._v("上一级")])]):e._e(),e._l(e.items.filter(a=>a.is_directory),function(a){return t("div",{key:a.path,staticClass:"file-item",class:{selected:e.selectedPath===a.path},on:{click:function(i){return e.selectFolder(a)}}},[t("i",{staticClass:"fa-solid fa-folder"}),t("span",{staticClass:"file-name"},[e._v(e._s(a.name))])])}),e._l(e.items.filter(a=>!a.is_directory),function(a){return t("div",{key:a.path,staticClass:"file-item file-only"},[t("i",{staticClass:"fa-solid fa-file"}),t("span",{staticClass:"file-name"},[e._v(e._s(a.name))])])})],2):t("div",{staticClass:"empty-tip"},[t("span",[e._v("该目录为空")])])]),t("div",{staticClass:"底部状态栏"},[t("div",{staticClass:"selected-info"},[t("span",[e._v("已选择: "+e._s(e.selectedPath||"未选择"))])]),t("div",{staticClass:"project-name-input"},[t("span",[e._v("项目名称:")]),t("el-input",{staticStyle:{width:"200px"},attrs:{placeholder:"请输入项目名称",size:"small"},model:{value:e.projectName,callback:function(a){e.projectName=a},expression:"projectName"}})],1)])]),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary",disabled:!e.selectedPath||!e.projectName,loading:e.loading},on:{click:e.handleConfirm}},[e._v(" 确 定 ")])],1)])},d=[],h=l(n,c,d,!1,null,"e30d3bc8");const f=h.exports,u={name:"Layout",components:{SelectProjectDialog:f},data(){return{sidebarVisible:!0,showSessionDropdown:!1,sessions:[],currentSessionId:null,currentSessionName:"",projects:[],currentProject:null,selectProjectDialogVisible:!1,systemVersion:""}},methods:{toggleSidebar(){this.sidebarVisible=!this.sidebarVisible},toggleSessionDropdown(){this.showSessionDropdown=!this.showSessionDropdown},async switchSession(s){this.currentSessionId=s.id,this.currentSessionName=s.title,this.showSessionDropdown=!1,this.$route.params.id!==s.id&&this.$router.push({name:"chat-session",params:{id:s.id}}).catch(()=>{})},async createNewSession(){try{const s=await r.createSession("新会话");this.sessions.unshift(s.data),this.switchSession(s.data),this.showSessionDropdown=!1}catch(s){this.$message.error("创建会话失败: "+s.message)}},async loadSessions(){try{const s=await r.getSessions();this.sessions=s.data||[],this.sessions.length>0&&!this.currentSessionId&&(this.currentSessionId=this.sessions[0].id,this.currentSessionName=this.sessions[0].title)}catch(s){console.error("加载会话失败:",s)}},async loadProjects(){try{const s=await r.getProjects();this.projects=s.data||[];const e=await r.getCurrentProject();this.currentProject=e.data||null}catch(s){console.error("加载项目失败:",s)}},async handleProjectChange(s){if(s==="__open__"){const e=this.$el.querySelector(".el-dropdown");e&&e.click(),this.selectProjectDialogVisible=!0;return}try{await r.setCurrentProject(s);const e=this.projects.find(t=>t.id===s);e&&(this.currentProject=e),location.reload()}catch(e){this.$message.error("切换项目失败: "+e.message)}},handleProjectDialogSuccess(s){this.currentProject=s,this.loadProjects().then(()=>{location.reload()})},async loadSystemVersion(){var s;try{const e=await r.getSystemInfo();this.systemVersion=((s=e.data)==null?void 0:s.version)||""}catch(e){console.error("获取版本号失败:",e)}}},async created(){await this.loadProjects(),await this.loadSessions(),this.loadSystemVersion(),document.addEventListener("click",s=>{this.$el.contains(s.target)||(this.showSessionDropdown=!1)})}};var b=function(){var a;var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col h-screen overflow-hidden"},[t("header",{staticClass:"h-10 bg-sidebar border-b border-black flex items-center justify-between px-4 shrink-0 z-20"},[t("div",{staticClass:"flex items-center gap-4"},[e._m(0),t("div",{staticClass:"relative"},[t("a",{staticClass:"hover:text-white px-3 py-1 rounded border border-transparent hover:border-accent transition-colors cursor-pointer",class:e.$route.name==="devWorkflow"?"text-accent border-accent":"text-gray-400",attrs:{href:"/#/views/pc/devWorkflow",target:"_blank"}},[t("i",{staticClass:"fa-solid fa-laptop-code mr-1"}),e._v(" 软件研发 ")])]),t("div",{staticClass:"relative"},[t("router-link",{staticClass:"hover:text-white px-3 py-1 rounded border border-transparent hover:border-accent transition-colors cursor-pointer",class:e.$route.name==="deploy"?"text-accent border-accent":"text-gray-400",attrs:{to:"/views/pc/deploy"}},[t("i",{staticClass:"fa-solid fa-rocket mr-1"}),e._v(" 部署 ")])],1)]),t("div",{staticClass:"flex items-center gap-3"},[e.projects.length>0?t("el-dropdown",{attrs:{trigger:"click"},on:{command:e.handleProjectChange}},[t("span",{staticClass:"text-white text-sm cursor-pointer hover:text-accent"},[t("i",{staticClass:"fa-solid fa-folder mr-1"}),e._v(" "+e._s(((a=e.currentProject)==null?void 0:a.name)||"选择项目")+" "),t("i",{staticClass:"fa-solid fa-chevron-down ml-1 text-xs"})]),t("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e._l(e.projects,function(i){var o;return t("el-dropdown-item",{key:i.id,attrs:{command:i.id}},[t("span",{class:i.id===((o=e.currentProject)==null?void 0:o.id)?"text-accent":""},[e._v(e._s(i.name))])])}),t("el-dropdown-item",{attrs:{divided:"",command:"__open__"}},[t("i",{staticClass:"fa-solid fa-folder-open mr-1"}),e._v(" 打开项目文件夹 ")])],2)],1):e._e(),t("SelectProjectDialog",{attrs:{visible:e.selectProjectDialogVisible},on:{"update:visible":function(i){e.selectProjectDialogVisible=i},success:e.handleProjectDialogSuccess}}),e.systemVersion?t("span",{staticClass:"text-xs text-textMuted"},[e._v("v"+e._s(e.systemVersion))]):e._e(),e._m(1),t("button",{directives:[{name:"show",rawName:"v-show",value:e.$route.name==="chat",expression:"$route.name === 'chat'"}],staticClass:"hover:text-white",attrs:{title:e.sidebarVisible?"关闭侧栏":"显示侧栏"},on:{click:e.toggleSidebar}},[t("i",{staticClass:"fa-solid fa-columns"})])],1)]),t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("nav",{staticClass:"w-12 bg-activityBar flex flex-col items-center py-2 shrink-0 border-r border-black z-10 justify-between"},[t("div",{staticClass:"flex flex-col items-center w-full"},[t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center relative",class:e.$route.name==="codeView"||e.$route.name==="codeView-session"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/codeView",title:"工作台"}},[t("i",{staticClass:"fa-regular fa-comments text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="files"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/files",title:"文件"}},[t("i",{staticClass:"fa-solid fa-folder-open text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="gitChanges"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/git-changes",title:"Git 变更"}},[t("i",{staticClass:"fa-brands fa-git-alt text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="terminal"||e.$route.name==="terminal-session"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/terminal",title:"终端"}},[t("i",{staticClass:"fa-solid fa-terminal text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center relative",class:e.$route.name==="skills"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/skills",title:"Skill 管理"}},[t("i",{staticClass:"fa-solid fa-shapes text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="db"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/db",title:"数据库"}},[t("i",{staticClass:"fa-solid fa-database text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="tasks"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/tasks",title:"任务"}},[t("i",{staticClass:"fa-solid fa-clock text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="aiLogs"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/aiLogs",title:"AI 日志"}},[t("i",{staticClass:"fa-solid fa-robot text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="wiki"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/wiki",title:"文档"}},[t("i",{staticClass:"fa-solid fa-book text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="fileZihao"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/fileZihao",title:"文件梓豪"}},[t("i",{staticClass:"fa-solid fa-server text-xl"})])],1),t("div",{staticClass:"flex flex-col items-center w-full mb-2"},[t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="settings"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent hover:bg-white/5",attrs:{to:"/views/pc/settings",title:"设置"}},[t("i",{staticClass:"fa-solid fa-gear text-xl"})])],1)]),t("keep-alive",{attrs:{include:["CodeView","TerminalView","Files"]}},[t("router-view",{staticClass:"flex-1 flex overflow-hidden",attrs:{"sidebar-visible":e.sidebarVisible},on:{"toggle-sidebar":e.toggleSidebar}})],1)],1),e._m(2)])},p=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"font-bold text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-robot text-accent"}),e("span",[s._v("TXCode Agent")])])},function(){var s=this,e=s._self._c;return e("span",{staticClass:"text-xs text-textMuted mr-2"},[e("i",{staticClass:"fa-solid fa-circle text-green-500 text-[8px]"}),s._v(" Server Connected")])},function(){var s=this,e=s._self._c;return e("footer",{staticClass:"h-6 bg-accent text-white text-xs flex items-center justify-between px-3 shrink-0 z-20"},[e("div",{staticClass:"flex items-center gap-4"},[e("span",[e("i",{staticClass:"fa-solid fa-code-branch"}),s._v(" main")])]),e("div",{staticClass:"flex items-center gap-4"},[e("span",[s._v("TXCode")]),e("span",[s._v("UTF-8")])])])}],m=l(u,b,p,!1,null,null);const x=m.exports;export{x as default};
1
+ import{n as l,a as r}from"./index-Dtkc_ka-.js";const n={name:"SelectProjectDialog",props:{visible:{type:Boolean,default:!1}},data(){return{dialogVisible:!1,drives:[],currentPath:"",parentPath:null,items:[],selectedPath:"",projectName:"",loading:!1}},watch:{visible(s){this.dialogVisible=s,s&&this.loadDrives()},dialogVisible(s){this.$emit("update:visible",s)}},methods:{async loadDrives(){console.log("[SelectProjectDialog] loading drives...");try{const s=await r.getDrives();if(console.log("[SelectProjectDialog] drives response:",s),this.drives=s.data.items||[],console.log("[SelectProjectDialog] drives:",this.drives),this.drives.length>0){const e=this.drives[0];console.log("[SelectProjectDialog] firstDrive:",e),await this.browse(e.path||"/")}else await this.browse("/")}catch(s){console.error("加载盘符失败:",s),this.$message.error("加载盘符失败: "+s.message)}},async browse(s){try{const t=(await r.browseFilesystem(s)).data;this.currentPath=t.current_path,this.parentPath=t.parent_path,this.items=t.items||[]}catch(e){console.error("浏览目录失败:",e),this.$message.error("浏览目录失败: "+e.message)}},async selectDrive(s){await this.browse(s)},async selectFolder(s){if(s.is_directory){this.selectedPath=s.path;const e=s.path.replace(/\\/g,"/").split("/");this.projectName=e.filter(t=>t).pop()||"",await this.browse(s.path)}},async goToParent(){this.parentPath&&await this.browse(this.parentPath)},handleClose(){this.dialogVisible=!1,this.resetState()},resetState(){this.selectedPath="",this.projectName="",this.items=[],this.currentPath="",this.parentPath=null},async handleConfirm(){var s;if(!(!this.selectedPath||!this.projectName)){this.loading=!0;try{const e=await r.createProject(this.projectName,this.selectedPath,""),t=(s=e.data)==null?void 0:s.id;t&&(await r.setCurrentProject(t),this.$message.success("项目创建并切换成功"),this.$emit("success",e.data),this.handleClose())}catch(e){console.error("创建项目失败:",e),this.$message.error("创建项目失败: "+e.message)}finally{this.loading=!1}}}}};var c=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"选择项目文件夹",visible:e.dialogVisible,width:"600px","close-on-click-modal":!1,"append-to-body":""},on:{"update:visible":function(a){e.dialogVisible=a},close:e.handleClose}},[t("div",{staticClass:"select-project-dialog"},[e.drives.length>0?t("div",{staticClass:"drive-nav"},e._l(e.drives,function(a){return t("el-button",{key:a.path,attrs:{size:"mini",type:e.currentPath.startsWith(a.path)?"primary":""},on:{click:function(i){return e.selectDrive(a.path)}}},[e._v(" "+e._s(a.name)+" ")])}),1):e._e(),t("div",{staticClass:"file-list-container"},[t("div",{staticClass:"current-path"},[t("span",{staticClass:"path-label"},[e._v("当前路径:")]),t("span",{staticClass:"path-value"},[e._v(e._s(e.currentPath))])]),e.items.length>0?t("div",{staticClass:"file-list"},[e.parentPath?t("div",{staticClass:"file-item parent",on:{click:e.goToParent}},[t("i",{staticClass:"fa-solid fa-arrow-up"}),t("span",[e._v("上一级")])]):e._e(),e._l(e.items.filter(a=>a.is_directory),function(a){return t("div",{key:a.path,staticClass:"file-item",class:{selected:e.selectedPath===a.path},on:{click:function(i){return e.selectFolder(a)}}},[t("i",{staticClass:"fa-solid fa-folder"}),t("span",{staticClass:"file-name"},[e._v(e._s(a.name))])])}),e._l(e.items.filter(a=>!a.is_directory),function(a){return t("div",{key:a.path,staticClass:"file-item file-only"},[t("i",{staticClass:"fa-solid fa-file"}),t("span",{staticClass:"file-name"},[e._v(e._s(a.name))])])})],2):t("div",{staticClass:"empty-tip"},[t("span",[e._v("该目录为空")])])]),t("div",{staticClass:"底部状态栏"},[t("div",{staticClass:"selected-info"},[t("span",[e._v("已选择: "+e._s(e.selectedPath||"未选择"))])]),t("div",{staticClass:"project-name-input"},[t("span",[e._v("项目名称:")]),t("el-input",{staticStyle:{width:"200px"},attrs:{placeholder:"请输入项目名称",size:"small"},model:{value:e.projectName,callback:function(a){e.projectName=a},expression:"projectName"}})],1)])]),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary",disabled:!e.selectedPath||!e.projectName,loading:e.loading},on:{click:e.handleConfirm}},[e._v(" 确 定 ")])],1)])},d=[],h=l(n,c,d,!1,null,"e30d3bc8");const f=h.exports,u={name:"Layout",components:{SelectProjectDialog:f},data(){return{sidebarVisible:!0,showSessionDropdown:!1,sessions:[],currentSessionId:null,currentSessionName:"",projects:[],currentProject:null,selectProjectDialogVisible:!1,systemVersion:""}},methods:{toggleSidebar(){this.sidebarVisible=!this.sidebarVisible},toggleSessionDropdown(){this.showSessionDropdown=!this.showSessionDropdown},async switchSession(s){this.currentSessionId=s.id,this.currentSessionName=s.title,this.showSessionDropdown=!1,this.$route.params.id!==s.id&&this.$router.push({name:"chat-session",params:{id:s.id}}).catch(()=>{})},async createNewSession(){try{const s=await r.createSession("新会话");this.sessions.unshift(s.data),this.switchSession(s.data),this.showSessionDropdown=!1}catch(s){this.$message.error("创建会话失败: "+s.message)}},async loadSessions(){try{const s=await r.getSessions();this.sessions=s.data||[],this.sessions.length>0&&!this.currentSessionId&&(this.currentSessionId=this.sessions[0].id,this.currentSessionName=this.sessions[0].title)}catch(s){console.error("加载会话失败:",s)}},async loadProjects(){try{const s=await r.getProjects();this.projects=s.data||[];const e=await r.getCurrentProject();this.currentProject=e.data||null}catch(s){console.error("加载项目失败:",s)}},async handleProjectChange(s){if(s==="__open__"){const e=this.$el.querySelector(".el-dropdown");e&&e.click(),this.selectProjectDialogVisible=!0;return}try{await r.setCurrentProject(s);const e=this.projects.find(t=>t.id===s);e&&(this.currentProject=e),location.reload()}catch(e){this.$message.error("切换项目失败: "+e.message)}},handleProjectDialogSuccess(s){this.currentProject=s,this.loadProjects().then(()=>{location.reload()})},async loadSystemVersion(){var s;try{const e=await r.getSystemInfo();this.systemVersion=((s=e.data)==null?void 0:s.version)||""}catch(e){console.error("获取版本号失败:",e)}}},async created(){await this.loadProjects(),await this.loadSessions(),this.loadSystemVersion(),document.addEventListener("click",s=>{this.$el.contains(s.target)||(this.showSessionDropdown=!1)})}};var b=function(){var a;var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col h-screen overflow-hidden"},[t("header",{staticClass:"h-10 bg-sidebar border-b border-black flex items-center justify-between px-4 shrink-0 z-20"},[t("div",{staticClass:"flex items-center gap-4"},[e._m(0),t("div",{staticClass:"relative"},[t("a",{staticClass:"hover:text-white px-3 py-1 rounded border border-transparent hover:border-accent transition-colors cursor-pointer",class:e.$route.name==="devWorkflow"?"text-accent border-accent":"text-gray-400",attrs:{href:"/#/views/pc/devWorkflow",target:"_blank"}},[t("i",{staticClass:"fa-solid fa-laptop-code mr-1"}),e._v(" 软件研发 ")])]),t("div",{staticClass:"relative"},[t("router-link",{staticClass:"hover:text-white px-3 py-1 rounded border border-transparent hover:border-accent transition-colors cursor-pointer",class:e.$route.name==="deploy"?"text-accent border-accent":"text-gray-400",attrs:{to:"/views/pc/deploy"}},[t("i",{staticClass:"fa-solid fa-rocket mr-1"}),e._v(" 部署 ")])],1)]),t("div",{staticClass:"flex items-center gap-3"},[e.projects.length>0?t("el-dropdown",{attrs:{trigger:"click"},on:{command:e.handleProjectChange}},[t("span",{staticClass:"text-white text-sm cursor-pointer hover:text-accent"},[t("i",{staticClass:"fa-solid fa-folder mr-1"}),e._v(" "+e._s(((a=e.currentProject)==null?void 0:a.name)||"选择项目")+" "),t("i",{staticClass:"fa-solid fa-chevron-down ml-1 text-xs"})]),t("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e._l(e.projects,function(i){var o;return t("el-dropdown-item",{key:i.id,attrs:{command:i.id}},[t("span",{class:i.id===((o=e.currentProject)==null?void 0:o.id)?"text-accent":""},[e._v(e._s(i.name))])])}),t("el-dropdown-item",{attrs:{divided:"",command:"__open__"}},[t("i",{staticClass:"fa-solid fa-folder-open mr-1"}),e._v(" 打开项目文件夹 ")])],2)],1):e._e(),t("SelectProjectDialog",{attrs:{visible:e.selectProjectDialogVisible},on:{"update:visible":function(i){e.selectProjectDialogVisible=i},success:e.handleProjectDialogSuccess}}),e.systemVersion?t("span",{staticClass:"text-xs text-textMuted"},[e._v("v"+e._s(e.systemVersion))]):e._e(),e._m(1),t("button",{directives:[{name:"show",rawName:"v-show",value:e.$route.name==="chat",expression:"$route.name === 'chat'"}],staticClass:"hover:text-white",attrs:{title:e.sidebarVisible?"关闭侧栏":"显示侧栏"},on:{click:e.toggleSidebar}},[t("i",{staticClass:"fa-solid fa-columns"})])],1)]),t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("nav",{staticClass:"w-12 bg-activityBar flex flex-col items-center py-2 shrink-0 border-r border-black z-10 justify-between"},[t("div",{staticClass:"flex flex-col items-center w-full"},[t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center relative",class:e.$route.name==="codeView"||e.$route.name==="codeView-session"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/codeView",title:"工作台"}},[t("i",{staticClass:"fa-regular fa-comments text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="files"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/files",title:"文件"}},[t("i",{staticClass:"fa-solid fa-folder-open text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="gitChanges"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/git-changes",title:"Git 变更"}},[t("i",{staticClass:"fa-brands fa-git-alt text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="terminal"||e.$route.name==="terminal-session"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/terminal",title:"终端"}},[t("i",{staticClass:"fa-solid fa-terminal text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center relative",class:e.$route.name==="skills"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/skills",title:"Skill 管理"}},[t("i",{staticClass:"fa-solid fa-shapes text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="db"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/db",title:"数据库"}},[t("i",{staticClass:"fa-solid fa-database text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="tasks"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/tasks",title:"任务"}},[t("i",{staticClass:"fa-solid fa-clock text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="aiLogs"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/aiLogs",title:"AI 日志"}},[t("i",{staticClass:"fa-solid fa-robot text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="wiki"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/wiki",title:"文档"}},[t("i",{staticClass:"fa-solid fa-book text-xl"})]),t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="fileZihao"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent",attrs:{to:"/views/pc/fileZihao",title:"文件梓豪"}},[t("i",{staticClass:"fa-solid fa-server text-xl"})])],1),t("div",{staticClass:"flex flex-col items-center w-full mb-2"},[t("router-link",{staticClass:"w-10 h-10 mb-2 rounded flex items-center justify-center",class:e.$route.name==="settings"?"text-white border-l-2 border-accent bg-sidebar":"text-textMuted hover:text-white border-l-2 border-transparent hover:bg-white/5",attrs:{to:"/views/pc/settings",title:"设置"}},[t("i",{staticClass:"fa-solid fa-gear text-xl"})])],1)]),t("keep-alive",{attrs:{include:["CodeView","TerminalView","Files"]}},[t("router-view",{staticClass:"flex-1 flex overflow-hidden",attrs:{"sidebar-visible":e.sidebarVisible},on:{"toggle-sidebar":e.toggleSidebar}})],1)],1),e._m(2)])},p=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"font-bold text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-robot text-accent"}),e("span",[s._v("TXCode Agent")])])},function(){var s=this,e=s._self._c;return e("span",{staticClass:"text-xs text-textMuted mr-2"},[e("i",{staticClass:"fa-solid fa-circle text-green-500 text-[8px]"}),s._v(" Server Connected")])},function(){var s=this,e=s._self._c;return e("footer",{staticClass:"h-6 bg-accent text-white text-xs flex items-center justify-between px-3 shrink-0 z-20"},[e("div",{staticClass:"flex items-center gap-4"},[e("span",[e("i",{staticClass:"fa-solid fa-code-branch"}),s._v(" main")])]),e("div",{staticClass:"flex items-center gap-4"},[e("span",[s._v("TXCode")]),e("span",[s._v("UTF-8")])])])}],m=l(u,b,p,!1,null,null);const x=m.exports;export{x as default};
@@ -1 +1 @@
1
- import{n as x,a as i}from"./index-dOZe8hsN.js";const b={"*/5 * * * *":"每5分钟","*/30 * * * *":"每30分钟","0 * * * *":"每小时","0 */2 * * *":"每2小时","0 */12 * * *":"每12小时","0 0 * * *":"每天0点","0 0 1 * *":"每月1日0点"},p={name:"TasksView",data(){return{tasks:[],models:[],availableSkills:[],showDialog:!1,showLogDialog:!1,isEditing:!1,currentTask:null,logs:[],form:{name:"",model:"gpt-4",scheduleType:"0 * * * *",notifyType:"message",skills:[],content:"",enabled:!0}}},async created(){await this.loadTasks(),await this.loadModels(),await this.loadSkills()},methods:{async loadTasks(){try{const s=await i.getScheduledTasks();this.tasks=s.data||[]}catch(s){console.error("Load tasks failed:",s),this.$message.error("加载任务失败")}},async loadModels(){try{const s=await i.getModels();this.models=s.data||[],this.models.length>0&&!this.form.model&&(this.form.model=this.models[0].name)}catch(s){console.error("Load models failed:",s)}},async loadSkills(){var s;try{const e=await i.getSkills();this.availableSkills=((s=e.data)==null?void 0:s.map(t=>t.name))||[]}catch(e){console.error("Load skills failed:",e)}},formatSchedule(s){return b[s]||s},formatTime(s){return s?new Date(s).toLocaleString("zh-CN"):"-"},formatDuration(s){return s?s<1e3?`${s}ms`:`${(s/1e3).toFixed(2)}s`:"0ms"},openCreateDialog(){var s;this.isEditing=!1,this.form={name:"",model:((s=this.models[0])==null?void 0:s.name)||"gpt-4",scheduleType:"0 * * * *",notifyType:"message",skills:[],content:"",enabled:!0},this.showDialog=!0},openEditDialog(s){this.isEditing=!0,this.currentTask=s,this.form={name:s.name,model:s.model,scheduleType:s.scheduleType,notifyType:s.notifyType,skills:[...s.skills||[]],content:s.content,enabled:s.enabled},this.showDialog=!0},closeDialog(){this.showDialog=!1,this.currentTask=null},async saveTask(){if(!this.form.name||!this.form.content){this.$message.error("请填写必填项");return}try{this.isEditing&&this.currentTask?(await i.updateScheduledTask(this.currentTask.id,this.form),this.$message.success("任务已更新")):(await i.createScheduledTask(this.form),this.$message.success("任务已创建")),this.closeDialog(),await this.loadTasks()}catch(s){this.$message.error("保存失败: "+s.message)}},async deleteTask(s){if(confirm(`确定删除任务 "${s.name}" 吗?`))try{await i.deleteScheduledTask(s.id),this.$message.success("任务已删除"),await this.loadTasks()}catch(e){this.$message.error("删除失败: "+e.message)}},async startTask(s){try{await i.startScheduledTask(s.id),this.$message.success("任务已启动"),await this.loadTasks()}catch(e){this.$message.error("启动失败: "+e.message)}},async stopTask(s){try{await i.stopScheduledTask(s.id),this.$message.success("任务已停用"),await this.loadTasks()}catch(e){this.$message.error("停用失败: "+e.message)}},async runTask(s){try{await i.runTaskNow(s.id),this.$message.success("任务已开始执行")}catch(e){this.$message.error("执行失败: "+e.message)}},async openLogDialog(s){this.currentTask=s,this.showLogDialog=!0;try{const e=await i.getTaskLogs(s.id);this.logs=e.data||[]}catch(e){console.error("Load logs failed:",e),this.logs=[]}}}};var m=function(){var u;var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex flex-col overflow-hidden bg-[#1e1e1e]"},[t("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar shrink-0"},[t("div",{staticClass:"flex items-center justify-between"},[t("div",{staticClass:"flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-clock text-accent"}),t("span",{staticClass:"text-white font-medium"},[e._v("定时任务")]),t("span",{staticClass:"text-xs text-textMuted"},[e._v(e._s(e.tasks.length)+" 个任务")])]),t("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:e.openCreateDialog}},[t("i",{staticClass:"fa-solid fa-plus mr-1"}),e._v(" 新建任务 ")])])]),t("div",{staticClass:"flex-1 overflow-auto p-4"},[t("table",{staticClass:"w-full text-sm"},[e._m(0),t("tbody",[e._l(e.tasks,function(a){return t("tr",{key:a.id,staticClass:"hover:bg-white/5"},[t("td",{staticClass:"px-3 py-2 border-b border-border/30"},[a.enabled?t("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-green-500/20 text-green-400"},[e._v("启用")]):t("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-gray-500/20 text-gray-400"},[e._v("停用")])]),t("td",{staticClass:"px-3 py-2 text-gray-200 border-b border-border/30"},[e._v(e._s(a.name))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(a.model))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(e.formatSchedule(a.scheduleType)))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},e._l(a.skills,function(o){var r;return(r=a.skills)!=null&&r.length?t("span",{key:o,staticClass:"text-xs px-1 py-0.5 bg-blue-500/20 text-blue-400 rounded mr-1"},[e._v(e._s(o))]):t("span",{staticClass:"text-textMuted"},[e._v("-")])}),0),t("td",{staticClass:"px-3 py-2 border-b border-border/30"},[t("div",{staticClass:"flex items-center gap-2"},[a.enabled?t("button",{staticClass:"text-xs px-2 py-1 text-yellow-400 hover:bg-yellow-500/20 rounded",on:{click:function(o){return e.stopTask(a)}}},[e._v("停用")]):t("button",{staticClass:"text-xs px-2 py-1 text-green-400 hover:bg-green-500/20 rounded",on:{click:function(o){return e.startTask(a)}}},[e._v("启动")]),t("button",{staticClass:"text-xs px-2 py-1 text-blue-400 hover:bg-blue-500/20 rounded",on:{click:function(o){return e.runTask(a)}}},[e._v("执行")]),t("button",{staticClass:"text-xs px-2 py-1 text-gray-400 hover:bg-white/10 rounded",on:{click:function(o){return e.openLogDialog(a)}}},[e._v("日志")]),t("button",{staticClass:"text-xs px-2 py-1 text-gray-400 hover:bg-white/10 rounded",on:{click:function(o){return e.openEditDialog(a)}}},[e._v("编辑")]),t("button",{staticClass:"text-xs px-2 py-1 text-red-400 hover:bg-red-500/20 rounded",on:{click:function(o){return e.deleteTask(a)}}},[e._v("删除")])])])])}),e.tasks.length===0?t("tr",[t("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"6"}},[e._v('暂无任务,点击"新建任务"创建')])]):e._e()],2)])]),e.showDialog?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[600px] max-h-[80vh] overflow-auto"},[t("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between"},[t("h3",{staticClass:"text-white font-medium"},[e._v(e._s(e.isEditing?"编辑任务":"新建任务"))]),t("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:e.closeDialog}},[e._v("关闭")])]),t("div",{staticClass:"p-4 space-y-4"},[t("div",[e._m(1),t("input",{directives:[{name:"model",rawName:"v-model",value:e.form.name,expression:"form.name"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"text",placeholder:"任务名称"},domProps:{value:e.form.name},on:{input:function(a){a.target.composing||e.$set(e.form,"name",a.target.value)}}})]),t("div",[e._m(2),t("select",{directives:[{name:"model",rawName:"v-model",value:e.form.model,expression:"form.model"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var l="_value"in r?r._value:r.value;return l});e.$set(e.form,"model",a.target.multiple?o:o[0])}}},e._l(e.models,function(a){return t("option",{key:a.id,domProps:{value:a.name}},[e._v(e._s(a.name))])}),0)]),t("div",[e._m(3),t("select",{directives:[{name:"model",rawName:"v-model",value:e.form.scheduleType,expression:"form.scheduleType"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var l="_value"in r?r._value:r.value;return l});e.$set(e.form,"scheduleType",a.target.multiple?o:o[0])}}},[t("option",{attrs:{value:"*/5 * * * *"}},[e._v("每5分钟")]),t("option",{attrs:{value:"*/30 * * * *"}},[e._v("每30分钟")]),t("option",{attrs:{value:"0 * * * *"}},[e._v("每小时")]),t("option",{attrs:{value:"0 */2 * * *"}},[e._v("每2小时")]),t("option",{attrs:{value:"0 */12 * * *"}},[e._v("每12小时")]),t("option",{attrs:{value:"0 0 * * *"}},[e._v("每天0点")]),t("option",{attrs:{value:"0 0 1 * *"}},[e._v("每月1日0点")])])]),t("div",[t("label",{staticClass:"block text-xs text-textMuted mb-1"},[e._v("通知方式")]),t("select",{directives:[{name:"model",rawName:"v-model",value:e.form.notifyType,expression:"form.notifyType"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var l="_value"in r?r._value:r.value;return l});e.$set(e.form,"notifyType",a.target.multiple?o:o[0])}}},[t("option",{attrs:{value:"message"}},[e._v("消息")]),t("option",{attrs:{value:"email"}},[e._v("邮件")])])]),t("div",[t("label",{staticClass:"block text-xs text-textMuted mb-1"},[e._v("关联技能")]),t("div",{staticClass:"flex flex-wrap gap-2"},e._l(e.availableSkills,function(a){return t("label",{key:a,staticClass:"flex items-center gap-1 text-xs text-textMuted cursor-pointer"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.form.skills,expression:"form.skills"}],staticClass:"accent-accent",attrs:{type:"checkbox"},domProps:{value:a,checked:Array.isArray(e.form.skills)?e._i(e.form.skills,a)>-1:e.form.skills},on:{change:function(o){var r=e.form.skills,l=o.target,d=!!l.checked;if(Array.isArray(r)){var n=a,c=e._i(r,n);l.checked?c<0&&e.$set(e.form,"skills",r.concat([n])):c>-1&&e.$set(e.form,"skills",r.slice(0,c).concat(r.slice(c+1)))}else e.$set(e.form,"skills",d)}}}),e._v(" "+e._s(a)+" ")])}),0)]),t("div",[e._m(4),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.form.content,expression:"form.content"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded resize-none",attrs:{rows:"5",placeholder:"请描述任务内容..."},domProps:{value:e.form.content},on:{input:function(a){a.target.composing||e.$set(e.form,"content",a.target.value)}}})]),t("div",{staticClass:"flex items-center gap-2"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.form.enabled,expression:"form.enabled"}],staticClass:"accent-accent",attrs:{type:"checkbox",id:"taskEnabled"},domProps:{checked:Array.isArray(e.form.enabled)?e._i(e.form.enabled,null)>-1:e.form.enabled},on:{change:function(a){var o=e.form.enabled,r=a.target,l=!!r.checked;if(Array.isArray(o)){var d=null,n=e._i(o,d);r.checked?n<0&&e.$set(e.form,"enabled",o.concat([d])):n>-1&&e.$set(e.form,"enabled",o.slice(0,n).concat(o.slice(n+1)))}else e.$set(e.form,"enabled",l)}}}),t("label",{staticClass:"text-xs text-textMuted",attrs:{for:"taskEnabled"}},[e._v("立即启用")])])]),t("div",{staticClass:"px-4 py-3 border-t border-border flex justify-end gap-2"},[t("button",{staticClass:"px-4 py-1 text-textMuted text-sm rounded hover:bg-white/10",on:{click:e.closeDialog}},[e._v("取消")]),t("button",{staticClass:"px-4 py-1 bg-accent text-white text-sm rounded hover:bg-accent/80",on:{click:e.saveTask}},[e._v(" "+e._s(e.isEditing?"保存":"创建")+" ")])])])]):e._e(),e.showLogDialog?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[900px] max-h-[80vh] overflow-hidden flex flex-col"},[t("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between shrink-0"},[t("h3",{staticClass:"text-white font-medium"},[e._v(e._s((u=e.currentTask)==null?void 0:u.name)+" - 执行日志")]),t("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:function(a){e.showLogDialog=!1}}},[e._v("关闭")])]),t("div",{staticClass:"flex-1 overflow-auto p-4"},[t("table",{staticClass:"w-full text-sm"},[e._m(5),t("tbody",[e._l(e.logs,function(a){return t("tr",{key:a.id,staticClass:"hover:bg-white/5"},[t("td",{staticClass:"px-3 py-2 border-b border-border/30"},[t("span",{staticClass:"text-xs px-2 py-0.5 rounded",class:a.status==="success"?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"},[e._v(" "+e._s(a.status==="success"?"成功":"失败")+" ")])]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(e.formatTime(a.executedAt)))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(e.formatDuration(a.duration)))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30 truncate max-w-[400px]",attrs:{title:a.result}},[e._v(e._s(a.result||a.error||"-"))])])}),e.logs.length===0?t("tr",[t("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"4"}},[e._v("暂无执行记录")])]):e._e()],2)])])])]):e._e()])},f=[function(){var s=this,e=s._self._c;return e("thead",{staticClass:"bg-sidebar sticky top-0"},[e("tr",[e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("状态")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("名称")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("模型")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("调度")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("技能")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("操作")])])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("任务名称 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("AI 模型 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("调度周期 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("任务内容 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("thead",{staticClass:"bg-sidebar sticky top-0"},[e("tr",[e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("状态")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("时间")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("耗时")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("结果")])])])}],v=x(p,m,f,!1,null,null);const g=v.exports;export{g as default};
1
+ import{n as x,a as i}from"./index-Dtkc_ka-.js";const b={"*/5 * * * *":"每5分钟","*/30 * * * *":"每30分钟","0 * * * *":"每小时","0 */2 * * *":"每2小时","0 */12 * * *":"每12小时","0 0 * * *":"每天0点","0 0 1 * *":"每月1日0点"},p={name:"TasksView",data(){return{tasks:[],models:[],availableSkills:[],showDialog:!1,showLogDialog:!1,isEditing:!1,currentTask:null,logs:[],form:{name:"",model:"gpt-4",scheduleType:"0 * * * *",notifyType:"message",skills:[],content:"",enabled:!0}}},async created(){await this.loadTasks(),await this.loadModels(),await this.loadSkills()},methods:{async loadTasks(){try{const s=await i.getScheduledTasks();this.tasks=s.data||[]}catch(s){console.error("Load tasks failed:",s),this.$message.error("加载任务失败")}},async loadModels(){try{const s=await i.getModels();this.models=s.data||[],this.models.length>0&&!this.form.model&&(this.form.model=this.models[0].name)}catch(s){console.error("Load models failed:",s)}},async loadSkills(){var s;try{const e=await i.getSkills();this.availableSkills=((s=e.data)==null?void 0:s.map(t=>t.name))||[]}catch(e){console.error("Load skills failed:",e)}},formatSchedule(s){return b[s]||s},formatTime(s){return s?new Date(s).toLocaleString("zh-CN"):"-"},formatDuration(s){return s?s<1e3?`${s}ms`:`${(s/1e3).toFixed(2)}s`:"0ms"},openCreateDialog(){var s;this.isEditing=!1,this.form={name:"",model:((s=this.models[0])==null?void 0:s.name)||"gpt-4",scheduleType:"0 * * * *",notifyType:"message",skills:[],content:"",enabled:!0},this.showDialog=!0},openEditDialog(s){this.isEditing=!0,this.currentTask=s,this.form={name:s.name,model:s.model,scheduleType:s.scheduleType,notifyType:s.notifyType,skills:[...s.skills||[]],content:s.content,enabled:s.enabled},this.showDialog=!0},closeDialog(){this.showDialog=!1,this.currentTask=null},async saveTask(){if(!this.form.name||!this.form.content){this.$message.error("请填写必填项");return}try{this.isEditing&&this.currentTask?(await i.updateScheduledTask(this.currentTask.id,this.form),this.$message.success("任务已更新")):(await i.createScheduledTask(this.form),this.$message.success("任务已创建")),this.closeDialog(),await this.loadTasks()}catch(s){this.$message.error("保存失败: "+s.message)}},async deleteTask(s){if(confirm(`确定删除任务 "${s.name}" 吗?`))try{await i.deleteScheduledTask(s.id),this.$message.success("任务已删除"),await this.loadTasks()}catch(e){this.$message.error("删除失败: "+e.message)}},async startTask(s){try{await i.startScheduledTask(s.id),this.$message.success("任务已启动"),await this.loadTasks()}catch(e){this.$message.error("启动失败: "+e.message)}},async stopTask(s){try{await i.stopScheduledTask(s.id),this.$message.success("任务已停用"),await this.loadTasks()}catch(e){this.$message.error("停用失败: "+e.message)}},async runTask(s){try{await i.runTaskNow(s.id),this.$message.success("任务已开始执行")}catch(e){this.$message.error("执行失败: "+e.message)}},async openLogDialog(s){this.currentTask=s,this.showLogDialog=!0;try{const e=await i.getTaskLogs(s.id);this.logs=e.data||[]}catch(e){console.error("Load logs failed:",e),this.logs=[]}}}};var m=function(){var u;var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex flex-col overflow-hidden bg-[#1e1e1e]"},[t("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar shrink-0"},[t("div",{staticClass:"flex items-center justify-between"},[t("div",{staticClass:"flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-clock text-accent"}),t("span",{staticClass:"text-white font-medium"},[e._v("定时任务")]),t("span",{staticClass:"text-xs text-textMuted"},[e._v(e._s(e.tasks.length)+" 个任务")])]),t("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:e.openCreateDialog}},[t("i",{staticClass:"fa-solid fa-plus mr-1"}),e._v(" 新建任务 ")])])]),t("div",{staticClass:"flex-1 overflow-auto p-4"},[t("table",{staticClass:"w-full text-sm"},[e._m(0),t("tbody",[e._l(e.tasks,function(a){return t("tr",{key:a.id,staticClass:"hover:bg-white/5"},[t("td",{staticClass:"px-3 py-2 border-b border-border/30"},[a.enabled?t("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-green-500/20 text-green-400"},[e._v("启用")]):t("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-gray-500/20 text-gray-400"},[e._v("停用")])]),t("td",{staticClass:"px-3 py-2 text-gray-200 border-b border-border/30"},[e._v(e._s(a.name))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(a.model))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(e.formatSchedule(a.scheduleType)))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},e._l(a.skills,function(o){var r;return(r=a.skills)!=null&&r.length?t("span",{key:o,staticClass:"text-xs px-1 py-0.5 bg-blue-500/20 text-blue-400 rounded mr-1"},[e._v(e._s(o))]):t("span",{staticClass:"text-textMuted"},[e._v("-")])}),0),t("td",{staticClass:"px-3 py-2 border-b border-border/30"},[t("div",{staticClass:"flex items-center gap-2"},[a.enabled?t("button",{staticClass:"text-xs px-2 py-1 text-yellow-400 hover:bg-yellow-500/20 rounded",on:{click:function(o){return e.stopTask(a)}}},[e._v("停用")]):t("button",{staticClass:"text-xs px-2 py-1 text-green-400 hover:bg-green-500/20 rounded",on:{click:function(o){return e.startTask(a)}}},[e._v("启动")]),t("button",{staticClass:"text-xs px-2 py-1 text-blue-400 hover:bg-blue-500/20 rounded",on:{click:function(o){return e.runTask(a)}}},[e._v("执行")]),t("button",{staticClass:"text-xs px-2 py-1 text-gray-400 hover:bg-white/10 rounded",on:{click:function(o){return e.openLogDialog(a)}}},[e._v("日志")]),t("button",{staticClass:"text-xs px-2 py-1 text-gray-400 hover:bg-white/10 rounded",on:{click:function(o){return e.openEditDialog(a)}}},[e._v("编辑")]),t("button",{staticClass:"text-xs px-2 py-1 text-red-400 hover:bg-red-500/20 rounded",on:{click:function(o){return e.deleteTask(a)}}},[e._v("删除")])])])])}),e.tasks.length===0?t("tr",[t("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"6"}},[e._v('暂无任务,点击"新建任务"创建')])]):e._e()],2)])]),e.showDialog?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[600px] max-h-[80vh] overflow-auto"},[t("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between"},[t("h3",{staticClass:"text-white font-medium"},[e._v(e._s(e.isEditing?"编辑任务":"新建任务"))]),t("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:e.closeDialog}},[e._v("关闭")])]),t("div",{staticClass:"p-4 space-y-4"},[t("div",[e._m(1),t("input",{directives:[{name:"model",rawName:"v-model",value:e.form.name,expression:"form.name"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"text",placeholder:"任务名称"},domProps:{value:e.form.name},on:{input:function(a){a.target.composing||e.$set(e.form,"name",a.target.value)}}})]),t("div",[e._m(2),t("select",{directives:[{name:"model",rawName:"v-model",value:e.form.model,expression:"form.model"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var l="_value"in r?r._value:r.value;return l});e.$set(e.form,"model",a.target.multiple?o:o[0])}}},e._l(e.models,function(a){return t("option",{key:a.id,domProps:{value:a.name}},[e._v(e._s(a.name))])}),0)]),t("div",[e._m(3),t("select",{directives:[{name:"model",rawName:"v-model",value:e.form.scheduleType,expression:"form.scheduleType"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var l="_value"in r?r._value:r.value;return l});e.$set(e.form,"scheduleType",a.target.multiple?o:o[0])}}},[t("option",{attrs:{value:"*/5 * * * *"}},[e._v("每5分钟")]),t("option",{attrs:{value:"*/30 * * * *"}},[e._v("每30分钟")]),t("option",{attrs:{value:"0 * * * *"}},[e._v("每小时")]),t("option",{attrs:{value:"0 */2 * * *"}},[e._v("每2小时")]),t("option",{attrs:{value:"0 */12 * * *"}},[e._v("每12小时")]),t("option",{attrs:{value:"0 0 * * *"}},[e._v("每天0点")]),t("option",{attrs:{value:"0 0 1 * *"}},[e._v("每月1日0点")])])]),t("div",[t("label",{staticClass:"block text-xs text-textMuted mb-1"},[e._v("通知方式")]),t("select",{directives:[{name:"model",rawName:"v-model",value:e.form.notifyType,expression:"form.notifyType"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",on:{change:function(a){var o=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var l="_value"in r?r._value:r.value;return l});e.$set(e.form,"notifyType",a.target.multiple?o:o[0])}}},[t("option",{attrs:{value:"message"}},[e._v("消息")]),t("option",{attrs:{value:"email"}},[e._v("邮件")])])]),t("div",[t("label",{staticClass:"block text-xs text-textMuted mb-1"},[e._v("关联技能")]),t("div",{staticClass:"flex flex-wrap gap-2"},e._l(e.availableSkills,function(a){return t("label",{key:a,staticClass:"flex items-center gap-1 text-xs text-textMuted cursor-pointer"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.form.skills,expression:"form.skills"}],staticClass:"accent-accent",attrs:{type:"checkbox"},domProps:{value:a,checked:Array.isArray(e.form.skills)?e._i(e.form.skills,a)>-1:e.form.skills},on:{change:function(o){var r=e.form.skills,l=o.target,d=!!l.checked;if(Array.isArray(r)){var n=a,c=e._i(r,n);l.checked?c<0&&e.$set(e.form,"skills",r.concat([n])):c>-1&&e.$set(e.form,"skills",r.slice(0,c).concat(r.slice(c+1)))}else e.$set(e.form,"skills",d)}}}),e._v(" "+e._s(a)+" ")])}),0)]),t("div",[e._m(4),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.form.content,expression:"form.content"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded resize-none",attrs:{rows:"5",placeholder:"请描述任务内容..."},domProps:{value:e.form.content},on:{input:function(a){a.target.composing||e.$set(e.form,"content",a.target.value)}}})]),t("div",{staticClass:"flex items-center gap-2"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.form.enabled,expression:"form.enabled"}],staticClass:"accent-accent",attrs:{type:"checkbox",id:"taskEnabled"},domProps:{checked:Array.isArray(e.form.enabled)?e._i(e.form.enabled,null)>-1:e.form.enabled},on:{change:function(a){var o=e.form.enabled,r=a.target,l=!!r.checked;if(Array.isArray(o)){var d=null,n=e._i(o,d);r.checked?n<0&&e.$set(e.form,"enabled",o.concat([d])):n>-1&&e.$set(e.form,"enabled",o.slice(0,n).concat(o.slice(n+1)))}else e.$set(e.form,"enabled",l)}}}),t("label",{staticClass:"text-xs text-textMuted",attrs:{for:"taskEnabled"}},[e._v("立即启用")])])]),t("div",{staticClass:"px-4 py-3 border-t border-border flex justify-end gap-2"},[t("button",{staticClass:"px-4 py-1 text-textMuted text-sm rounded hover:bg-white/10",on:{click:e.closeDialog}},[e._v("取消")]),t("button",{staticClass:"px-4 py-1 bg-accent text-white text-sm rounded hover:bg-accent/80",on:{click:e.saveTask}},[e._v(" "+e._s(e.isEditing?"保存":"创建")+" ")])])])]):e._e(),e.showLogDialog?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[900px] max-h-[80vh] overflow-hidden flex flex-col"},[t("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between shrink-0"},[t("h3",{staticClass:"text-white font-medium"},[e._v(e._s((u=e.currentTask)==null?void 0:u.name)+" - 执行日志")]),t("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:function(a){e.showLogDialog=!1}}},[e._v("关闭")])]),t("div",{staticClass:"flex-1 overflow-auto p-4"},[t("table",{staticClass:"w-full text-sm"},[e._m(5),t("tbody",[e._l(e.logs,function(a){return t("tr",{key:a.id,staticClass:"hover:bg-white/5"},[t("td",{staticClass:"px-3 py-2 border-b border-border/30"},[t("span",{staticClass:"text-xs px-2 py-0.5 rounded",class:a.status==="success"?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"},[e._v(" "+e._s(a.status==="success"?"成功":"失败")+" ")])]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(e.formatTime(a.executedAt)))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[e._v(e._s(e.formatDuration(a.duration)))]),t("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30 truncate max-w-[400px]",attrs:{title:a.result}},[e._v(e._s(a.result||a.error||"-"))])])}),e.logs.length===0?t("tr",[t("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"4"}},[e._v("暂无执行记录")])]):e._e()],2)])])])]):e._e()])},f=[function(){var s=this,e=s._self._c;return e("thead",{staticClass:"bg-sidebar sticky top-0"},[e("tr",[e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("状态")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("名称")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("模型")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("调度")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("技能")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("操作")])])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("任务名称 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("AI 模型 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("调度周期 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("任务内容 "),e("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,e=s._self._c;return e("thead",{staticClass:"bg-sidebar sticky top-0"},[e("tr",[e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("状态")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("时间")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("耗时")]),e("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("结果")])])])}],v=x(p,m,f,!1,null,null);const g=v.exports;export{g as default};
@@ -1,4 +1,4 @@
1
- import{n as pe,a as re}from"./index-dOZe8hsN.js";var ge={exports:{}};(function(N,F){(function(j,Y){N.exports=Y()})(self,()=>(()=>{var j={4567:function(O,r,a){var c=this&&this.__decorate||function(i,o,l,v){var m,h=arguments.length,p=h<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,o,l,v);else for(var b=i.length-1;b>=0;b--)(m=i[b])&&(p=(h<3?m(p):h>3?m(o,l,p):m(o,l))||p);return h>3&&p&&Object.defineProperty(o,l,p),p},_=this&&this.__param||function(i,o){return function(l,v){o(l,v,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),d=a(6114),f=a(9924),g=a(844),u=a(5596),e=a(4725),s=a(3656);let t=r.AccessibilityManager=class extends g.Disposable{constructor(i,o){super(),this._terminal=i,this._renderService=o,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new f.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(l=>this._handleResize(l.rows))),this.register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(l=>this._handleChar(l))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
1
+ import{n as pe,a as re}from"./index-Dtkc_ka-.js";var ge={exports:{}};(function(N,F){(function(j,Y){N.exports=Y()})(self,()=>(()=>{var j={4567:function(O,r,a){var c=this&&this.__decorate||function(i,o,l,v){var m,h=arguments.length,p=h<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,o,l,v);else for(var b=i.length-1;b>=0;b--)(m=i[b])&&(p=(h<3?m(p):h>3?m(o,l,p):m(o,l))||p);return h>3&&p&&Object.defineProperty(o,l,p),p},_=this&&this.__param||function(i,o){return function(l,v){o(l,v,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),d=a(6114),f=a(9924),g=a(844),u=a(5596),e=a(4725),s=a(3656);let t=r.AccessibilityManager=class extends g.Disposable{constructor(i,o){super(),this._terminal=i,this._renderService=o,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new f.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(l=>this._handleResize(l.rows))),this.register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(l=>this._handleChar(l))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
2
  `))),this.register(this._terminal.onA11yTab(l=>this._handleTab(l))),this.register(this._terminal.onKey(l=>this._handleKey(l.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new u.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,s.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let o=0;o<i;o++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
3
3
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)),d.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,d.isMac&&this._liveRegion.remove()}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,o){this._liveRegionDebouncer.refresh(i,o,this._terminal.rows)}_renderRows(i,o){const l=this._terminal.buffer,v=l.lines.length.toString();for(let m=i;m<=o;m++){const h=l.translateBufferLineToString(l.ydisp+m,!0),p=(l.ydisp+m+1).toString(),b=this._rowElements[m];b&&(h.length===0?b.innerText=" ":b.textContent=h,b.setAttribute("aria-posinset",p),b.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,o){const l=i.target,v=this._rowElements[o===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(o===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==v)return;let m,h;if(o===0?(m=l,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(m=this._rowElements.shift(),h=l,this._rowContainer.removeChild(m)),m.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),o===0){const p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{const p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(o===0?-1:1),this._rowElements[o===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let o=this._rowContainer.children.length;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=document.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=t=c([_(1,e.IRenderService)],t)},3614:(O,r)=>{function a(d){return d.replace(/\r?\n/g,"\r")}function c(d,f){return f?"\x1B[200~"+d+"\x1B[201~":d}function _(d,f,g,u){d=c(d=a(d),g.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(d,!0),f.value=""}function n(d,f,g){const u=g.getBoundingClientRect(),e=d.clientX-u.left-10,s=d.clientY-u.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${s}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=a,r.bracketTextForPaste=c,r.copyHandler=function(d,f){d.clipboardData&&d.clipboardData.setData("text/plain",f.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,f,g,u){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),f,g,u)},r.paste=_,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,f,g,u,e){n(d,f,g),e&&u.rightClickSelect(d),f.value=u.selectionText,f.select()}},7239:(O,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=a(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(_,n,d){this._css.set(_,n,d)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,d){this._color.set(_,n,d)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(a,c,_,n){a.addEventListener(c,_,n);let d=!1;return{dispose:()=>{d||(d=!0,a.removeEventListener(c,_,n))}}}},6465:function(O,r,a){var c=this&&this.__decorate||function(e,s,t,i){var o,l=arguments.length,v=l<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(o=e[m])&&(v=(l<3?o(v):l>3?o(s,t,v):o(s,t))||v);return l>3&&v&&Object.defineProperty(s,t,v),v},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const n=a(3656),d=a(8460),f=a(844),g=a(2585);let u=r.Linkifier2=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const s=this._linkProviders.indexOf(e);s!==-1&&this._linkProviders.splice(s,1)}}}attachToDom(e,s,t){this._element=e,this._mouseService=s,this._renderService=t,this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const t=e.composedPath();for(let i=0;i<t.length;i++){const o=t[i];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,s){var t,i;this._activeProviderReplies&&s||((t=this._activeProviderReplies)===null||t===void 0||t.forEach(l=>{l==null||l.forEach(v=>{v.link.dispose&&v.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let o=!1;for(const[l,v]of this._linkProviders.entries())s?!((i=this._activeProviderReplies)===null||i===void 0)&&i.get(l)&&(o=this._checkLinkProviderResult(l,e,o)):v.provideLinks(e.y,m=>{var h,p;if(this._isMouseOut)return;const b=m==null?void 0:m.map(L=>({link:L}));(h=this._activeProviderReplies)===null||h===void 0||h.set(l,b),o=this._checkLinkProviderResult(l,e,o),((p=this._activeProviderReplies)===null||p===void 0?void 0:p.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,s){const t=new Set;for(let i=0;i<s.size;i++){const o=s.get(i);if(o)for(let l=0;l<o.length;l++){const v=o[l],m=v.link.range.start.y<e?0:v.link.range.start.x,h=v.link.range.end.y>e?this._bufferService.cols:v.link.range.end.x;for(let p=m;p<=h;p++){if(t.has(p)){o.splice(l--,1);break}t.add(p)}}}}_checkLinkProviderResult(e,s,t){var i;if(!this._activeProviderReplies)return t;const o=this._activeProviderReplies.get(e);let l=!1;for(let v=0;v<e;v++)this._activeProviderReplies.has(v)&&!this._activeProviderReplies.get(v)||(l=!0);if(!l&&o){const v=o.find(m=>this._linkAtPosition(m.link,s));v&&(t=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let v=0;v<this._activeProviderReplies.size;v++){const m=(i=this._activeProviderReplies.get(v))===null||i===void 0?void 0:i.find(h=>this._linkAtPosition(h.link,s));if(m){t=!0,this._handleNewLink(m);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!s||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(e.link,s)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.pointerCursor},set:t=>{var i,o;!((i=this._currentLink)===null||i===void 0)&&i.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((o=this._element)===null||o===void 0||o.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.underline},set:t=>{var i,o,l;!((i=this._currentLink)===null||i===void 0)&&i.state&&((l=(o=this._currentLink)===null||o===void 0?void 0:o.state)===null||l===void 0?void 0:l.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;const i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(i,o),this._lastMouseEvent&&this._element)){const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(t,s.text)}_fireUnderlineEvent(e,s){const t=e.range,i=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-i-1,t.end.x,t.end.y-i-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(t,s.text)}_linkAtPosition(e,s){const t=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,o=s.y*this._bufferService.cols+s.x;return t<=o&&o<=i}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,o){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:o}}};r.Linkifier2=u=c([_(0,g.IBufferService)],u)},9042:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(O,r,a){var c=this&&this.__decorate||function(u,e,s,t){var i,o=arguments.length,l=o<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(u,e,s,t);else for(var v=u.length-1;v>=0;v--)(i=u[v])&&(l=(o<3?i(l):o>3?i(e,s,l):i(e,s))||l);return o>3&&l&&Object.defineProperty(e,s,l),l},_=this&&this.__param||function(u,e){return function(s,t){e(s,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=a(511),d=a(2585);let f=r.OscLinkProvider=class{constructor(u,e,s){this._bufferService=u,this._optionsService=e,this._oscLinkService=s}provideLinks(u,e){var s;const t=this._bufferService.buffer.lines.get(u-1);if(!t)return void e(void 0);const i=[],o=this._optionsService.rawOptions.linkHandler,l=new n.CellData,v=t.getTrimmedLength();let m=-1,h=-1,p=!1;for(let b=0;b<v;b++)if(h!==-1||t.hasContent(b)){if(t.loadCell(b,l),l.hasExtendedAttrs()&&l.extended.urlId){if(h===-1){h=b,m=l.extended.urlId;continue}p=l.extended.urlId!==m}else h!==-1&&(p=!0);if(p||h!==-1&&b===v-1){const L=(s=this._oscLinkService.getLinkData(m))===null||s===void 0?void 0:s.uri;if(L){const y={start:{x:h+1,y:u},end:{x:b+(p||b!==v-1?0:1),y:u}};let k=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{const x=new URL(L);["http:","https:"].includes(x.protocol)||(k=!0)}catch{k=!0}k||i.push({text:L,range:y,activate:(x,T)=>o?o.activate(x,T,y):g(0,T),hover:(x,T)=>{var P;return(P=o==null?void 0:o.hover)===null||P===void 0?void 0:P.call(o,x,T,y)},leave:(x,T)=>{var P;return(P=o==null?void 0:o.leave)===null||P===void 0?void 0:P.call(o,x,T,y)}})}p=!1,l.hasExtendedAttrs()&&l.extended.urlId?(h=b,m=l.extended.urlId):(h=-1,m=-1)}}e(i)}};function g(u,e){if(confirm(`Do you want to navigate to ${e}?
4
4
 
@@ -1 +1 @@
1
- import{n,a as o,g as s}from"./index-dOZe8hsN.js";const c={name:"WikiSidebar",data(){return{menuData:[],treeProps:{children:"children",label:"title"},currentPath:""}},methods:{async loadMenu(){try{const e=await o.getWikiMenu();e.success&&e.data&&(this.menuData=e.data.nav||[],this.menuData.length>0&&!this.currentPath&&(this.currentPath=this.menuData[0].url))}catch(e){console.error("Failed to load wiki menu:",e)}},handleNodeClick(e){const t=e.url;if(t){const r=t.match(/\/txcode\/(.+)\.html?$/);if(r){const i=r[1]+".md";this.$router.push({name:"wiki",query:{path:i}})}else this.$router.push({name:"wiki",query:{path:t}})}},setCurrentPath(e){this.currentPath=e}},created(){this.loadMenu()}};var d=function(){var t=this,r=t._self._c;return r("div",{staticClass:"wiki-sidebar"},[t._m(0),r("el-tree",{staticClass:"wiki-tree",attrs:{data:t.menuData,props:t.treeProps,"node-key":"url","current-node-key":t.currentPath,"highlight-current":!0},on:{"node-click":t.handleNodeClick},scopedSlots:t._u([{key:"default",fn:function({node:i,data:a}){return[r("div",{staticClass:"tree-node"},[a.icon?r("i",{class:a.icon}):t._e(),r("span",[t._v(t._s(a.title))])])]}}])})],1)},l=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"sidebar-header"},[t("i",{staticClass:"fa-solid fa-book"}),t("span",[e._v("文档中心")])])}],h=n(c,d,l,!1,null,"6cebe44d");const u=h.exports,_={name:"WikiContent",props:{filePath:{type:String,default:""}},data(){return{content:"",loading:!1,error:""}},computed:{renderedContent(){if(!this.content)return"";const e=new s.Renderer;return e.link=(t,r,i)=>t&&t.endsWith(".md")?(t.replace(/^\.\//,"").replace(".md",".html"),`<a href="javascript:void(0)" onclick="window.__wikiNavigate__('${t}')" title="${r||""}">${i}</a>`):t&&!t.startsWith("http")?`<a href="${t}" target="_blank" title="${r||""}">${i}</a>`:`<a href="${t}" target="_blank" title="${r||""}">${i}</a>`,e.image=(t,r,i)=>{let a=t;return t&&!t.startsWith("http")&&!t.startsWith("/")&&(a=this.filePath.replace(/[^/\\]*$/,"")+t),`<img src="${a}" alt="${i}" title="${r||""}" />`},s.setOptions({renderer:e,gfm:!0,breaks:!0}),s.parse(this.content)}},watch:{filePath:{immediate:!0,handler(e){e&&this.loadContent(e)}}},methods:{async loadContent(e){this.loading=!0,this.error="",this.content="";try{const t=await o.getWikiContent(e);t.success?this.content=t.data:this.error=t.error||"加载文档失败"}catch(t){console.error("Failed to load wiki content:",t),this.error="加载文档失败: "+t.message}finally{this.loading=!1}},setupNavigation(){window.__wikiNavigate__=e=>{const t=e.replace(/^\.\//,"").replace(".md",".html");this.$router.push({name:"wiki",query:{path:t}})}}},mounted(){this.setupNavigation()},beforeDestroy(){window.__wikiNavigate__&&delete window.__wikiNavigate__}};var m=function(){var t=this,r=t._self._c;return r("div",{staticClass:"wiki-content"},[t.loading?r("div",{staticClass:"loading"},[r("i",{staticClass:"fa-solid fa-spinner fa-spin"}),r("span",[t._v("加载中...")])]):t.error?r("div",{staticClass:"error"},[r("i",{staticClass:"fa-solid fa-exclamation-triangle"}),r("span",[t._v(t._s(t.error))])]):r("div",{staticClass:"markdown-body",domProps:{innerHTML:t._s(t.renderedContent)}})])},f=[],p=n(_,m,f,!1,null,"e31d4f07");const v=p.exports,k={name:"WikiView",components:{WikiSidebar:u,WikiContent:v},data(){return{currentPath:""}},watch:{"$route.query.path":{immediate:!0,handler(e){e?(this.currentPath=e,this.$refs.sidebar&&this.$refs.sidebar.setCurrentPath(e)):this.currentPath||(this.currentPath="getting-started/index.md")}}},mounted(){!this.currentPath&&this.$route.query.path?this.currentPath=this.$route.query.path:this.currentPath||(this.currentPath="getting-started/index.md")}};var $=function(){var t=this,r=t._self._c;return r("div",{staticClass:"wiki-view"},[r("WikiSidebar",{ref:"sidebar"}),r("WikiContent",{attrs:{"file-path":t.currentPath}})],1)},g=[],w=n(k,$,g,!1,null,"0d0371e5");const b=w.exports;export{b as default};
1
+ import{n,a as o,g as s}from"./index-Dtkc_ka-.js";const c={name:"WikiSidebar",data(){return{menuData:[],treeProps:{children:"children",label:"title"},currentPath:""}},methods:{async loadMenu(){try{const e=await o.getWikiMenu();e.success&&e.data&&(this.menuData=e.data.nav||[],this.menuData.length>0&&!this.currentPath&&(this.currentPath=this.menuData[0].url))}catch(e){console.error("Failed to load wiki menu:",e)}},handleNodeClick(e){const t=e.url;if(t){const r=t.match(/\/txcode\/(.+)\.html?$/);if(r){const i=r[1]+".md";this.$router.push({name:"wiki",query:{path:i}})}else this.$router.push({name:"wiki",query:{path:t}})}},setCurrentPath(e){this.currentPath=e}},created(){this.loadMenu()}};var d=function(){var t=this,r=t._self._c;return r("div",{staticClass:"wiki-sidebar"},[t._m(0),r("el-tree",{staticClass:"wiki-tree",attrs:{data:t.menuData,props:t.treeProps,"node-key":"url","current-node-key":t.currentPath,"highlight-current":!0},on:{"node-click":t.handleNodeClick},scopedSlots:t._u([{key:"default",fn:function({node:i,data:a}){return[r("div",{staticClass:"tree-node"},[a.icon?r("i",{class:a.icon}):t._e(),r("span",[t._v(t._s(a.title))])])]}}])})],1)},l=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"sidebar-header"},[t("i",{staticClass:"fa-solid fa-book"}),t("span",[e._v("文档中心")])])}],h=n(c,d,l,!1,null,"6cebe44d");const u=h.exports,_={name:"WikiContent",props:{filePath:{type:String,default:""}},data(){return{content:"",loading:!1,error:""}},computed:{renderedContent(){if(!this.content)return"";const e=new s.Renderer;return e.link=(t,r,i)=>t&&t.endsWith(".md")?(t.replace(/^\.\//,"").replace(".md",".html"),`<a href="javascript:void(0)" onclick="window.__wikiNavigate__('${t}')" title="${r||""}">${i}</a>`):t&&!t.startsWith("http")?`<a href="${t}" target="_blank" title="${r||""}">${i}</a>`:`<a href="${t}" target="_blank" title="${r||""}">${i}</a>`,e.image=(t,r,i)=>{let a=t;return t&&!t.startsWith("http")&&!t.startsWith("/")&&(a=this.filePath.replace(/[^/\\]*$/,"")+t),`<img src="${a}" alt="${i}" title="${r||""}" />`},s.setOptions({renderer:e,gfm:!0,breaks:!0}),s.parse(this.content)}},watch:{filePath:{immediate:!0,handler(e){e&&this.loadContent(e)}}},methods:{async loadContent(e){this.loading=!0,this.error="",this.content="";try{const t=await o.getWikiContent(e);t.success?this.content=t.data:this.error=t.error||"加载文档失败"}catch(t){console.error("Failed to load wiki content:",t),this.error="加载文档失败: "+t.message}finally{this.loading=!1}},setupNavigation(){window.__wikiNavigate__=e=>{const t=e.replace(/^\.\//,"").replace(".md",".html");this.$router.push({name:"wiki",query:{path:t}})}}},mounted(){this.setupNavigation()},beforeDestroy(){window.__wikiNavigate__&&delete window.__wikiNavigate__}};var m=function(){var t=this,r=t._self._c;return r("div",{staticClass:"wiki-content"},[t.loading?r("div",{staticClass:"loading"},[r("i",{staticClass:"fa-solid fa-spinner fa-spin"}),r("span",[t._v("加载中...")])]):t.error?r("div",{staticClass:"error"},[r("i",{staticClass:"fa-solid fa-exclamation-triangle"}),r("span",[t._v(t._s(t.error))])]):r("div",{staticClass:"markdown-body",domProps:{innerHTML:t._s(t.renderedContent)}})])},f=[],p=n(_,m,f,!1,null,"e31d4f07");const v=p.exports,k={name:"WikiView",components:{WikiSidebar:u,WikiContent:v},data(){return{currentPath:""}},watch:{"$route.query.path":{immediate:!0,handler(e){e?(this.currentPath=e,this.$refs.sidebar&&this.$refs.sidebar.setCurrentPath(e)):this.currentPath||(this.currentPath="getting-started/index.md")}}},mounted(){!this.currentPath&&this.$route.query.path?this.currentPath=this.$route.query.path:this.currentPath||(this.currentPath="getting-started/index.md")}};var $=function(){var t=this,r=t._self._c;return r("div",{staticClass:"wiki-view"},[r("WikiSidebar",{ref:"sidebar"}),r("WikiContent",{attrs:{"file-path":t.currentPath}})],1)},g=[],w=n(k,$,g,!1,null,"0d0371e5");const b=w.exports;export{b as default};
@@ -1,4 +1,4 @@
1
- import{m as et}from"./index-dOZe8hsN.js";/*!-----------------------------------------------------------------------------
1
+ import{m as et}from"./index-Dtkc_ka-.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 +1 @@
1
- import{n as c,a as d,e as _,K as m,c as y,R as v,g}from"./index-dOZe8hsN.js";const C="/api";async function h(s,t,e=null,a=!1){const n={method:s,headers:a?{}:{"Content-Type":"application/json"}};e&&s!=="GET"&&(n.body=a?e:JSON.stringify(e));const i=await(await fetch(`${C}${t}`,n)).json();if(i.success===!1)throw new Error(i.error||i.message||"请求失败");return i}const p={checkRelease(s){const t=s?`?projectPath=${encodeURIComponent(s)}`:"";return h("GET",`/deploy/check-release${t}`)},downloadUrl(s,t){return h("POST","/deploy/download-url",{url:s,projectPath:t})},async uploadArchive(s,t){const e=new FormData;return e.append("file",s),t&&e.append("projectPath",t),h("POST","/deploy/upload-archive",e,!0)}},w={name:"DeployEditor",props:{content:{type:String,default:""},filePath:{type:String,default:""}},data(){return{editor:null,saved:!0}},computed:{displayPath(){return this.filePath||"RELEASE.md"}},watch:{content(s){this.editor&&s!==this.editor.getValue()&&(this.editor.setValue(s),this.saved=!0)}},mounted(){this.$nextTick(()=>this.initEditor())},beforeDestroy(){this.editor&&(this.editor.dispose(),this.editor=null)},methods:{initEditor(){this.editor||(this.editor=_.create(this.$refs.editorContainer,{value:this.content||"",language:"markdown",theme:"vs-dark",fontSize:14,fontFamily:"ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Monaco, Consolas, monospace",minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:16}}),this.editor.addCommand(m.CtrlCmd|y.KeyS,()=>{this.save()}),this.editor.onDidChangeModelContent(()=>{this.saved=!1,this.$emit("content-change",this.editor.getValue())}))},getContent(){return this.editor?this.editor.getValue():this.content},async save(){if(!this.editor||!this.filePath)return;const s=this.editor.getValue();try{await d.writeFile(this.filePath,s),this.saved=!0,this.$emit("saved",s)}catch(t){this.$message.error("保存失败: "+t.message)}}}};var b=function(){var t=this,e=t._self._c;return e("div",{staticClass:"editor-panel"},[e("div",{staticClass:"editor-header"},[e("i",{staticClass:"fa-solid fa-file-lines"}),e("span",[t._v(t._s(t.displayPath))]),e("span",{staticClass:"save-status",class:t.saved?"saved":""},[t._v(" "+t._s(t.saved?"已保存":"未保存")+" ")])]),e("div",{ref:"editorContainer",staticClass:"editor-container"})])},k=[],S=c(w,b,k,!1,null,"6615be35");const x=S.exports,M={name:"DeployAssistant",components:{ResizableTextarea:v},props:{hasContent:{type:Boolean,default:!1},docContent:{type:String,default:""},projectPath:{type:String,default:""},releasePath:{type:String,default:""}},data(){return{ws:null,sessionId:"",inputMessage:"",messages:[],disabled:!1,stopping:!1,modelName:"",promptTokens:0,sessionStatus:"idle",heartbeatTimer:null}},computed:{displaySessionId(){return this.sessionId?this.sessionId.slice(0,8):"--------"}},async mounted(){const s=await this.loadSavedSession();s&&(this.sessionId=s),this.connect()},beforeDestroy(){this.disconnect(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer)},methods:{connect(){const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/caller`;this.ws=new WebSocket(t),this.ws.onopen=()=>{this.sessionId||(this.sessionId="deploy-"+Date.now()+"-"+Math.random().toString(36).slice(2,8)),this.ws.send(JSON.stringify({type:"init",data:{callbackUrl:"http://localhost:40000",projectPath:this.projectPath||"",tools:[],sessionId:this.sessionId,title:"部署助手"}})),this.heartbeatTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"}))},3e4)},this.ws.onmessage=e=>{try{const a=JSON.parse(e.data);this.handleMessage(a)}catch(a){console.error("Parse WS message error:",a)}},this.ws.onclose=()=>{this.sessionStatus="idle",this.disabled=!1,this.heartbeatTimer&&clearInterval(this.heartbeatTimer)},this.ws.onerror=e=>{console.error("WS error:",e),this.sessionStatus="idle",this.disabled=!1}},disconnect(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.ws&&(this.ws.close(),this.ws=null)},handleMessage(s){var t,e,a,n,o,i,r,l,u,f;switch(s.type){case"connected":break;case"init_ready":this.sessionId=((t=s.data)==null?void 0:t.sessionId)||this.sessionId,this.saveSessionId(this.sessionId),this.loadHistoryMessages();break;case"step":this.messages.push({type:"step",thought:(e=s.data)==null?void 0:e.thought,toolCalls:((a=s.data)==null?void 0:a.toolCalls)||[],success:(n=s.data)==null?void 0:n.success}),(i=(o=s.data)==null?void 0:o.usage)!=null&&i.promptTokens&&(this.promptTokens=s.data.usage.promptTokens),this.scrollToBottom();break;case"done":this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",this.messages.push({type:"done",content:((r=s.data)==null?void 0:r.response)||""}),(l=s.data)!=null&&l.modelName&&(this.modelName=s.data.modelName),(f=(u=s.data)==null?void 0:u.usage)!=null&&f.promptTokens&&(this.promptTokens=s.data.usage.promptTokens),this.scrollToBottom();break;case"error":this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.messages.push({type:"error",content:s.error||"发生错误"}),this.scrollToBottom();break}},sendMessage(s){s&&s.preventDefault();const t=this.inputMessage.trim();!t||this.disabled||!this.ws||(this.messages.push({type:"user",content:t}),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.sessionStatus="processing",this.ws.send(JSON.stringify({type:"chat",data:{sessionId:this.sessionId,message:t}})),this.scrollToBottom())},deployByDoc(){this.disabled||(this.inputMessage=`请按 ${this.releasePath} 文档进行部署`)},stopChat(){!this.sessionId||this.stopping||!this.ws||(this.stopping=!0,this.ws.send(JSON.stringify({type:"stop",data:{sessionId:this.sessionId}})))},handleKeydown(s){if(s.key==="Enter"){if(s.ctrlKey)return;s.preventDefault(),this.sendMessage()}},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadSavedSession(){var s;if(!this.projectPath)return null;try{const t=`${this.projectPath}/.txcode/release/deploy.json`,e=await d.getFileContent(t);if((s=e==null?void 0:e.data)!=null&&s.content)return JSON.parse(e.data.content).sessionId||null}catch{}return null},async saveSessionId(s){if(this.projectPath)try{const t=`${this.projectPath}/.txcode/release/deploy.json`;await d.writeFile(t,JSON.stringify({sessionId:s},null,2))}catch(t){console.error("保存 sessionId 失败:",t)}},async loadHistoryMessages(){if(this.sessionId)try{const s=await d.getMessages(this.sessionId),t=(s==null?void 0:s.data)||[];t.length>0&&(this.messages=t.map(e=>e.type==="chat"&&e.role==="user"?{type:"user",content:e.content}:e.role==="assistant"?{type:"done",content:e.content}:e))}catch(s){console.error("加载历史消息失败:",s)}},renderMarkdown(s){return s?g(s):""},formatArgs(s,t){try{const e=JSON.parse(t);return s==="bash"||s==="execute_bash"?e.command+(e.workdir?` (${e.workdir})`:""):s==="read_file"?e.file_path+(e.offset?`:${e.offset}`:""):s==="edit_file"||s==="write_file"?e.file_path:s==="glob"?e.pattern:s==="grep"?`"${e.pattern}"`:t}catch{return t}}}};var P=function(){var t=this,e=t._self._c;return e("div",{staticClass:"chat-panel"},[t._m(0),e("div",{ref:"messagesContainer",staticClass:"chat-messages"},[t.messages.length?t._e():e("div",{staticClass:"empty-state"},[e("i",{staticClass:"fa-solid fa-rocket text-3xl text-textMuted opacity-30 mb-4"}),e("p",[t._v('点击"按部署文档部署"开始自动化部署')])]),t._l(t.messages,function(a,n){return[a.type==="user"?e("div",{staticClass:"user-message"},[t._v(" "+t._s(a.content)+" ")]):a.type==="step"?e("div",{staticClass:"ai-step"},[a.thought?e("div",{staticClass:"ai-thought",domProps:{innerHTML:t._s(t.renderMarkdown(a.thought))}}):t._e(),t._l(a.toolCalls,function(o,i){var r,l;return e("div",{key:i,staticClass:"log-mute"},[e("span",{class:a.success!==!1?"tool-success":"tool-fail"},[t._v(" "+t._s(a.success!==!1?"✓":"✗")+" ")]),t._v(" "+t._s(((r=o.function)==null?void 0:r.name)||"")+" "),(l=o.function)!=null&&l.arguments?e("span",{staticClass:"tool-input"},[t._v(" "+t._s(t.formatArgs(o.function.name,o.function.arguments))+" ")]):t._e()])})],2):a.type==="done"?e("div",{staticClass:"ai-done",domProps:{innerHTML:t._s(t.renderMarkdown(a.content))}}):a.type==="error"?e("div",{staticClass:"ai-error"},[t._v(" "+t._s(a.content)+" ")]):t._e()]}),t.modelName?e("div",{staticClass:"build-info"},[e("span",[t._v("▣")]),t._v(" Build · "+t._s(t.modelName)+" ")]):t._e()],2),e("div",{staticClass:"chat-input-area"},[e("div",{staticClass:"input-row"},[e("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,"min-rows":2,"max-rows":15,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行)",disabled:t.disabled&&!t.stopping},nativeOn:{keydown:function(a){return!a.type.indexOf("key")&&t._k(a.keyCode,"enter",13,a.key,"Enter")?null:t.handleKeydown.apply(null,arguments)}},model:{value:t.inputMessage,callback:function(a){t.inputMessage=a},expression:"inputMessage"}}),e("div",{staticClass:"input-actions"},[t.disabled&&!t.stopping?e("el-button",{attrs:{type:"danger",size:"small"},on:{click:t.stopChat}},[t._v(" ■ 停止 ")]):t.stopping?e("el-button",{attrs:{type:"info",disabled:"",size:"small"}},[t._v(" 停止中... ")]):e("el-button",{attrs:{type:"default",disabled:!t.inputMessage.trim()||t.disabled,size:"small"},on:{click:t.sendMessage}},[t._v(" 发送 ")])],1)],1),e("div",{staticClass:"deploy-doc-link",on:{click:t.deployByDoc}},[e("i",{staticClass:"fa-solid fa-file-arrow-up"}),t._v(" 按部署文档部署 ")])]),e("div",{staticClass:"status-bar"},[e("span",{class:t.sessionStatus==="processing"?"status-thinking":"status-ready"},[t.sessionStatus==="processing"?e("span",{staticClass:"thinking-spinner"}):t._e(),t._v(" "+t._s(t.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),e("span",{staticClass:"separator"},[t._v("|")]),e("span",[t._v("模型:"+t._s(t.modelName||"-"))]),e("span",{staticClass:"separator"},[t._v("|")]),e("span",[t._v("会话:"+t._s(t.displaySessionId))]),e("span",{staticClass:"separator"},[t._v("|")]),e("span",[t._v("token:"+t._s(t.promptTokens))])])])},T=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"panel-header"},[t("span",[t("i",{staticClass:"fa-solid fa-robot"}),s._v(" AI 部署助手")])])}],I=c(M,P,T,!1,null,"362ef7aa");const $=I.exports,j={name:"DeployImport",props:{projectPath:{type:String,default:""}},data(){return{downloadUrl:"",downloading:!1,fileList:[],statusMessage:"",statusType:"info"}},methods:{async handleDownload(){if(this.downloadUrl.trim()){this.downloading=!0,this.statusMessage="";try{const s=await p.downloadUrl(this.downloadUrl.trim(),this.projectPath);this.statusMessage="部署文档已导入成功!",this.statusType="success",this.$emit("imported",s.data)}catch(s){this.statusMessage="下载失败: "+s.message,this.statusType="error"}finally{this.downloading=!1}}},async handleFileChange(s){this.statusMessage="";try{const t=await p.uploadArchive(s.raw,this.projectPath);this.statusMessage="部署文档已导入成功!",this.statusType="success",this.fileList=[],this.$emit("imported",t.data)}catch(t){this.statusMessage="上传失败: "+t.message,this.statusType="error"}}}};var E=function(){var t=this,e=t._self._c;return e("div",{staticClass:"deploy-import"},[e("div",{staticClass:"import-container"},[t._m(0),e("h2",{staticClass:"text-xl font-bold text-white mb-2"},[t._v("未找到部署文档")]),e("p",{staticClass:"text-textMuted mb-8"},[t._v("请导入部署文档到 .txcode/release/ 目录")]),e("div",{staticClass:"import-card"},[t._m(1),e("div",{staticClass:"import-card-body"},[e("div",{staticClass:"flex gap-2"},[e("el-input",{staticClass:"flex-1",attrs:{placeholder:"https://...",disabled:t.downloading},model:{value:t.downloadUrl,callback:function(a){t.downloadUrl=a},expression:"downloadUrl"}}),e("el-button",{attrs:{type:"primary",loading:t.downloading,disabled:!t.downloadUrl.trim()},on:{click:t.handleDownload}},[t._v(" "+t._s(t.downloading?"下载中...":"下载")+" ")])],1)])]),t._m(2),e("div",{staticClass:"import-card"},[t._m(3),e("div",{staticClass:"import-card-body"},[e("el-upload",{attrs:{drag:"","auto-upload":!1,"show-file-list":!0,accept:".tar.gz,.tgz,.zip","on-change":t.handleFileChange,"file-list":t.fileList,limit:1}},[e("i",{staticClass:"el-icon-upload"}),e("div",{staticClass:"el-upload__text"},[t._v("将 tar.gz / zip 文件拖到此处,或"),e("em",[t._v("点击上传")])]),e("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v("上传后自动解压到 .txcode/release/ 目录")])])],1)]),t.statusMessage?e("div",{staticClass:"import-status",class:t.statusType},[t._v(" "+t._s(t.statusMessage)+" ")]):t._e()])])},D=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-icon"},[t("i",{staticClass:"fa-solid fa-cloud-arrow-down text-5xl text-textMuted opacity-50"})])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-card-title"},[t("i",{staticClass:"fa-solid fa-link"}),s._v(" 输入链接下载部署文档 ")])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-divider"},[t("span",[s._v("—— 或 ——")])])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-card-title"},[t("i",{staticClass:"fa-solid fa-upload"}),s._v(" 选择压缩包上传(tar.gz / zip) ")])}],N=c(j,E,D,!1,null,"ac9f9af6");const R=N.exports,z={name:"deployView",components:{DeployEditor:x,DeployAssistant:$,DeployImport:R},data(){return{loading:!0,releaseExists:!1,releaseContent:"",releasePath:"",editorContent:"",projectPath:""}},async mounted(){await this.loadProjectPath(),await this.checkRelease()},methods:{async loadProjectPath(){try{const s=await d.getCurrentProject();s.data&&s.data.path&&(this.projectPath=s.data.path)}catch(s){console.error("获取项目路径失败:",s)}},async checkRelease(){this.loading=!0;try{const s=await p.checkRelease(this.projectPath);s.data&&s.data.exists?(this.releaseExists=!0,this.releaseContent=s.data.content||"",this.editorContent=this.releaseContent,this.releasePath=s.data.path||""):this.releaseExists=!1}catch(s){console.error("检查部署文档失败:",s),this.releaseExists=!1}finally{this.loading=!1}},onContentChange(s){this.editorContent=s},onImported(){this.checkRelease()}}};var O=function(){var t=this,e=t._self._c;return e("div",{staticClass:"deploy-container"},[t.loading?e("div",{staticClass:"loading-state"},[e("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl text-textMuted"})]):t.releaseExists?[e("div",{staticClass:"deploy-main"},[e("DeployEditor",{ref:"editorRef",attrs:{content:t.releaseContent,"file-path":t.releasePath},on:{"content-change":t.onContentChange}}),e("DeployAssistant",{ref:"assistantRef",attrs:{"has-content":!!t.editorContent,"doc-content":t.editorContent,"project-path":t.projectPath,"release-path":t.releasePath}})],1)]:[e("DeployImport",{attrs:{"project-path":t.projectPath},on:{imported:t.onImported}})]],2)},A=[],B=c(z,O,A,!1,null,"4e75b69e");const U=B.exports;export{U as default};
1
+ import{n as c,a as d,e as _,K as m,c as y,R as v,g}from"./index-Dtkc_ka-.js";const C="/api";async function h(s,t,e=null,a=!1){const n={method:s,headers:a?{}:{"Content-Type":"application/json"}};e&&s!=="GET"&&(n.body=a?e:JSON.stringify(e));const i=await(await fetch(`${C}${t}`,n)).json();if(i.success===!1)throw new Error(i.error||i.message||"请求失败");return i}const p={checkRelease(s){const t=s?`?projectPath=${encodeURIComponent(s)}`:"";return h("GET",`/deploy/check-release${t}`)},downloadUrl(s,t){return h("POST","/deploy/download-url",{url:s,projectPath:t})},async uploadArchive(s,t){const e=new FormData;return e.append("file",s),t&&e.append("projectPath",t),h("POST","/deploy/upload-archive",e,!0)}},w={name:"DeployEditor",props:{content:{type:String,default:""},filePath:{type:String,default:""}},data(){return{editor:null,saved:!0}},computed:{displayPath(){return this.filePath||"RELEASE.md"}},watch:{content(s){this.editor&&s!==this.editor.getValue()&&(this.editor.setValue(s),this.saved=!0)}},mounted(){this.$nextTick(()=>this.initEditor())},beforeDestroy(){this.editor&&(this.editor.dispose(),this.editor=null)},methods:{initEditor(){this.editor||(this.editor=_.create(this.$refs.editorContainer,{value:this.content||"",language:"markdown",theme:"vs-dark",fontSize:14,fontFamily:"ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Monaco, Consolas, monospace",minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:16}}),this.editor.addCommand(m.CtrlCmd|y.KeyS,()=>{this.save()}),this.editor.onDidChangeModelContent(()=>{this.saved=!1,this.$emit("content-change",this.editor.getValue())}))},getContent(){return this.editor?this.editor.getValue():this.content},async save(){if(!this.editor||!this.filePath)return;const s=this.editor.getValue();try{await d.writeFile(this.filePath,s),this.saved=!0,this.$emit("saved",s)}catch(t){this.$message.error("保存失败: "+t.message)}}}};var b=function(){var t=this,e=t._self._c;return e("div",{staticClass:"editor-panel"},[e("div",{staticClass:"editor-header"},[e("i",{staticClass:"fa-solid fa-file-lines"}),e("span",[t._v(t._s(t.displayPath))]),e("span",{staticClass:"save-status",class:t.saved?"saved":""},[t._v(" "+t._s(t.saved?"已保存":"未保存")+" ")])]),e("div",{ref:"editorContainer",staticClass:"editor-container"})])},k=[],S=c(w,b,k,!1,null,"6615be35");const x=S.exports,M={name:"DeployAssistant",components:{ResizableTextarea:v},props:{hasContent:{type:Boolean,default:!1},docContent:{type:String,default:""},projectPath:{type:String,default:""},releasePath:{type:String,default:""}},data(){return{ws:null,sessionId:"",inputMessage:"",messages:[],disabled:!1,stopping:!1,modelName:"",promptTokens:0,sessionStatus:"idle",heartbeatTimer:null}},computed:{displaySessionId(){return this.sessionId?this.sessionId.slice(0,8):"--------"}},async mounted(){const s=await this.loadSavedSession();s&&(this.sessionId=s),this.connect()},beforeDestroy(){this.disconnect(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer)},methods:{connect(){const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/caller`;this.ws=new WebSocket(t),this.ws.onopen=()=>{this.sessionId||(this.sessionId="deploy-"+Date.now()+"-"+Math.random().toString(36).slice(2,8)),this.ws.send(JSON.stringify({type:"init",data:{callbackUrl:"http://localhost:40000",projectPath:this.projectPath||"",tools:[],sessionId:this.sessionId,title:"部署助手"}})),this.heartbeatTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"}))},3e4)},this.ws.onmessage=e=>{try{const a=JSON.parse(e.data);this.handleMessage(a)}catch(a){console.error("Parse WS message error:",a)}},this.ws.onclose=()=>{this.sessionStatus="idle",this.disabled=!1,this.heartbeatTimer&&clearInterval(this.heartbeatTimer)},this.ws.onerror=e=>{console.error("WS error:",e),this.sessionStatus="idle",this.disabled=!1}},disconnect(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.ws&&(this.ws.close(),this.ws=null)},handleMessage(s){var t,e,a,n,o,i,r,l,u,f;switch(s.type){case"connected":break;case"init_ready":this.sessionId=((t=s.data)==null?void 0:t.sessionId)||this.sessionId,this.saveSessionId(this.sessionId),this.loadHistoryMessages();break;case"step":this.messages.push({type:"step",thought:(e=s.data)==null?void 0:e.thought,toolCalls:((a=s.data)==null?void 0:a.toolCalls)||[],success:(n=s.data)==null?void 0:n.success}),(i=(o=s.data)==null?void 0:o.usage)!=null&&i.promptTokens&&(this.promptTokens=s.data.usage.promptTokens),this.scrollToBottom();break;case"done":this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",this.messages.push({type:"done",content:((r=s.data)==null?void 0:r.response)||""}),(l=s.data)!=null&&l.modelName&&(this.modelName=s.data.modelName),(f=(u=s.data)==null?void 0:u.usage)!=null&&f.promptTokens&&(this.promptTokens=s.data.usage.promptTokens),this.scrollToBottom();break;case"error":this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.messages.push({type:"error",content:s.error||"发生错误"}),this.scrollToBottom();break}},sendMessage(s){s&&s.preventDefault();const t=this.inputMessage.trim();!t||this.disabled||!this.ws||(this.messages.push({type:"user",content:t}),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.sessionStatus="processing",this.ws.send(JSON.stringify({type:"chat",data:{sessionId:this.sessionId,message:t}})),this.scrollToBottom())},deployByDoc(){this.disabled||(this.inputMessage=`请按 ${this.releasePath} 文档进行部署`)},stopChat(){!this.sessionId||this.stopping||!this.ws||(this.stopping=!0,this.ws.send(JSON.stringify({type:"stop",data:{sessionId:this.sessionId}})))},handleKeydown(s){if(s.key==="Enter"){if(s.ctrlKey)return;s.preventDefault(),this.sendMessage()}},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadSavedSession(){var s;if(!this.projectPath)return null;try{const t=`${this.projectPath}/.txcode/release/deploy.json`,e=await d.getFileContent(t);if((s=e==null?void 0:e.data)!=null&&s.content)return JSON.parse(e.data.content).sessionId||null}catch{}return null},async saveSessionId(s){if(this.projectPath)try{const t=`${this.projectPath}/.txcode/release/deploy.json`;await d.writeFile(t,JSON.stringify({sessionId:s},null,2))}catch(t){console.error("保存 sessionId 失败:",t)}},async loadHistoryMessages(){if(this.sessionId)try{const s=await d.getMessages(this.sessionId),t=(s==null?void 0:s.data)||[];t.length>0&&(this.messages=t.map(e=>e.type==="chat"&&e.role==="user"?{type:"user",content:e.content}:e.role==="assistant"?{type:"done",content:e.content}:e))}catch(s){console.error("加载历史消息失败:",s)}},renderMarkdown(s){return s?g(s):""},formatArgs(s,t){try{const e=JSON.parse(t);return s==="bash"||s==="execute_bash"?e.command+(e.workdir?` (${e.workdir})`:""):s==="read_file"?e.file_path+(e.offset?`:${e.offset}`:""):s==="edit_file"||s==="write_file"?e.file_path:s==="glob"?e.pattern:s==="grep"?`"${e.pattern}"`:t}catch{return t}}}};var P=function(){var t=this,e=t._self._c;return e("div",{staticClass:"chat-panel"},[t._m(0),e("div",{ref:"messagesContainer",staticClass:"chat-messages"},[t.messages.length?t._e():e("div",{staticClass:"empty-state"},[e("i",{staticClass:"fa-solid fa-rocket text-3xl text-textMuted opacity-30 mb-4"}),e("p",[t._v('点击"按部署文档部署"开始自动化部署')])]),t._l(t.messages,function(a,n){return[a.type==="user"?e("div",{staticClass:"user-message"},[t._v(" "+t._s(a.content)+" ")]):a.type==="step"?e("div",{staticClass:"ai-step"},[a.thought?e("div",{staticClass:"ai-thought",domProps:{innerHTML:t._s(t.renderMarkdown(a.thought))}}):t._e(),t._l(a.toolCalls,function(o,i){var r,l;return e("div",{key:i,staticClass:"log-mute"},[e("span",{class:a.success!==!1?"tool-success":"tool-fail"},[t._v(" "+t._s(a.success!==!1?"✓":"✗")+" ")]),t._v(" "+t._s(((r=o.function)==null?void 0:r.name)||"")+" "),(l=o.function)!=null&&l.arguments?e("span",{staticClass:"tool-input"},[t._v(" "+t._s(t.formatArgs(o.function.name,o.function.arguments))+" ")]):t._e()])})],2):a.type==="done"?e("div",{staticClass:"ai-done",domProps:{innerHTML:t._s(t.renderMarkdown(a.content))}}):a.type==="error"?e("div",{staticClass:"ai-error"},[t._v(" "+t._s(a.content)+" ")]):t._e()]}),t.modelName?e("div",{staticClass:"build-info"},[e("span",[t._v("▣")]),t._v(" Build · "+t._s(t.modelName)+" ")]):t._e()],2),e("div",{staticClass:"chat-input-area"},[e("div",{staticClass:"input-row"},[e("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,"min-rows":2,"max-rows":15,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行)",disabled:t.disabled&&!t.stopping},nativeOn:{keydown:function(a){return!a.type.indexOf("key")&&t._k(a.keyCode,"enter",13,a.key,"Enter")?null:t.handleKeydown.apply(null,arguments)}},model:{value:t.inputMessage,callback:function(a){t.inputMessage=a},expression:"inputMessage"}}),e("div",{staticClass:"input-actions"},[t.disabled&&!t.stopping?e("el-button",{attrs:{type:"danger",size:"small"},on:{click:t.stopChat}},[t._v(" ■ 停止 ")]):t.stopping?e("el-button",{attrs:{type:"info",disabled:"",size:"small"}},[t._v(" 停止中... ")]):e("el-button",{attrs:{type:"default",disabled:!t.inputMessage.trim()||t.disabled,size:"small"},on:{click:t.sendMessage}},[t._v(" 发送 ")])],1)],1),e("div",{staticClass:"deploy-doc-link",on:{click:t.deployByDoc}},[e("i",{staticClass:"fa-solid fa-file-arrow-up"}),t._v(" 按部署文档部署 ")])]),e("div",{staticClass:"status-bar"},[e("span",{class:t.sessionStatus==="processing"?"status-thinking":"status-ready"},[t.sessionStatus==="processing"?e("span",{staticClass:"thinking-spinner"}):t._e(),t._v(" "+t._s(t.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),e("span",{staticClass:"separator"},[t._v("|")]),e("span",[t._v("模型:"+t._s(t.modelName||"-"))]),e("span",{staticClass:"separator"},[t._v("|")]),e("span",[t._v("会话:"+t._s(t.displaySessionId))]),e("span",{staticClass:"separator"},[t._v("|")]),e("span",[t._v("token:"+t._s(t.promptTokens))])])])},T=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"panel-header"},[t("span",[t("i",{staticClass:"fa-solid fa-robot"}),s._v(" AI 部署助手")])])}],I=c(M,P,T,!1,null,"362ef7aa");const $=I.exports,j={name:"DeployImport",props:{projectPath:{type:String,default:""}},data(){return{downloadUrl:"",downloading:!1,fileList:[],statusMessage:"",statusType:"info"}},methods:{async handleDownload(){if(this.downloadUrl.trim()){this.downloading=!0,this.statusMessage="";try{const s=await p.downloadUrl(this.downloadUrl.trim(),this.projectPath);this.statusMessage="部署文档已导入成功!",this.statusType="success",this.$emit("imported",s.data)}catch(s){this.statusMessage="下载失败: "+s.message,this.statusType="error"}finally{this.downloading=!1}}},async handleFileChange(s){this.statusMessage="";try{const t=await p.uploadArchive(s.raw,this.projectPath);this.statusMessage="部署文档已导入成功!",this.statusType="success",this.fileList=[],this.$emit("imported",t.data)}catch(t){this.statusMessage="上传失败: "+t.message,this.statusType="error"}}}};var E=function(){var t=this,e=t._self._c;return e("div",{staticClass:"deploy-import"},[e("div",{staticClass:"import-container"},[t._m(0),e("h2",{staticClass:"text-xl font-bold text-white mb-2"},[t._v("未找到部署文档")]),e("p",{staticClass:"text-textMuted mb-8"},[t._v("请导入部署文档到 .txcode/release/ 目录")]),e("div",{staticClass:"import-card"},[t._m(1),e("div",{staticClass:"import-card-body"},[e("div",{staticClass:"flex gap-2"},[e("el-input",{staticClass:"flex-1",attrs:{placeholder:"https://...",disabled:t.downloading},model:{value:t.downloadUrl,callback:function(a){t.downloadUrl=a},expression:"downloadUrl"}}),e("el-button",{attrs:{type:"primary",loading:t.downloading,disabled:!t.downloadUrl.trim()},on:{click:t.handleDownload}},[t._v(" "+t._s(t.downloading?"下载中...":"下载")+" ")])],1)])]),t._m(2),e("div",{staticClass:"import-card"},[t._m(3),e("div",{staticClass:"import-card-body"},[e("el-upload",{attrs:{drag:"","auto-upload":!1,"show-file-list":!0,accept:".tar.gz,.tgz,.zip","on-change":t.handleFileChange,"file-list":t.fileList,limit:1}},[e("i",{staticClass:"el-icon-upload"}),e("div",{staticClass:"el-upload__text"},[t._v("将 tar.gz / zip 文件拖到此处,或"),e("em",[t._v("点击上传")])]),e("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v("上传后自动解压到 .txcode/release/ 目录")])])],1)]),t.statusMessage?e("div",{staticClass:"import-status",class:t.statusType},[t._v(" "+t._s(t.statusMessage)+" ")]):t._e()])])},D=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-icon"},[t("i",{staticClass:"fa-solid fa-cloud-arrow-down text-5xl text-textMuted opacity-50"})])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-card-title"},[t("i",{staticClass:"fa-solid fa-link"}),s._v(" 输入链接下载部署文档 ")])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-divider"},[t("span",[s._v("—— 或 ——")])])},function(){var s=this,t=s._self._c;return t("div",{staticClass:"import-card-title"},[t("i",{staticClass:"fa-solid fa-upload"}),s._v(" 选择压缩包上传(tar.gz / zip) ")])}],N=c(j,E,D,!1,null,"ac9f9af6");const R=N.exports,z={name:"deployView",components:{DeployEditor:x,DeployAssistant:$,DeployImport:R},data(){return{loading:!0,releaseExists:!1,releaseContent:"",releasePath:"",editorContent:"",projectPath:""}},async mounted(){await this.loadProjectPath(),await this.checkRelease()},methods:{async loadProjectPath(){try{const s=await d.getCurrentProject();s.data&&s.data.path&&(this.projectPath=s.data.path)}catch(s){console.error("获取项目路径失败:",s)}},async checkRelease(){this.loading=!0;try{const s=await p.checkRelease(this.projectPath);s.data&&s.data.exists?(this.releaseExists=!0,this.releaseContent=s.data.content||"",this.editorContent=this.releaseContent,this.releasePath=s.data.path||""):this.releaseExists=!1}catch(s){console.error("检查部署文档失败:",s),this.releaseExists=!1}finally{this.loading=!1}},onContentChange(s){this.editorContent=s},onImported(){this.checkRelease()}}};var O=function(){var t=this,e=t._self._c;return e("div",{staticClass:"deploy-container"},[t.loading?e("div",{staticClass:"loading-state"},[e("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl text-textMuted"})]):t.releaseExists?[e("div",{staticClass:"deploy-main"},[e("DeployEditor",{ref:"editorRef",attrs:{content:t.releaseContent,"file-path":t.releasePath},on:{"content-change":t.onContentChange}}),e("DeployAssistant",{ref:"assistantRef",attrs:{"has-content":!!t.editorContent,"doc-content":t.editorContent,"project-path":t.projectPath,"release-path":t.releasePath}})],1)]:[e("DeployImport",{attrs:{"project-path":t.projectPath},on:{imported:t.onImported}})]],2)},A=[],B=c(z,O,A,!1,null,"4e75b69e");const U=B.exports;export{U as default};
@@ -1,2 +1,2 @@
1
- import{n as g,d as C,a as u}from"./index-dOZe8hsN.js";const m="/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(`${m}${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(`${m}/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=`${m}/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(`
1
+ import{n as g,d as C,a as u}from"./index-Dtkc_ka-.js";const m="/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(`${m}${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(`${m}/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=`${m}/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=[],_=g(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=g(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/filesystem/download?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.endsWith("\\")||e.endsWith("/")?"":"\\",i=e+a+t.name;await h.download(t.path,i,l=>{this.uploadProgress.percent=l}),this.$message.success("已下载到本地: "+i),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/filesystem/download?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=g($,M,I,!1,null,null);const T=F.exports;export{T as default};
@@ -1,4 +1,4 @@
1
- import{m as f}from"./index-dOZe8hsN.js";/*!-----------------------------------------------------------------------------
1
+ import{m as f}from"./index-Dtkc_ka-.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 l}from"./index-dOZe8hsN.js";/*!-----------------------------------------------------------------------------
1
+ import{m as l}from"./index-Dtkc_ka-.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-dOZe8hsN.js";/*!-----------------------------------------------------------------------------
1
+ import{m as s}from"./index-Dtkc_ka-.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-dOZe8hsN.js";/*!-----------------------------------------------------------------------------
1
+ import{m as lt}from"./index-Dtkc_ka-.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license