tianxincode 1.0.49 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/tx.config.d.ts.map +1 -1
- package/dist/config/tx.config.js +3 -1
- package/dist/config/tx.config.js.map +1 -1
- package/dist/core/db/db.service.d.ts +2 -0
- package/dist/core/db/db.service.d.ts.map +1 -1
- package/dist/core/db/db.service.js +11 -0
- package/dist/core/db/db.service.js.map +1 -1
- package/dist/core/db/init_sql/system.init.d.ts +3 -0
- package/dist/core/db/init_sql/system.init.d.ts.map +1 -0
- package/dist/core/db/init_sql/system.init.js +15 -0
- package/dist/core/db/init_sql/system.init.js.map +1 -0
- package/dist/entity/tx-config.entity.d.ts +1 -0
- package/dist/entity/tx-config.entity.d.ts.map +1 -1
- package/dist/gateway/api/file/download_file.js +1 -1
- package/dist/gateway/api/file/download_file.js.map +1 -1
- package/dist/gateway/api/skill/categories_skill.d.ts +3 -0
- package/dist/gateway/api/skill/categories_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/categories_skill.js +11 -0
- package/dist/gateway/api/skill/categories_skill.js.map +1 -0
- package/dist/gateway/api/skill/detail_skill.js +2 -2
- package/dist/gateway/api/skill/detail_skill.js.map +1 -1
- package/dist/gateway/api/skill/install_skill.d.ts +3 -0
- package/dist/gateway/api/skill/install_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/install_skill.js +26 -0
- package/dist/gateway/api/skill/install_skill.js.map +1 -0
- package/dist/gateway/api/skill/published_skill.d.ts +3 -0
- package/dist/gateway/api/skill/published_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/published_skill.js +15 -0
- package/dist/gateway/api/skill/published_skill.js.map +1 -0
- package/dist/gateway/api/skill/skill_routes.d.ts.map +1 -1
- package/dist/gateway/api/skill/skill_routes.js +8 -12
- package/dist/gateway/api/skill/skill_routes.js.map +1 -1
- package/dist/gateway/api/skill/uninstall_skill.d.ts +3 -0
- package/dist/gateway/api/skill/uninstall_skill.d.ts.map +1 -0
- package/dist/gateway/api/skill/uninstall_skill.js +20 -0
- package/dist/gateway/api/skill/uninstall_skill.js.map +1 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.js +11 -0
- package/dist/gateway/api/songbing/auth_cancel_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/auth_start_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/auth_start_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/auth_start_songbing.js +15 -0
- package/dist/gateway/api/songbing/auth_start_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.js +15 -0
- package/dist/gateway/api/songbing/auth_verify_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/config_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/config_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/config_songbing.js +6 -0
- package/dist/gateway/api/songbing/config_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/save_config_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/save_config_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/save_config_songbing.js +12 -0
- package/dist/gateway/api/songbing/save_config_songbing.js.map +1 -0
- package/dist/gateway/api/songbing/songbing_routes.d.ts +3 -0
- package/dist/gateway/api/songbing/songbing_routes.d.ts.map +1 -0
- package/dist/gateway/api/songbing/songbing_routes.js +15 -0
- package/dist/gateway/api/songbing/songbing_routes.js.map +1 -0
- package/dist/gateway/api/songbing/sync_models_songbing.d.ts +3 -0
- package/dist/gateway/api/songbing/sync_models_songbing.d.ts.map +1 -0
- package/dist/gateway/api/songbing/sync_models_songbing.js +11 -0
- package/dist/gateway/api/songbing/sync_models_songbing.js.map +1 -0
- package/dist/gateway/api/spec/categories_spec.d.ts +3 -0
- package/dist/gateway/api/spec/categories_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/categories_spec.js +11 -0
- package/dist/gateway/api/spec/categories_spec.js.map +1 -0
- package/dist/gateway/api/spec/install_spec.d.ts +3 -0
- package/dist/gateway/api/spec/install_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/install_spec.js +26 -0
- package/dist/gateway/api/spec/install_spec.js.map +1 -0
- package/dist/gateway/api/spec/published_spec.d.ts +3 -0
- package/dist/gateway/api/spec/published_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/published_spec.js +18 -0
- package/dist/gateway/api/spec/published_spec.js.map +1 -0
- package/dist/gateway/api/spec/spec_routes.d.ts.map +1 -1
- package/dist/gateway/api/spec/spec_routes.js +9 -19
- package/dist/gateway/api/spec/spec_routes.js.map +1 -1
- package/dist/gateway/api/spec/uninstall_spec.d.ts +3 -0
- package/dist/gateway/api/spec/uninstall_spec.d.ts.map +1 -0
- package/dist/gateway/api/spec/uninstall_spec.js +20 -0
- package/dist/gateway/api/spec/uninstall_spec.js.map +1 -0
- package/dist/gateway/api/system/system_routes.d.ts.map +1 -1
- package/dist/gateway/api/system/system_routes.js +2 -0
- package/dist/gateway/api/system/system_routes.js.map +1 -1
- package/dist/gateway/api/system/version_check.d.ts +3 -0
- package/dist/gateway/api/system/version_check.d.ts.map +1 -0
- package/dist/gateway/api/system/version_check.js +47 -0
- package/dist/gateway/api/system/version_check.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/spec/index.d.ts +0 -1
- package/dist/modules/spec/index.d.ts.map +1 -1
- package/dist/modules/spec/index.js +0 -1
- package/dist/modules/spec/index.js.map +1 -1
- package/dist/modules/spec/spec.injector.d.ts.map +1 -1
- package/dist/modules/spec/spec.injector.js +2 -24
- package/dist/modules/spec/spec.injector.js.map +1 -1
- package/dist/queue/dream/dream.service.d.ts.map +1 -1
- package/dist/queue/dream/dream.service.js +8 -0
- package/dist/queue/dream/dream.service.js.map +1 -1
- package/dist/queue/dream/handlers/clear-session.handler.d.ts +6 -0
- package/dist/queue/dream/handlers/clear-session.handler.d.ts.map +1 -0
- package/dist/queue/dream/handlers/clear-session.handler.js +50 -0
- package/dist/queue/dream/handlers/clear-session.handler.js.map +1 -0
- package/dist/queue/dream/handlers/init.handler.d.ts.map +1 -1
- package/dist/queue/dream/handlers/init.handler.js +4 -2
- package/dist/queue/dream/handlers/init.handler.js.map +1 -1
- package/dist/repository/index.d.ts +2 -0
- package/dist/repository/index.d.ts.map +1 -1
- package/dist/repository/index.js +1 -0
- package/dist/repository/index.js.map +1 -1
- package/dist/repository/message.repository.d.ts +2 -0
- package/dist/repository/message.repository.d.ts.map +1 -1
- package/dist/repository/message.repository.js +8 -0
- package/dist/repository/message.repository.js.map +1 -1
- package/dist/repository/system.repository.d.ts +18 -0
- package/dist/repository/system.repository.d.ts.map +1 -0
- package/dist/repository/system.repository.js +14 -0
- package/dist/repository/system.repository.js.map +1 -0
- package/dist/services/hub/txcode_hub.service.d.ts +98 -0
- package/dist/services/hub/txcode_hub.service.d.ts.map +1 -0
- package/dist/services/hub/txcode_hub.service.js +173 -0
- package/dist/services/hub/txcode_hub.service.js.map +1 -0
- package/dist/services/songbing/songbing.service.d.ts +30 -0
- package/dist/services/songbing/songbing.service.d.ts.map +1 -0
- package/dist/services/songbing/songbing.service.js +155 -0
- package/dist/services/songbing/songbing.service.js.map +1 -0
- package/dist/services/system/device-sync.service.d.ts +2 -0
- package/dist/services/system/device-sync.service.d.ts.map +1 -0
- package/dist/services/system/device-sync.service.js +51 -0
- package/dist/services/system/device-sync.service.js.map +1 -0
- package/package.json +2 -1
- package/web/dist/assets/{ConfirmDialog-B03GcCHQ.js → ConfirmDialog-IKK1F-1U.js} +1 -1
- package/web/dist/assets/PcLayout-CLW13hCk.js +1 -0
- package/web/dist/assets/{aiLogsView-Bt8Xg1Qx.js → aiLogsView-D6QEk_U9.js} +1 -1
- package/web/dist/assets/{cssMode-CBb6D87U.js → cssMode-QPobA5wX.js} +1 -1
- package/web/dist/assets/{customActionsView-DdjnHzwm.js → customActionsView-ClRg3U7-.js} +1 -1
- package/web/dist/assets/{deployView-Cj51_Job.js → deployView-DUWf2jhH.js} +1 -1
- package/web/dist/assets/designView-BjjT_eB5.css +1 -0
- package/web/dist/assets/designView-DKuJizPM.js +18 -0
- package/web/dist/assets/devWorkflowView-CNmKhVZJ.js +36 -0
- package/web/dist/assets/devWorkflowView-CiSrMRlP.css +1 -0
- package/web/dist/assets/{devWorkflowViewApp-DLslXEq9.js → devWorkflowViewApp-C61Ulpxv.js} +1 -1
- package/web/dist/assets/{fileZihao-CtZ4bUIH.js → fileZihao-BTpK560o.js} +1 -1
- package/web/dist/assets/{freemarker2-CX3jc3l2.js → freemarker2-DvYwU7jd.js} +1 -1
- package/web/dist/assets/gitChanges-5Yut6NPa.css +1 -0
- package/web/dist/assets/gitChanges-CRoMAiCZ.js +2 -0
- package/web/dist/assets/{gitChangesApp-ZI7-V8oB.js → gitChangesApp-DWWUQkP3.js} +1 -1
- package/web/dist/assets/{handlebars-CTaQD6FN.js → handlebars-CK4TZqgf.js} +1 -1
- package/web/dist/assets/{html-BruJsfYv.js → html-Dyb2cBd1.js} +1 -1
- package/web/dist/assets/{htmlMode-wewroXLr.js → htmlMode-BgucwytQ.js} +1 -1
- package/web/dist/assets/{index-C0xmVTIn.css → index-CLl7xUVM.css} +1 -1
- package/web/dist/assets/{index-Cn73hS12.js → index-CUBJZpK-.js} +195 -195
- package/web/dist/assets/{javascript-B4ku8P1-.js → javascript-C2N5q77q.js} +1 -1
- package/web/dist/assets/{jsonMode-BIvVuBMG.js → jsonMode-CROJscjh.js} +1 -1
- package/web/dist/assets/{liquid-Bo3G0Ep7.js → liquid-BbMQX3iL.js} +1 -1
- package/web/dist/assets/{mdx-Duv0ylZz.js → mdx-DJKFF9Ub.js} +1 -1
- package/web/dist/assets/{mediaChat-RT7iqqYb.js → mediaChat-DHxUlCTa.js} +1 -1
- package/web/dist/assets/{python-CEhCctGm.js → python-DVBiUABc.js} +1 -1
- package/web/dist/assets/{razor-DPK8nTD7.js → razor-BFkZw5AO.js} +1 -1
- package/web/dist/assets/taskView-Bg6voWmj.js +1 -0
- package/web/dist/assets/{terminalView-GTYtDlus.js → terminalView-DJPI44tU.js} +1 -1
- package/web/dist/assets/{tsMode-BZvUU1nf.js → tsMode-CQoCUTDo.js} +1 -1
- package/web/dist/assets/{typescript-CmEn-k1B.js → typescript-DrsQGMkk.js} +1 -1
- package/web/dist/assets/wikiView-B-OhVpHv.css +1 -0
- package/web/dist/assets/{wikiView-CRjg-cZ8.js → wikiView-DyH2kquo.js} +1 -1
- package/web/dist/assets/{xml-bjvdKeyy.js → xml-BtAJQIGO.js} +1 -1
- package/web/dist/assets/{yaml-N5RXWxJk.js → yaml-vvMVX3ro.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/PcLayout-ZTdJNg7G.js +0 -1
- package/web/dist/assets/designView-C3pSX4nP.css +0 -1
- package/web/dist/assets/designView-RT8tKEN9.js +0 -18
- package/web/dist/assets/devWorkflowView-BTozmaiN.js +0 -36
- package/web/dist/assets/devWorkflowView-DYhIfbCB.css +0 -1
- package/web/dist/assets/gitChanges-D6QxPcii.css +0 -1
- package/web/dist/assets/gitChanges-DFRvzL5I.js +0 -2
- package/web/dist/assets/taskView-sOyebRqn.js +0 -1
- package/web/dist/assets/wikiView-C-oqMnJM.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{conf as t,language as e}from"./typescript-
|
|
1
|
+
import{conf as t,language as e}from"./typescript-DrsQGMkk.js";import"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as Et}from"./index-
|
|
1
|
+
import{m as Et}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as l}from"./index-
|
|
1
|
+
import{m as l}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as s}from"./index-
|
|
1
|
+
import{m as s}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as m}from"./index-
|
|
1
|
+
import{u as m}from"./index-CUBJZpK-.js";const h=5,d=5*1024*1024;function g(){return{data:()=>({mediaFiles:[],previewImage:null}),methods:{async _uploadFiles(e){const i=(this.mediaFiles||[]).length,n=h-i;if(n<=0){this.$message.warning("最多上传5张图片");return}const r=Math.min(e.length,n);this.mediaFiles||(this.mediaFiles=[]);const o=this.mediaFiles.length;for(let t=0;t<r;t++){const s=e[t];if(s.size>d){this.$message.error(`图片「${s.name||"paste.png"}」超过 5MB,无法上传(当前 ${(s.size/1024/1024).toFixed(2)}MB)`);continue}const a=Date.now()+"_"+t+"_"+Math.random().toString(36).slice(2);this.mediaFiles.push({id:a,name:s.name||"paste.png",dataUrl:"",filePath:"",type:s.type||"image/png",uploading:!0})}for(let t=0;t<r;t++){const s=e[t];if(s.size>d)continue;const a=o+t;if(!(a>=this.mediaFiles.length))try{const l=await m(s);this.mediaFiles[a].dataUrl=l.dataUrl,this.mediaFiles[a].filePath=l.filePath,this.mediaFiles[a].type=l.type,this.mediaFiles[a].uploading=!1}catch(l){this.$message.error("图片上传失败: "+(l.message||l)),this.mediaFiles.splice(a,1)}}},handleImageUpload(){var i;if(this.disabled)return;const e=this.$refs.mediaInput;e&&(Array.isArray(e)?(i=e[0])==null||i.click():e.click())},async handleImageSelected(e){const i=e.target.files;if(!i||i.length===0)return;const n=Array.from(i);e.target.value="",await this._uploadFiles(n)},async handlePasteImages(e){this.disabled||await this._uploadFiles(e)},removeMedia(e){if(!this.mediaFiles)return;const i=this.mediaFiles.findIndex(n=>n.id===e);i>-1&&this.mediaFiles.splice(i,1)},openImagePreview(e){this.previewImage=e},closeImagePreview(){this.previewImage=null}}}}export{g as m};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as o}from"./index-
|
|
1
|
+
import{m as o}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m}from"./index-
|
|
1
|
+
import{m}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as x,a as i}from"./index-CUBJZpK-.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 t=await i.getSkills();this.availableSkills=((s=t.data)==null?void 0:s.map(e=>e.name))||[]}catch(t){console.error("Load skills failed:",t)}},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(t){this.$message.error("删除失败: "+t.message)}},async startTask(s){try{await i.startScheduledTask(s.id),this.$message.success("任务已启动"),await this.loadTasks()}catch(t){this.$message.error("启动失败: "+t.message)}},async stopTask(s){try{await i.stopScheduledTask(s.id),this.$message.success("任务已停用"),await this.loadTasks()}catch(t){this.$message.error("停用失败: "+t.message)}},async runTask(s){try{await i.runTaskNow(s.id),this.$message.success("任务已开始执行")}catch(t){this.$message.error("执行失败: "+t.message)}},async openLogDialog(s){this.currentTask=s,this.showLogDialog=!0;try{const t=await i.getTaskLogs(s.id);this.logs=t.data||[]}catch(t){console.error("Load logs failed:",t),this.logs=[]}}}};var m=function(){var u;var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex flex-col overflow-hidden bg-contentBg"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar shrink-0"},[e("div",{staticClass:"flex items-center justify-between"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-clock text-accent"}),e("span",{staticClass:"text-white font-medium"},[t._v("定时任务")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.tasks.length)+" 个任务")])]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.openCreateDialog}},[e("i",{staticClass:"fa-solid fa-plus mr-1"}),t._v(" 新建任务 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(0),e("tbody",[t._l(t.tasks,function(a){return e("tr",{key:a.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[a.enabled?e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-green-500/20 text-green-400"},[t._v("启用")]):e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-gray-500/20 text-gray-400"},[t._v("停用")])]),e("td",{staticClass:"px-3 py-2 text-gray-200 border-b border-border/30"},[t._v(t._s(a.name))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.model))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatSchedule(a.scheduleType)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},t._l(a.skills,function(o){var r;return(r=a.skills)!=null&&r.length?e("span",{key:o,staticClass:"text-xs px-1 py-0.5 bg-blue-500/20 text-blue-400 rounded mr-1"},[t._v(t._s(o))]):e("span",{staticClass:"text-textMuted"},[t._v("-")])}),0),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("div",{staticClass:"flex items-center gap-2"},[a.enabled?e("button",{staticClass:"text-xs px-2 py-1 text-yellow-400 hover:bg-yellow-500/20 rounded",on:{click:function(o){return t.stopTask(a)}}},[t._v("停用")]):e("button",{staticClass:"text-xs px-2 py-1 text-green-400 hover:bg-green-500/20 rounded",on:{click:function(o){return t.startTask(a)}}},[t._v("启动")]),e("button",{staticClass:"text-xs px-2 py-1 text-blue-400 hover:bg-blue-500/20 rounded",on:{click:function(o){return t.runTask(a)}}},[t._v("执行")]),e("button",{staticClass:"text-xs px-2 py-1 text-gray-400 hover:bg-white/10 rounded",on:{click:function(o){return t.openLogDialog(a)}}},[t._v("日志")]),e("button",{staticClass:"text-xs px-2 py-1 text-gray-400 hover:bg-white/10 rounded",on:{click:function(o){return t.openEditDialog(a)}}},[t._v("编辑")]),e("button",{staticClass:"text-xs px-2 py-1 text-red-400 hover:bg-red-500/20 rounded",on:{click:function(o){return t.deleteTask(a)}}},[t._v("删除")])])])])}),t.tasks.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"6"}},[t._v('暂无任务,点击"新建任务"创建')])]):t._e()],2)])]),t.showDialog?e("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[e("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[600px] max-h-[80vh] overflow-auto"},[e("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between"},[e("h3",{staticClass:"text-white font-medium"},[t._v(t._s(t.isEditing?"编辑任务":"新建任务"))]),e("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:t.closeDialog}},[t._v("关闭")])]),e("div",{staticClass:"p-4 space-y-4"},[e("div",[t._m(1),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.name,expression:"form.name"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"text",placeholder:"任务名称"},domProps:{value:t.form.name},on:{input:function(a){a.target.composing||t.$set(t.form,"name",a.target.value)}}})]),e("div",[t._m(2),e("select",{directives:[{name:"model",rawName:"v-model",value:t.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});t.$set(t.form,"model",a.target.multiple?o:o[0])}}},t._l(t.models,function(a){return e("option",{key:a.id,domProps:{value:a.name}},[t._v(t._s(a.name))])}),0)]),e("div",[t._m(3),e("select",{directives:[{name:"model",rawName:"v-model",value:t.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});t.$set(t.form,"scheduleType",a.target.multiple?o:o[0])}}},[e("option",{attrs:{value:"*/5 * * * *"}},[t._v("每5分钟")]),e("option",{attrs:{value:"*/30 * * * *"}},[t._v("每30分钟")]),e("option",{attrs:{value:"0 * * * *"}},[t._v("每小时")]),e("option",{attrs:{value:"0 */2 * * *"}},[t._v("每2小时")]),e("option",{attrs:{value:"0 */12 * * *"}},[t._v("每12小时")]),e("option",{attrs:{value:"0 0 * * *"}},[t._v("每天0点")]),e("option",{attrs:{value:"0 0 1 * *"}},[t._v("每月1日0点")])])]),e("div",[e("label",{staticClass:"block text-xs text-textMuted mb-1"},[t._v("通知方式")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.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});t.$set(t.form,"notifyType",a.target.multiple?o:o[0])}}},[e("option",{attrs:{value:"message"}},[t._v("消息")]),e("option",{attrs:{value:"email"}},[t._v("邮件")])])]),e("div",[e("label",{staticClass:"block text-xs text-textMuted mb-1"},[t._v("关联技能")]),e("div",{staticClass:"flex flex-wrap gap-2"},t._l(t.availableSkills,function(a){return e("label",{key:a,staticClass:"flex items-center gap-1 text-xs text-textMuted cursor-pointer"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.skills,expression:"form.skills"}],staticClass:"accent-accent",attrs:{type:"checkbox"},domProps:{value:a,checked:Array.isArray(t.form.skills)?t._i(t.form.skills,a)>-1:t.form.skills},on:{change:function(o){var r=t.form.skills,l=o.target,c=!!l.checked;if(Array.isArray(r)){var n=a,d=t._i(r,n);l.checked?d<0&&t.$set(t.form,"skills",r.concat([n])):d>-1&&t.$set(t.form,"skills",r.slice(0,d).concat(r.slice(d+1)))}else t.$set(t.form,"skills",c)}}}),t._v(" "+t._s(a)+" ")])}),0)]),e("div",[t._m(4),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.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:t.form.content},on:{input:function(a){a.target.composing||t.$set(t.form,"content",a.target.value)}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.enabled,expression:"form.enabled"}],staticClass:"accent-accent",attrs:{type:"checkbox",id:"taskEnabled"},domProps:{checked:Array.isArray(t.form.enabled)?t._i(t.form.enabled,null)>-1:t.form.enabled},on:{change:function(a){var o=t.form.enabled,r=a.target,l=!!r.checked;if(Array.isArray(o)){var c=null,n=t._i(o,c);r.checked?n<0&&t.$set(t.form,"enabled",o.concat([c])):n>-1&&t.$set(t.form,"enabled",o.slice(0,n).concat(o.slice(n+1)))}else t.$set(t.form,"enabled",l)}}}),e("label",{staticClass:"text-xs text-textMuted",attrs:{for:"taskEnabled"}},[t._v("立即启用")])])]),e("div",{staticClass:"px-4 py-3 border-t border-border flex justify-end gap-2"},[e("button",{staticClass:"px-4 py-1 text-textMuted text-sm rounded hover:bg-white/10",on:{click:t.closeDialog}},[t._v("取消")]),e("button",{staticClass:"px-4 py-1 bg-accent text-white text-sm rounded hover:bg-accent/80",on:{click:t.saveTask}},[t._v(" "+t._s(t.isEditing?"保存":"创建")+" ")])])])]):t._e(),t.showLogDialog?e("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[e("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[900px] max-h-[80vh] overflow-hidden flex flex-col"},[e("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between shrink-0"},[e("h3",{staticClass:"text-white font-medium"},[t._v(t._s((u=t.currentTask)==null?void 0:u.name)+" - 执行日志")]),e("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:function(a){t.showLogDialog=!1}}},[t._v("关闭")])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(5),e("tbody",[t._l(t.logs,function(a){return e("tr",{key:a.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("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"},[t._v(" "+t._s(a.status==="success"?"成功":"失败")+" ")])]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatTime(a.executedAt)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatDuration(a.duration)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30 truncate max-w-[400px]",attrs:{title:a.result}},[t._v(t._s(a.result||a.error||"-"))])])}),t.logs.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"4"}},[t._v("暂无执行记录")])]):t._e()],2)])])])]):t._e()])},f=[function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("状态")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("名称")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("模型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("调度")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("技能")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("操作")])])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("任务名称 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("AI 模型 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("调度周期 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("任务内容 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("状态")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("时间")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("耗时")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("结果")])])])}],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-
|
|
1
|
+
import{n as pe,a as re}from"./index-CUBJZpK-.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,4 +1,4 @@
|
|
|
1
|
-
import{t as O,m as I}from"./index-
|
|
1
|
+
import{t as O,m as I}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as s}from"./index-
|
|
1
|
+
import{m as s}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wiki-sidebar[data-v-7888577c]{width:260px;background:var(--color-panelHeader);border-right:1px solid var(--color-border);display:flex;flex-direction:column;height:100%}.sidebar-header[data-v-7888577c]{padding:16px;font-weight:600;font-size:14px;border-bottom:1px solid var(--color-border);display:flex;align-items:center;gap:8px}.wiki-tree[data-v-7888577c]{flex:1;overflow-y:auto;padding:8px 0}.wiki-tree[data-v-7888577c] .el-tree-node__content{height:36px}.wiki-tree[data-v-7888577c] .el-tree-node.is-current>.el-tree-node__content{background-color:var(--color-active);color:var(--color-accent)}.tree-node[data-v-7888577c]{display:flex;align-items:center;gap:8px;font-size:13px}.tree-node i[data-v-7888577c]{width:16px;text-align:center;color:var(--color-textMuted)}.wiki-content[data-v-5eea9da9]{flex:1;padding:24px 32px;overflow-y:auto;background:var(--color-panelHeader)}.loading[data-v-5eea9da9],.error[data-v-5eea9da9]{display:flex;align-items:center;justify-content:center;gap:8px;height:200px;color:var(--color-textMuted)}.error[data-v-5eea9da9]{color:#f56c6c}.markdown-body[data-v-5eea9da9]{max-width:900px;margin:0 auto}.markdown-body[data-v-5eea9da9] h1{font-size:2em;font-weight:600;margin-bottom:.5em;padding-bottom:.3em;border-bottom:1px solid var(--color-border)}.markdown-body[data-v-5eea9da9] h2{font-size:1.5em;font-weight:600;margin-top:1.5em;margin-bottom:.5em;padding-bottom:.3em;border-bottom:1px solid var(--color-border)}.markdown-body[data-v-5eea9da9] h3{font-size:1.25em;font-weight:600;margin-top:1.2em;margin-bottom:.5em}.markdown-body[data-v-5eea9da9] p{margin:.8em 0;line-height:1.8}.markdown-body[data-v-5eea9da9] a{color:var(--color-accent);text-decoration:none}.markdown-body[data-v-5eea9da9] a:hover{text-decoration:underline}.markdown-body[data-v-5eea9da9] code{padding:.2em .4em;background:var(--color-inputBg);border-radius:3px;font-size:85%;font-family:SF Mono,Consolas,monospace}.markdown-body[data-v-5eea9da9] pre{background:var(--color-inputBg);padding:16px;border-radius:6px;overflow-x:auto;margin:1em 0}.markdown-body[data-v-5eea9da9] pre code{padding:0;background:transparent;font-size:85%}.markdown-body[data-v-5eea9da9] ul,.markdown-body[data-v-5eea9da9] ol{padding-left:2em;margin:.8em 0}.markdown-body[data-v-5eea9da9] li{margin:.3em 0}.markdown-body[data-v-5eea9da9] table{border-collapse:collapse;width:100%;margin:1em 0}.markdown-body[data-v-5eea9da9] th,.markdown-body[data-v-5eea9da9] td{border:1px solid var(--color-border);padding:8px 12px}.markdown-body[data-v-5eea9da9] th{background:var(--color-inputBg);font-weight:600}.markdown-body[data-v-5eea9da9] blockquote{margin:1em 0;padding:0 1em;border-left:4px solid var(--color-border);color:var(--color-textMuted)}.markdown-body[data-v-5eea9da9] img{max-width:100%;height:auto}.wiki-view[data-v-c16ae71f]{display:flex;flex:1;overflow:hidden}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n,a as o,g as s}from"./index-
|
|
1
|
+
import{n,a as o,g as s}from"./index-CUBJZpK-.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 a=r[1]+".md";this.$router.push({name:"wiki",query:{path:a}})}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:a,data:i}){return[r("div",{staticClass:"tree-node"},[i.icon?r("i",{class:i.icon}):t._e(),r("span",[t._v(t._s(i.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,"7888577c");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,a)=>t&&t.endsWith(".md")?(t.replace(/^\.\//,"").replace(".md",".html"),`<a href="javascript:void(0)" onclick="window.__wikiNavigate__('${t}')" title="${r||""}">${a}</a>`):t&&!t.startsWith("http")?`<a href="${t}" target="_blank" title="${r||""}">${a}</a>`:`<a href="${t}" target="_blank" title="${r||""}">${a}</a>`,e.image=(t,r,a)=>{let i=t;return t&&!t.startsWith("http")&&!t.startsWith("/")&&(i=this.filePath.replace(/[^/\\]*$/,"")+t),`<img src="${i}" alt="${a}" 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,"5eea9da9");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,"c16ae71f");const b=w.exports;export{b as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as r}from"./index-
|
|
1
|
+
import{m as r}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as l}from"./index-
|
|
1
|
+
import{m as l}from"./index-CUBJZpK-.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/web/dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>TXCode - AI 编程助手</title>
|
|
7
7
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CUBJZpK-.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CLl7xUVM.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="app"></div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as l,a as r}from"./index-Cn73hS12.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)},selectItem(s){if(s.is_directory){this.selectedPath=s.path;const e=s.path.replace(/\\/g,"/").split("/");this.projectName=e.filter(t=>t).pop()||""}},async enterFolder(s){s.is_directory&&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.selectItem(a)},dblclick:function(i){return e.enterFolder(a)}}},[t("i",{staticClass:"fa-solid fa-folder"}),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,"e90f8022");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("a",{staticClass:"hover:text-white px-3 py-1 rounded border border-transparent hover:border-accent transition-colors cursor-pointer",class:e.$route.name==="designView"?"text-accent border-accent":"text-gray-400",attrs:{href:"/#/views/pc/designView",target:"_blank"}},[t("i",{staticClass:"fa-solid fa-pen-ruler 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"},[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),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 +0,0 @@
|
|
|
1
|
-
.sidebar-scroll[data-v-77cb22d9]::-webkit-scrollbar{width:8px}.sidebar-scroll[data-v-77cb22d9]::-webkit-scrollbar-track{background:transparent}.sidebar-scroll[data-v-77cb22d9]::-webkit-scrollbar-thumb{background:#404040;border-radius:4px}.sidebar-scroll[data-v-77cb22d9]::-webkit-scrollbar-thumb:hover{background:#505050}.chat-messages[data-v-9073ba4e]::-webkit-scrollbar{width:6px}.chat-messages[data-v-9073ba4e]::-webkit-scrollbar-track{background:transparent}.chat-messages[data-v-9073ba4e]::-webkit-scrollbar-thumb{background:#404040;border-radius:3px}.chat-messages[data-v-9073ba4e]::-webkit-scrollbar-thumb:hover{background:#505050}.chat-messages[data-v-9073ba4e]{padding:0 16px 16px;font-size:14px;line-height:1.6}.user-question[data-v-9073ba4e]{color:#60a5fa;font-weight:700;border:1px solid #60a5fa;padding:15px;margin:15px;border-radius:10px;display:inline-block;max-width:80%;text-align:left}.ai-thought[data-v-9073ba4e]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-9073ba4e]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-input[data-v-9073ba4e]{color:#60a5fa;margin-left:8px}.build-info[data-v-9073ba4e]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-images[data-v-9073ba4e]{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.chat-image-thumb[data-v-9073ba4e]{width:120px;height:120px;-o-object-fit:cover;object-fit:cover;border-radius:6px;border:1px solid #3f3f46;cursor:zoom-in;transition:border-color .2s}.chat-image-thumb[data-v-9073ba4e]:hover{border-color:#60a5fa}.chat-input-area[data-v-9073ba4e]{padding:12px 16px;background:#121212;border-top:1px solid #1e1e1e}.input-panel[data-v-9073ba4e]{background:#fff;border-radius:6px;border:1px solid #e0e0e0;overflow:hidden}.input-wrapper[data-v-9073ba4e]{position:relative}.input-area[data-v-9073ba4e]{flex:1}.input-area[data-v-9073ba4e] .el-textarea__inner{border:none;border-radius:0;background:#fff;color:#4b5563;resize:none}.input-area[data-v-9073ba4e] .el-textarea__inner:focus{box-shadow:none}.input-panel .input-actions[data-v-9073ba4e]{display:flex;justify-content:space-between;align-items:center;padding:6px 12px;gap:6px;background:#fff}.input-actions-left[data-v-9073ba4e],.input-actions-right[data-v-9073ba4e]{display:flex;align-items:center;gap:6px}.input-panel .status-action[data-v-9073ba4e]{cursor:pointer;font-size:12px;color:#6b7280}.input-panel .status-action[data-v-9073ba4e]:hover{color:#60a5fa}.input-panel .separator[data-v-9073ba4e]{color:#d1d5db;font-size:12px}.status-bar[data-v-9073ba4e]{display:flex;gap:8px;align-items:center;padding:6px 16px;font-size:12px;color:#84848a;border-top:1px solid #1e1e1e;flex-shrink:0;flex-wrap:wrap;background:#0a0a09}.status-bar .separator[data-v-9073ba4e]{color:#3f3f46}.status-ready[data-v-9073ba4e]{color:#22c55e}.status-thinking[data-v-9073ba4e]{color:#60a5fa}.model-selector[data-v-9073ba4e]{cursor:pointer}.model-selector[data-v-9073ba4e]:hover{color:#60a5fa}.thinking-spinner[data-v-9073ba4e]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-9073ba4e .8s linear infinite}@keyframes spin-9073ba4e{to{transform:rotate(360deg)}}.device-frame[data-v-18d9a9df]{height:100%;max-width:100%}.device-frame>iframe[data-v-18d9a9df]{flex:1;min-height:0}.device-frame-app[data-v-18d9a9df]{position:relative;background:#1a1a1a;border-radius:36px;padding:8px;box-shadow:0 0 0 2px #333,0 0 0 4px #1a1a1a,0 0 0 6px #444,0 20px 40px #00000080}.device-frame-app[data-v-18d9a9df]:before{content:"";position:absolute;top:4px;left:50%;transform:translate(-50%);width:120px;height:25px;background:#1a1a1a;border-radius:0 0 16px 16px;z-index:10}.device-frame-app[data-v-18d9a9df]:after{content:"";position:absolute;bottom:4px;left:50%;transform:translate(-50%);width:100px;height:4px;background:#444;border-radius:2px;z-index:10}.device-frame-web[data-v-18d9a9df]{width:100%;background:#2d2d2d;border-radius:12px;padding:12px;box-shadow:0 4px 20px #0006}.device-frame-pad[data-v-18d9a9df]{background:#1a1a1a;border-radius:16px;padding:10px;box-shadow:0 0 0 2px #444,0 0 0 4px #2a2a2a,0 0 0 6px #555,0 20px 40px #00000080}.monaco-editor-container[data-v-f53b2118]{width:100%;overflow:hidden}.monaco-editor-container[data-v-f53b2118] .monaco-editor{padding-top:8px}.monaco-editor-container[data-v-f53b2118] .monaco-editor .overflow-guard{overflow:hidden!important}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{n as l,a as r,C as h,f as u,R as f,I as p,S as m,F as g,c as v,M as b,g as x,s as C,b as w,e as y,K as _,d as S}from"./index-Cn73hS12.js";import{m as P}from"./mediaChat-RT7iqqYb.js";const k={name:"CreatePageDialog",props:{visible:{type:Boolean,default:!1},targetPath:{type:String,default:""}},data(){return{pageName:"",pageType:"web",deviceTypes:[{value:"app",label:"App",icon:"fa-solid fa-mobile-screen"},{value:"web",label:"Web",icon:"fa-solid fa-desktop"},{value:"pad",label:"Pad",icon:"fa-solid fa-tablet-screen-button"}]}},computed:{previewFilename(){return`${this.pageName.trim()||"untitled"}_${this.pageType}.html`}},watch:{visible(s){s&&(this.pageName="",this.pageType="web",this.$nextTick(()=>{var e;return(e=this.$refs.nameInput)==null?void 0:e.focus()}))}},methods:{async confirm(){const s=this.pageName.trim();if(!s)return;const e=`${s}_${this.pageType}.html`,t=this.targetPath.includes("\\")?"\\":"/",i=this.targetPath+t+e,a=`<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-CN">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>${s}</title>
|
|
7
|
-
<style>
|
|
8
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
9
|
-
body { font-family: system-ui, sans-serif; padding: 20px; }
|
|
10
|
-
</style>
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<h1>${s}</h1>
|
|
14
|
-
</body>
|
|
15
|
-
</html>`;try{await r.writeFile(i,a),this.$message.success("网页创建成功"),this.$emit("created"),this.$emit("update:visible",!1)}catch(n){console.error("Create page failed:",n),this.$message.error("创建网页失败: "+(n.message||"未知错误"))}},cancel(){this.$emit("update:visible",!1)}}};var D=function(){var e=this,t=e._self._c;return e.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",on:{click:function(i){return i.target!==i.currentTarget?null:e.cancel.apply(null,arguments)}}},[t("div",{staticClass:"bg-sidebar border border-border rounded p-5 w-96"},[t("p",{staticClass:"text-white text-sm font-medium mb-4"},[e._v("新建网页")]),t("div",{staticClass:"mb-3"},[t("label",{staticClass:"text-textMuted text-xs block mb-1"},[e._v("名称")]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.pageName,expression:"pageName"}],ref:"nameInput",staticClass:"w-full px-3 py-2 bg-[#1e1e1e] border border-border rounded text-white text-sm focus:outline-none focus:border-accent",attrs:{placeholder:"输入网页名称"},domProps:{value:e.pageName},on:{keyup:[function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.confirm.apply(null,arguments)},function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"escape",void 0,i.key,void 0)?null:e.cancel.apply(null,arguments)}],input:function(i){i.target.composing||(e.pageName=i.target.value)}}})]),t("div",{staticClass:"mb-3"},[t("label",{staticClass:"text-textMuted text-xs block mb-2"},[e._v("类型")]),t("div",{staticClass:"flex gap-2"},e._l(e.deviceTypes,function(i){return t("label",{key:i.value,staticClass:"flex items-center gap-1 px-3 py-2 rounded border text-sm cursor-pointer transition-colors",class:e.pageType===i.value?"border-accent bg-accent/10 text-white":"border-border text-textMuted hover:border-gray-500"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.pageType,expression:"pageType"}],staticClass:"hidden",attrs:{type:"radio"},domProps:{value:i.value,checked:e._q(e.pageType,i.value)},on:{change:function(a){e.pageType=i.value}}}),t("i",{staticClass:"text-xs",class:i.icon}),e._v(" "+e._s(i.label)+" ")])}),0)]),t("div",{staticClass:"mb-4 p-3 bg-[#1e1e1e] rounded border border-border"},[t("p",{staticClass:"text-xs text-textMuted mb-1"},[e._v("文件名预览")]),t("p",{staticClass:"text-xs text-textMain font-mono"},[e._v(e._s(e.previewFilename))])]),t("div",{staticClass:"flex justify-end gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs text-textMuted hover:text-white",on:{click:e.cancel}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-accent text-white rounded hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed",attrs:{disabled:!e.pageName.trim()},on:{click:e.confirm}},[e._v("确定")])])])]):e._e()},M=[],F=l(k,D,M,!1,null,null);const $=F.exports,T={name:"DesignPageTree",components:{FileTreeNode:u,CreatePageDialog:$,CopyPathDialog:h},props:{basePath:{type:String,default:".txcode/design"}},data(){return{browseResult:{current_path:"",parent_path:null,items:[]},selectedPath:"",loading:!1,expandedPaths:new Set,contextMenu:{visible:!1,x:0,y:0,target:null},renameDialog:{visible:!1,title:"",value:"",placeholder:"",target:null,action:"rename"},createPageDialogVisible:!1,createPageTargetPath:""}},computed:{fileTreeData(){return this.browseResult.items.filter(e=>e.name!=="session.json").map(e=>({name:e.name,path:e.path,is_directory:e.is_directory,is_drive:e.is_drive||!1,size:e.size,has_children:e.is_directory,expanded:!1,children:[]})).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)}},async created(){await this.initBrowse(),document.addEventListener("click",this.hideContextMenu)},beforeDestroy(){document.removeEventListener("click",this.hideContextMenu)},methods:{async initBrowse(){this.loading=!0;try{const s=await r.browseFilesystem(this.basePath);this.browseResult=s.data}catch{try{await r.createDirectory(this.basePath);const e=await r.browseFilesystem(this.basePath);this.browseResult=e.data}catch(e){console.error("Init design directory failed:",e),this.browseResult={current_path:this.basePath,parent_path:"",items:[]}}}finally{this.loading=!1}},async browse(s){this.loading=!0;try{const e=await r.browseFilesystem(s);this.browseResult=e.data}catch(e){console.error("Browse failed:",e)}finally{this.loading=!1}},refresh(){this.browse(this.browseResult.current_path||this.basePath)},createRootFolder(){this.renameDialog={visible:!0,title:"新建文件夹",value:"",placeholder:"输入文件夹名",target:{path:this.browseResult.current_path||this.basePath,is_directory:!0},action:"createFolder"},this.$nextTick(()=>{var s;return(s=this.$refs.renameInput)==null?void 0:s.focus()})},handleSelect(s){this.selectedPath=s.path;let e=s.path;e.startsWith(this.basePath+"/")?e=e.slice(this.basePath.length+1):e===this.basePath&&(e=""),!s.is_directory&&e.endsWith(".html")?(console.log("[DesignPageTree] handleSelect emitting current-page:",e),this.$emit("current-page",e)):console.log("[DesignPageTree] handleSelect skipping (dir or non-html):",s.name,"isDir:",s.is_directory)},handleOpenFile(s){this.$emit("open-file",s)},async handleLoadChildren({path:s,callback:e}){try{const i=((await r.browseFilesystem(s)).data.items||[]).filter(a=>a.name!=="session.json").map(a=>({name:a.name,path:a.path,is_directory:a.is_directory,is_drive:!1,size:a.size,has_children:a.is_directory,expanded:!1,children:[]}));e(i.sort((a,n)=>a.is_directory===n.is_directory?a.name.localeCompare(n.name):a.is_directory?-1:1))}catch(t){console.error("Load children failed:",t),e([])}},showContextMenu(s,e){e&&(s.preventDefault(),this.contextMenu={visible:!0,x:s.pageX,y:s.pageY,target:e},this.selectedPath=e.path)},hideContextMenu(){this.contextMenu.visible=!1},copyPath(){this.hideContextMenu(),this.$refs.copyPathDialog.open(this.contextMenu.target.path)},createNewPage(){this.hideContextMenu(),this.createPageTargetPath=this.contextMenu.target.path,this.createPageDialogVisible=!0},createNewFolder(){this.hideContextMenu();const s=this.contextMenu.target;this.renameDialog={visible:!0,title:"新建文件夹",value:"",placeholder:"输入文件夹名",target:s,action:"createFolder"},this.$nextTick(()=>{var e;return(e=this.$refs.renameInput)==null?void 0:e.focus()})},renameItem(){this.hideContextMenu();const s=this.contextMenu.target;s.is_directory?this.renameDialog={visible:!0,title:"重命名文件夹",value:s.name,placeholder:"输入新名称",target:s,action:"rename"}:this.renameDialog={visible:!0,title:"重命名文件",value:s.name,placeholder:"输入新名称",target:s,action:"rename"},this.$nextTick(()=>{var e,t;(e=this.$refs.renameInput)==null||e.focus(),(t=this.$refs.renameInput)==null||t.select()})},confirmRename(){const{value:s,target:e,action:t}=this.renameDialog;if(!s.trim()){this.renameDialog.visible=!1;return}const i=e.path.includes("\\")?"\\":"/";let a,n;t==="createFolder"?(a=e.path+i+s.trim(),n=r.createDirectory(a)):(a=e.path.substring(0,e.path.lastIndexOf(i))+i+s.trim(),n=r.renameFile(e.path,a)),n.then(()=>{this.refresh(),this.$emit("file-changed")}).catch(o=>{console.error("Operation failed:",o),this.$message.error(t==="createFolder"?"创建文件夹失败":"重命名失败")}),this.renameDialog.visible=!1},cancelRename(){this.renameDialog.visible=!1},async deleteItem(){this.hideContextMenu();try{await this.$confirm(`确定要删除 "${this.contextMenu.target.name}" 吗?`,"确认删除",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}),await r.deleteFile(this.contextMenu.target.path),this.$message.success("删除成功"),this.refresh(),this.$emit("file-changed")}catch(s){s!=="cancel"&&(console.error("Delete failed:",s),this.$message.error("删除失败"))}},downloadFile(){this.hideContextMenu();const s=this.contextMenu.target;s&&r.downloadFilesystemWithProgress(s.path,s.name,()=>{}).catch(e=>this.$message.error("下载失败: "+e.message))},onPageCreated(){this.createPageDialogVisible=!1,this.refresh(),this.$emit("file-changed")},onExpandPath(s){const e=new Set(this.expandedPaths);e.add(s),this.expandedPaths=e},onCollapsePath(s){const e=new Set(this.expandedPaths);e.delete(s),this.expandedPaths=e}}};var I=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col flex-1 min-h-0"},[t("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.refresh}},[t("i",{staticClass:"fa-solid fa-refresh"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"新建文件夹"},on:{click:e.createRootFolder}},[t("i",{staticClass:"fa-solid fa-folder-plus"})])]),t("div",{staticClass:"flex-1 overflow-y-auto py-1 pb-8 sidebar-scroll",staticStyle:{"padding-bottom":"60px"}},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"flex flex-col items-center justify-center py-12 text-textMuted text-sm"},[t("i",{staticClass:"fa-solid fa-folder-open text-4xl mb-3 opacity-20"}),t("p",[e._v("设计目录为空")]),t("p",{staticClass:"text-xs mt-1"},[e._v("右键文件夹创建网页")])]):e._l(e.fileTreeData,function(a){return t("file-tree-node",{key:a.path,attrs:{node:a,level:0,"selected-path":e.selectedPath,"expanded-paths":e.expandedPaths},on:{select:e.handleSelect,"open-file":e.handleOpenFile,"load-children":e.handleLoadChildren,contextmenu:e.showContextMenu,"expand-path":e.onExpandPath,"collapse-path":e.onCollapsePath}})})],2),t("div",{directives:[{name:"show",rawName:"v-show",value:e.contextMenu.visible,expression:"contextMenu.visible"}],staticClass:"fixed bg-sidebar border border-border rounded shadow-lg py-1 z-50 min-w-[160px]",style:{left:e.contextMenu.x+"px",top:e.contextMenu.y+"px"}},[(i=e.contextMenu.target)!=null&&i.is_directory?[t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.createNewPage}},[t("i",{staticClass:"fa-solid fa-file-lines text-xs"}),e._v(" 新建网页 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.createNewFolder}},[t("i",{staticClass:"fa-solid fa-folder-plus text-xs"}),e._v(" 新建文件夹 ")]),t("div",{staticClass:"border-t border-border my-1"}),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen text-xs"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-active flex items-center gap-2",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash text-xs"}),e._v(" 删除 ")])]:[t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy text-xs"}),e._v(" 复制路径 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.downloadFile}},[t("i",{staticClass:"fa-solid fa-download text-xs"}),e._v(" 下载 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen text-xs"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-active flex items-center gap-2",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash text-xs"}),e._v(" 删除 ")])]],2),t("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(a){return a.target!==a.currentTarget?null:e.cancelRename.apply(null,arguments)}}},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v(e._s(e.renameDialog.title))]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.renameDialog.value,expression:"renameDialog.value"}],ref:"renameInput",staticClass:"w-full px-3 py-2 bg-[#1e1e1e] border border-border rounded text-white text-sm focus:outline-none focus:border-accent",attrs:{placeholder:e.renameDialog.placeholder},domProps:{value:e.renameDialog.value},on:{keyup:[function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.confirmRename.apply(null,arguments)},function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"escape",void 0,a.key,void 0)?null:e.cancelRename.apply(null,arguments)}],input:function(a){a.target.composing||e.$set(e.renameDialog,"value",a.target.value)}}}),t("div",{staticClass:"flex justify-end gap-2 mt-4"},[t("button",{staticClass:"px-3 py-1 text-xs text-textMuted hover:text-white",on:{click:e.cancelRename}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-accent text-white rounded hover:bg-blue-600",on:{click:e.confirmRename}},[e._v("确定")])])])]),t("CreatePageDialog",{attrs:{visible:e.createPageDialogVisible,"target-path":e.createPageTargetPath},on:{"update:visible":function(a){e.createPageDialogVisible=a},created:e.onPageCreated}}),t("CopyPathDialog",{ref:"copyPathDialog"})],1)},N=[],V=l(T,I,N,!1,null,"77cb22d9");const R=V.exports,z={name:"DesignAiChat",components:{ModelSelectDialog:b,CommandDialog:v,FileSelectDialog:g,SkillSelectDialog:m,ImagePreviewList:p,ResizableTextarea:f},mixins:[P()],props:{basePath:{type:String,default:".txcode/design"},currentPage:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,skillSelectVisible:!1,skillCursorPos:-1,sessionId:"",sessionStatus:"idle",wsUnsubscribe:null,requestSeq:0}},watch:{currentPage:{immediate:!1,handler(s){this.loadSessionForPage(s)}}},async mounted(){await this.loadDefaultModel(),r.ws.init(),this.currentPage&&await this.loadSessionForPage(this.currentPage)},beforeDestroy(){this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{getSessionJsonPath(){return this.basePath+"/session.json"},async readSessionJson(){var s;try{const e=await r.getFileContent(this.getSessionJsonPath());if(e&&((s=e.data)!=null&&s.content)){const t=JSON.parse(e.data.content);if(t.pageSessions){const i={};for(const[a,n]of Object.entries(t.pageSessions))a.endsWith(".html")&&a!=="session.json"&&(i[a]=n);Object.keys(i).length!==Object.keys(t.pageSessions).length&&(t.pageSessions=i,this.writeSessionJson(t).catch(()=>{}))}return t}}catch{}return{pageSessions:{}}},async writeSessionJson(s){await r.writeFile(this.getSessionJsonPath(),JSON.stringify(s,null,2))},async loadSessionForPage(s){var n;const e=++this.requestSeq;console.log("[DesignAiChat] loadSessionForPage called:",s,"seq:",e);const t=performance.now();if(!s||!s.endsWith(".html")){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null),this.sessionId="",this.logItems=[],this.promptTokens=0,this.sessionStatus="idle",this.$emit("status-change","idle"),console.log("[DesignAiChat] loadSessionForPage skipped (not html):",s);return}const i=await this.readSessionJson();if(this.requestSeq!==e)return;console.log("[DesignAiChat] sessionData loaded:",Object.keys(i.pageSessions||{}));const a=(n=i.pageSessions)==null?void 0:n[s];if(console.log("[DesignAiChat] pageSession for",s,":",!!a),a!=null&&a.sessionId)try{console.log("[DesignAiChat] loading existing session:",a.sessionId);const o=performance.now(),c=await r.getSession(a.sessionId);if(this.requestSeq!==e)return;if(console.log("[DesignAiChat] getSession took:",(performance.now()-o).toFixed(1),"ms"),c&&c.data){this.sessionId=a.sessionId,this.subscribeSession();const d=performance.now();if(await this.loadMessages(),this.requestSeq!==e)return;console.log("[DesignAiChat] loadMessages took:",(performance.now()-d).toFixed(1),"ms"),console.log("[DesignAiChat] loadSessionForPage done (existing), total:",(performance.now()-t).toFixed(1),"ms");return}}catch(o){console.error("[DesignAiChat] getSession failed:",o)}try{console.log("[DesignAiChat] creating new session for:",s);const o=await r.createSession(`设计页面: ${s}`);if(this.requestSeq!==e||(this.sessionId=o.data.id,i.pageSessions[s]={sessionId:this.sessionId},await this.writeSessionJson(i),this.requestSeq!==e))return;this.logItems=[],this.promptTokens=0,this.subscribeSession(),console.log("[DesignAiChat] loadSessionForPage done (new), total:",(performance.now()-t).toFixed(1),"ms")}catch(o){console.error("Create session failed:",o)}},async loadDefaultModel(){var s;try{const e=await r.getConfig("defaultModel");this.modelName=((s=e.data)==null?void 0:s.value)||""}catch(e){console.error("Load model failed:",e)}},async loadMessages(){if(this.sessionId)try{const s=await r.getMessages(this.sessionId);this.logItems=s.data||[],this.$nextTick(()=>this.scrollChatToBottom(!0))}catch(s){console.error("Load messages failed:",s)}},handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
|
|
16
|
-
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async sendMessage(){const s=this.inputMessage.trim(),e=this.mediaFiles&&this.mediaFiles.length>0;if(!s&&!e||this.disabled)return;if(!this.sessionId){this.$message.error("请在左侧选择设计页面");return}this.wsUnsubscribe||this.subscribeSession();let t=s;this.currentPage&&(t=`当前设计页面:${this.currentPage}
|
|
17
|
-
用户需求:${s}
|
|
18
|
-
请基于以上设计页面路径,对该页面进行设计或修改。`),this.inputMessage="",this.disabled=!0,this.stopping=!1;const i=(this.mediaFiles||[]).filter(a=>!a.uploading&&a.filePath).map(a=>({filePath:a.filePath,type:a.type,dataUrl:a.dataUrl}));this.logItems.push({type:"chat",content:s,mediaFiles:i}),this.scrollChatToBottom(!0),r.sessionWsSend(this.sessionId,"chat",{message:t,sessionId:this.sessionId,modelName:this.modelName||void 0,agent:"design",mediaFiles:i.map(a=>({filePath:a.filePath,type:a.type}))}),this.mediaFiles=[]},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,r.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=r.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t,this.$emit("status-change",this.sessionStatus)},step:s=>{var e;this.logItems.push({type:"step",thought:s.thought,toolCalls:s.toolCalls,success:s.success}),(e=s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollChatToBottom()},compact:()=>{this.logItems.push({type:"system",content:"【会话已压缩】"}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",this.$emit("status-change","completed"),s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollChatToBottom(),this.$emit("design-updated")},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.$emit("status-change","idle"),this.logItems.push({type:"think",content:"【已停止】"}),this.scrollChatToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.$emit("status-change","idle")}}))},scrollChatToBottom(s=!1){const e=C(this.$refs.messagesContainer);this.$nextTick(()=>w(this.$refs.messagesContainer,{force:s,prevSnapshot:e}))},renderMarkdown(s){return s?x(s,{breaks:!0}):""},formatInput(s,e){try{const t=typeof e=="string"?JSON.parse(e):e;return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:JSON.stringify(t)}catch{return e}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,r.setConfig("defaultModel",this.modelName)},openCommandDialog(){this.commandDialogVisible=!0},handleExecuteCommand(s){this.inputMessage=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".input-area textarea");e&&e.focus()})},openFileSelect(){this.fileSelectVisible=!0},onFileSelected(s){const e=this.inputMessage.lastIndexOf("@");e!==-1?this.inputMessage=this.inputMessage.slice(0,e)+s+" ":this.inputMessage+=s+" ",this.cancelFileSelect()},cancelFileSelect(){this.fileSelectVisible=!1},openSkillSelect(){const s=this.$el.querySelector(".input-area textarea");this.skillCursorPos=s?s.selectionStart:-1,this.skillSelectVisible=!0},onSkillSelected(s){const e=`[${s}] `,t=this.skillCursorPos>=0?this.skillCursorPos:0;this.inputMessage=this.inputMessage.slice(0,t)+e+this.inputMessage.slice(t),this.cancelSkillSelect()},cancelSkillSelect(){this.skillSelectVisible=!1}}};var E=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col flex-1 min-h-0"},[t("div",{ref:"messagesContainer",staticClass:"chat-messages flex-1 overflow-y-auto px-3 py-2 min-h-0"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-robot text-4xl mb-3 opacity-20 block text-center"}),t("p",{staticClass:"text-sm text-textMuted text-center"},[e._v("AI设计助手可协助您分析和优化设计")]),t("p",{staticClass:"text-xs text-textMuted text-center mt-1"},[e._v("Enter 发送,Ctrl+Enter 换行")])]),e._l(e.logItems,function(i,a){return[i.type==="chat"?t("div",{key:a,staticClass:"flex justify-end mb-3"},[t("div",{staticClass:"user-question"},[i.mediaFiles&&i.mediaFiles.length>0?t("div",{staticClass:"chat-images mb-1"},e._l(i.mediaFiles,function(n){return t("img",{key:n.filePath,staticClass:"chat-image-thumb",attrs:{src:n.url||n.dataUrl||n.filePath},on:{click:function(o){return o.stopPropagation(),e.openImagePreview(n)}}})}),0):e._e(),t("div",{staticClass:"text-sm"},[e._v(e._s(i.content))])])]):i.type==="system"?t("div",{key:a,staticClass:"system-message mb-2",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought mb-2",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(n,o){return t("div",{key:o,staticClass:"log-mute text-xs text-textMuted mb-1"},[t("span",{class:i.success!==!1?"text-green-400":"text-red-400"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(n.function.name)+" "),n.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(n.function.name,n.function.arguments)))]):e._e()])})]:i.type==="think"?t("div",{key:a,staticClass:"ai-thought mb-2",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area flex-shrink-0"},[e.mediaFiles&&e.mediaFiles.length>0?t("ImagePreviewList",{attrs:{files:e.mediaFiles,disabled:e.disabled},on:{remove:e.removeMedia}}):e._e(),t("div",{staticClass:"input-panel"},[t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:5,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},on:{"paste-image":e.handlePasteImages},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("input",{ref:"mediaInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:e.handleImageSelected}})],1),t("div",{staticClass:"input-actions"},[t("div",{staticClass:"input-actions-left"},[t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openSkillSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")])]),t("div",{staticClass:"input-actions-right"},[t("el-button",{staticClass:"upload-btn",attrs:{disabled:e.disabled,size:"small"},on:{click:e.handleImageUpload}},[e._v("图片")]),e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger",size:"small"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:"",size:"small"}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()&&(!e.mediaFiles||e.mediaFiles.length===0),size:"small"},on:{click:e.sendMessage}},[e._v(" 发送 ")])],1)])]),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))])])],1),e.previewImage?t("div",{staticClass:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",on:{click:e.closeImagePreview}},[t("span",{staticClass:"absolute top-4 right-4 text-white text-2xl cursor-pointer"},[e._v("×")]),t("img",{staticClass:"max-w-[90vw] max-h-[90vh]",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e(),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:e.cancelFileSelect}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:e.cancelSkillSelect}})],1)},L=[],j=l(z,E,L,!1,null,"9073ba4e");const q=j.exports,A={name:"DesignSidebar",components:{DesignPageTree:R,DesignAiChat:q},props:{basePath:{type:String,default:".txcode/design"}},data(){return{activeTab:"pages",currentPage:""}}};var O=function(){var e=this,t=e._self._c;return t("aside",{staticClass:"bg-[#121212] border border-[#1e1e1e] flex flex-col shrink-0 overflow-hidden",staticStyle:{width:"480px"}},[t("div",{staticClass:"flex border-b border-[#1e1e1e] bg-[#121212]"},[t("div",{staticClass:"flex-1 text-center px-3 py-2.5 cursor-pointer text-sm border-b-2 transition-colors",class:e.activeTab==="pages"?"border-[#60a5fa] text-[#f4f4f5]":"border-transparent text-[#84848a] hover:text-[#f4f4f5]",on:{click:function(i){e.activeTab="pages"}}},[t("i",{staticClass:"fa-solid fa-file-code mr-1"}),e._v(" 设计页面 ")]),t("div",{staticClass:"flex-1 text-center px-3 py-2.5 cursor-pointer text-sm border-b-2 transition-colors",class:e.activeTab==="ai"?"border-[#60a5fa] text-[#f4f4f5]":"border-transparent text-[#84848a] hover:text-[#f4f4f5]",on:{click:function(i){e.activeTab="ai"}}},[t("i",{staticClass:"fa-solid fa-robot mr-1"}),e._v(" AI设计助手 ")])]),t("DesignPageTree",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="pages",expression:"activeTab === 'pages'"}],attrs:{"base-path":e.basePath},on:{"open-file":function(i){return e.$emit("open-file",i)},"current-page":function(i){e.currentPage=i},"file-changed":function(i){return e.$emit("file-changed")}}}),e.activeTab==="ai"?t("DesignAiChat",{attrs:{"base-path":e.basePath,"current-page":e.currentPage},on:{"design-updated":function(i){return e.$emit("file-changed")},"status-change":function(i){return e.$emit("ai-status-change",i)}}}):e._e()],1)},B=[],U=l(A,O,B,!1,null,null);const J=U.exports,W={name:"DesignPreview",props:{fileContent:{type:String,default:""},fileName:{type:String,default:""},relativePath:{type:String,default:""}},data(){return{activeDevice:"web",refreshKey:0,renderIframe:!1,_relativePathVersion:0,deviceSizes:[{value:"app",label:"App",icon:"fa-solid fa-mobile-screen",width:375},{value:"web",label:"Web",icon:"fa-solid fa-desktop",width:0},{value:"pad",label:"Pad",icon:"fa-solid fa-tablet-screen-button",width:768}]}},computed:{previewSrc(){if(!this.relativePath)return"";const s=`/design_html/${encodeURI(this.relativePath)}?_=${this._relativePathVersion}`;return console.log("[DesignPreview] previewSrc computed:",s),s},iframeStyle(){return{width:"100%",height:"100%"}},frameStyle(){switch(this.activeDevice){case"app":return{width:"390px"};case"pad":return{width:"800px"};default:return{}}}},watch:{fileName:{immediate:!0,handler(s){s&&(s.includes("_app.html")?this.activeDevice="app":s.includes("_web.html")?this.activeDevice="web":s.includes("_pad.html")?this.activeDevice="pad":this.activeDevice="web",console.log("[DesignPreview] fileName changed:",s,"→ activeDevice:",this.activeDevice))}},relativePath(s,e){console.log("[DesignPreview] relativePath changed:",e,"→",s),s?(this._relativePathVersion++,console.log("[DesignPreview] _relativePathVersion:",this._relativePathVersion),this.renderIframe=!1,console.log("[DesignPreview] renderIframe set to false, scheduling recreate"),this.$nextTick(()=>{this.renderIframe=!0,console.log("[DesignPreview] renderIframe set to true, iframe should be created with src:",this.previewSrc)})):(this.renderIframe=!1,console.log("[DesignPreview] renderIframe set to false (no file)"))}},mounted(){console.log("[DesignPreview] mounted, relativePath:",this.relativePath)},updated(){console.log("[DesignPreview] updated, relativePath:",this.relativePath,"previewSrc:",this.previewSrc)},beforeDestroy(){console.log("[DesignPreview] beforeDestroy")},methods:{refreshPreview(){this.refreshKey++,this._relativePathVersion++,this.renderIframe=!1,this.$nextTick(()=>{this.renderIframe=!0,console.log("[DesignPreview] refreshPreview, iframe recreated")})},openInNewTab(){this.previewSrc&&window.open(this.previewSrc,"_blank")},onIframeLoad(){console.log("[DesignPreview] iframe onload, src:",this.previewSrc)}}};var K=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col h-full"},[t("div",{staticClass:"flex items-center gap-2 px-3 py-2 border-b border-border bg-sidebar"},[t("span",{staticClass:"text-xs text-textMuted mr-2"},[e._v("视口:")]),e._l(e.deviceSizes,function(i){return t("button",{key:i.value,staticClass:"px-3 py-1 text-xs rounded border transition-colors",class:e.activeDevice===i.value?"border-accent bg-accent/10 text-white":"border-transparent text-textMuted hover:border-gray-500",attrs:{title:i.label},on:{click:function(a){e.activeDevice=i.value}}},[t("i",{staticClass:"mr-1",class:i.icon}),e._v(e._s(i.label)+" ")])})],2),t("div",{staticClass:"flex-1 flex items-center justify-center overflow-auto bg-[#f5f5f5] p-4"},[e.relativePath?t("div",{staticClass:"device-frame flex flex-col self-stretch",class:`device-frame-${e.activeDevice}`,style:e.frameStyle},[t("div",{staticClass:"flex justify-end mb-2 shrink-0 gap-1"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white text-xs rounded hover:bg-white/10 transition-colors",attrs:{title:"新窗口打开"},on:{click:e.openInNewTab}},[t("i",{staticClass:"fa-solid fa-up-right-from-square"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-white text-xs rounded hover:bg-white/10 transition-colors",attrs:{title:"刷新预览"},on:{click:e.refreshPreview}},[t("i",{staticClass:"fa-solid fa-refresh"})])]),e.renderIframe?t("iframe",{ref:"previewFrame",staticClass:"w-full border-0",style:e.iframeStyle,attrs:{src:e.previewSrc,sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-popups"},on:{load:e.onIframeLoad}}):e._e()]):t("div",{staticClass:"text-textMuted text-center mt-20"},[t("i",{staticClass:"fa-solid fa-eye text-6xl mb-4 opacity-20 block"}),t("p",[e._v("双击左侧 HTML 文件预览")])])])])},H=[],X=l(W,K,H,!1,null,"18d9a9df");const Y=X.exports,G={name:"DesignEditor",props:{fileContent:{type:String,default:""},fileName:{type:String,default:""},filePath:{type:String,default:""}},data(){return{editor:null,originalContent:"",contentChanged:!1,saving:!1}},watch:{fileContent:{immediate:!0,handler(s){if(!this.fileName||!this.editor&&(this.initEditor(),!this.editor))return;const e=s||"";this.editor.getValue()!==e&&(this.originalContent=e,this.editor.setValue(e),this.contentChanged=!1)}}},mounted(){this.$nextTick(()=>this.initEditor())},beforeDestroy(){this.editor&&(this.editor.dispose(),this.editor=null)},methods:{initEditor(){this.editor||this.$refs.editorContainer&&this.fileName&&(this.editor=y.create(this.$refs.editorContainer,{value:this.fileContent||"",language:"html",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on",scrollbar:{useShadows:!1,vertical:"auto",horizontal:"auto"}}),this.originalContent=this.fileContent||"",this.editor.onDidChangeModelContent(()=>{this.editor&&(this.contentChanged=this.editor.getValue()!==this.originalContent,this.$emit("content-changed",this.contentChanged))}),this.editor.addCommand(_.CtrlCmd|S.KeyS,()=>{this.saveFile()}))},updateContent(s){if(!this.editor){this.initEditor(),this.$nextTick(()=>this.updateContent(s));return}this.originalContent=s,this.editor.setValue(s),this.contentChanged=!1},layout(){!this.editor&&this.fileName&&this.initEditor(),this.editor&&this.$nextTick(()=>this.editor.layout())},async saveFile(){if(!(!this.editor||!this.filePath)){this.saving=!0;try{const s=this.editor.getValue();await r.writeFile(this.filePath,s),this.originalContent=s,this.contentChanged=!1,this.$emit("content-saved",s),this.$emit("content-changed",!1),this.$message.success("文件已保存")}catch(s){console.error("Save failed:",s),this.$message.error("保存文件失败")}finally{this.saving=!1}}}}};var Q=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex flex-col h-full"},[e.fileName?e._e():t("div",{staticClass:"flex-1 flex items-center justify-center text-textMuted"},[e._m(0)]),t("div",{directives:[{name:"show",rawName:"v-show",value:e.fileName,expression:"fileName"}],ref:"editorContainer",staticClass:"monaco-editor-container flex-1"}),e.fileName?t("div",{staticClass:"h-8 bg-sidebar border-t border-border flex items-center justify-between px-3 shrink-0"},[t("div",{staticClass:"flex items-center gap-4 text-xs text-textMuted"},[t("span",[e._v(e._s(e.fileName))]),e.contentChanged?t("span",{staticClass:"text-yellow-500"},[e._v("已修改")]):e._e()]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white text-xs rounded hover:bg-white/10 transition-colors",attrs:{title:"刷新内容"},on:{click:function(i){return e.$emit("refresh")}}},[t("i",{staticClass:"fa-solid fa-refresh"})]),t("button",{staticClass:"px-3 py-1 text-xs bg-accent text-white rounded hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed",attrs:{disabled:!e.contentChanged||e.saving},on:{click:e.saveFile}},[e.saving?t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-1"}):t("i",{staticClass:"fa-solid fa-save mr-1"}),e._v(" 保存 ")])])]):e._e()])},Z=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-file-code text-6xl mb-4 opacity-20 block"}),e("p",[s._v("双击左侧 HTML 文件编辑")])])}],ee=l(G,Q,Z,!1,null,"f53b2118");const te=ee.exports,se={name:"DesignView",components:{DesignSidebar:J,DesignPreview:Y,DesignEditor:te},data(){return{rightTab:"preview",designBasePath:".txcode/design",fileContent:"",activeFileName:"",activeFilePath:"",relativePath:"",hasChanges:!1,isResizing:!1,aiStatus:"idle"}},mounted(){document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),this.updateTitle()},watch:{rightTab(s){console.log("[DesignView] rightTab changed:",s),s==="editor"&&this.activeFilePath&&!this.fileContent&&(console.log("[DesignView] switching to editor, loading file content for:",this.activeFilePath),this.loadFileContent()),s==="editor"&&this.$nextTick(()=>{this.$refs.editor&&this.$refs.editor.layout()})},aiStatus(){this.updateTitle()}},beforeDestroy(){document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize)},methods:{updateTitle(){var t;const s=((t=this.$route.meta)==null?void 0:t.title)||"AI设计";let e="";this.aiStatus==="processing"?e="⏳ ":this.aiStatus==="completed"&&(e="✅ "),document.title=`${e}${s} - TXCode`},onAiStatusChange(s){this.aiStatus=s,this.updateTitle()},async openFile(s){if(console.log("[DesignView] openFile called, node:",s.name,"path:",s.path,"is_dir:",s.is_directory),s.is_directory)return;this.activeFileName=s.name,this.activeFilePath=s.path;const e=this.extractRelativePath(s.path);console.log("[DesignView] extractRelativePath result:",e),this.relativePath=e,this.fileContent="",this.hasChanges=!1,this.rightTab="preview",console.log("[DesignView] openFile done, relativePath:",this.relativePath,"fileContent deferred to editor tab")},async loadFileContent(){var s;if(this.activeFilePath){console.log("[DesignView] loadFileContent:",this.activeFilePath);try{const e=performance.now(),t=await r.getFileContent(this.activeFilePath);console.log("[DesignView] getFileContent took:",(performance.now()-e).toFixed(1),"ms"),this.fileContent=((s=t.data)==null?void 0:s.content)||""}catch(e){console.error("[DesignView] loadFileContent failed:",e),this.fileContent=""}}},onContentChanged(s){this.hasChanges=s},onContentSaved(s){this.fileContent=s,this.hasChanges=!1},async refreshCurrentFile(){this.activeFilePath&&(console.log("[DesignView] refreshCurrentFile:",this.activeFilePath),await this.loadFileContent(),this.$refs.editor&&this.$refs.editor.updateContent(this.fileContent))},extractRelativePath(s){const e=["/.txcode/design/",".txcode/design/","\\.txcode\\design\\",".txcode\\design\\"];for(const t of e){const i=s.indexOf(t);if(i!==-1)return s.slice(i+t.length).replace(/\\/g,"/")}return""},startResize(s){this.isResizing=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},handleResize(s){if(!this.isResizing)return;const e=this.$refs.sidebar;if(!e)return;const t=s.clientX;t>=150&&t<=800&&(e.$el.style.width=t+"px")},stopResize(){this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect=""}}};var ie=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("DesignSidebar",{ref:"sidebar",attrs:{"base-path":e.designBasePath},on:{"open-file":e.openFile,"file-changed":e.refreshCurrentFile,"ai-status-change":e.onAiStatusChange}}),t("div",{staticClass:"w-1 bg-border hover:bg-accent cursor-col-resize transition-colors",on:{mousedown:e.startResize}}),t("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-[#1e1e1e]"},[t("div",{staticClass:"flex border-b border-border bg-sidebar"},[t("div",{staticClass:"flex items-center"},[t("div",{staticClass:"px-4 py-2 cursor-pointer border-r border-border text-sm",class:e.rightTab==="preview"?"bg-[#1e1e1e] text-white border-t-2 border-t-accent":"text-textMuted hover:bg-[#2a2a2a]",on:{click:function(i){e.rightTab="preview"}}},[t("i",{staticClass:"fa-solid fa-eye mr-1"}),e._v(" 预览 ")]),t("div",{staticClass:"px-4 py-2 cursor-pointer border-r border-border text-sm",class:e.rightTab==="editor"?"bg-[#1e1e1e] text-white border-t-2 border-t-accent":"text-textMuted hover:bg-[#2a2a2a]",on:{click:function(i){e.rightTab="editor"}}},[t("i",{staticClass:"fa-solid fa-code mr-1"}),e._v(" 编辑 ")])])]),t("div",{staticClass:"flex-1 overflow-hidden"},[t("DesignPreview",{directives:[{name:"show",rawName:"v-show",value:e.rightTab==="preview",expression:"rightTab === 'preview'"}],attrs:{"file-content":e.fileContent,"file-name":e.activeFileName,"relative-path":e.relativePath}}),t("DesignEditor",{directives:[{name:"show",rawName:"v-show",value:e.rightTab==="editor",expression:"rightTab === 'editor'"}],ref:"editor",attrs:{"file-content":e.fileContent,"file-name":e.activeFileName,"file-path":e.activeFilePath},on:{"content-changed":e.onContentChanged,"content-saved":e.onContentSaved,refresh:e.refreshCurrentFile}})],1),t("div",{staticClass:"h-8 bg-sidebar border-t border-border flex items-center justify-between px-3"},[t("div",{staticClass:"flex items-center gap-4 text-xs text-textMuted"},[e.activeFilePath?t("span",[e._v(e._s(e.activeFilePath))]):t("span",{staticClass:"text-textMuted"},[e._v("双击左侧文件打开")]),e.hasChanges?t("span",{staticClass:"text-yellow-500"},[e._v("已修改")]):e._e()]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white text-xs",attrs:{title:"刷新"},on:{click:e.refreshCurrentFile}},[t("i",{staticClass:"fa-solid fa-refresh"})])])])])],1)},ae=[],ne=l(se,ie,ae,!1,null,null);const le=ne.exports;export{le as default};
|