tianxincode 1.0.29 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Header.js +1 -1
- package/dist/config/tx.config.js +1 -1
- package/dist/config/tx.config.js.map +1 -1
- package/dist/modules/ai/agents/mem/mem.agent.d.ts.map +1 -1
- package/dist/modules/ai/agents/mem/mem.agent.js +23 -2
- package/dist/modules/ai/agents/mem/mem.agent.js.map +1 -1
- package/dist/modules/ai/agents/mem/prompts/role.txt +36 -34
- package/dist/modules/hooks/handlers/memory.handler.d.ts.map +1 -1
- package/dist/modules/hooks/handlers/memory.handler.js +3 -2
- package/dist/modules/hooks/handlers/memory.handler.js.map +1 -1
- package/dist/modules/tools/provider/memory.txt +17 -18
- package/package.json +1 -1
- package/web/dist/assets/{AiLogsView-CIxbi3Te.js → AiLogsView-DJZLaAiD.js} +1 -1
- package/web/dist/assets/{ConfirmDialog-OCsjOe8X.js → ConfirmDialog-CnoVNYtH.js} +1 -1
- package/web/dist/assets/{CustomActionsView-IZMOHhZZ.js → CustomActionsView-Dwo20fNr.js} +1 -1
- package/web/dist/assets/{DevWorkflowView-2l1EOqLE.js → DevWorkflowView-B5clzQix.js} +4 -4
- package/web/dist/assets/DevWorkflowView-Bk0OoCiV.css +1 -0
- package/web/dist/assets/{DevWorkflowView-DVK68zH4.js → DevWorkflowView-CyOh99Rf.js} +1 -1
- package/web/dist/assets/{GitChanges-D8g3Vgrf.js → GitChanges-SvO9k1WC.js} +1 -1
- package/web/dist/assets/{GitChangesApp-CYA5WaWq.js → GitChangesApp-CqxfSujn.js} +1 -1
- package/web/dist/assets/{Layout-8r9wJTpA.js → Layout-BNmgOpYh.js} +1 -1
- package/web/dist/assets/{TasksView-BSg84kyY.js → TasksView-RUdoJdnW.js} +1 -1
- package/web/dist/assets/{TerminalView-Cj8Aki8h.js → TerminalView-C-kMVKFY.js} +1 -1
- package/web/dist/assets/{WikiView-DyTQrEN2.js → WikiView-nQlLv75M.js} +1 -1
- package/web/dist/assets/{cssMode-DiZeIxBy.js → cssMode-CWUpS9Lk.js} +1 -1
- package/web/dist/assets/{freemarker2-DF6toOS9.js → freemarker2-DD-bFfVJ.js} +1 -1
- package/web/dist/assets/{handlebars-BzUg_EEs.js → handlebars-Dry8y7RL.js} +1 -1
- package/web/dist/assets/{html-z5jzcEHK.js → html-RaMIULea.js} +1 -1
- package/web/dist/assets/{htmlMode-DkmEWkZl.js → htmlMode-DhiO4Mtm.js} +1 -1
- package/web/dist/assets/{index-BvLW1aj9.js → index-DEabcW89.js} +7 -7
- package/web/dist/assets/{javascript-x25JHy7X.js → javascript-BADKuZJe.js} +1 -1
- package/web/dist/assets/{jsonMode-Cqz5dGc8.js → jsonMode-BTTCWwmC.js} +1 -1
- package/web/dist/assets/{liquid-H_2fkFOb.js → liquid-BHt_ZVeJ.js} +1 -1
- package/web/dist/assets/{mdx-CRINdcic.js → mdx-BcW1RSn5.js} +1 -1
- package/web/dist/assets/{python-SFSAyBx7.js → python-BOwxOcVC.js} +1 -1
- package/web/dist/assets/{razor-BbQbHOeF.js → razor-BLbUc77s.js} +1 -1
- package/web/dist/assets/{tsMode-BlaX9nrp.js → tsMode-6ZquyGbx.js} +1 -1
- package/web/dist/assets/{typescript-RcgjsDZ3.js → typescript-DPRHE3q6.js} +1 -1
- package/web/dist/assets/{xml-fhWLLp79.js → xml-8Xx64-IH.js} +1 -1
- package/web/dist/assets/{yaml-CdvXAzw2.js → yaml-DKsYwq1n.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/DevWorkflowView-C48T1Vn9.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
const VERSION = '1.0.
|
|
3
|
+
const VERSION = '1.0.31';
|
|
4
4
|
export const Header = React.memo(function Header() {
|
|
5
5
|
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1 },
|
|
6
6
|
React.createElement(Text, { bold: true, cyan: true }, " "),
|
package/dist/config/tx.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.config.js","sourceRoot":"","sources":["../../src/config/tx.config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH;;;GAGG;AACH,MAAM,MAAM,GAAa;IACvB,KAAK,EAAE,IAAI;IAEX,GAAG,EAAE;QACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tx.config.js","sourceRoot":"","sources":["../../src/config/tx.config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH;;;GAGG;AACH,MAAM,MAAM,GAAa;IACvB,KAAK,EAAE,IAAI;IAEX,GAAG,EAAE;QACH,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,KAAK;QACV,SAAS,EAAE,YAAY;KACxB;IAED,iBAAiB,EAAE,EAAE;IAErB,EAAE,EAAE;QACF,gBAAgB,EAAE,MAAM;QACxB,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,MAAM;YACjB,kBAAkB;YAClB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,IAAI;SAClB;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mem.agent.d.ts","sourceRoot":"","sources":["../../../../../src/modules/ai/agents/mem/mem.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,QAAQ;IACnB,IAAI,SAAS;IACb,KAAK,yEAAa;IAClB,WAAW,UAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,WAAW,CAAgC;gBAEvC,MAAM,EAAE,cAAc;IAK5B,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAanC,OAAO;YAkDP,SAAS;IASvB,OAAO,CAAC,WAAW;YAWL,WAAW;YAuBX,WAAW;
|
|
1
|
+
{"version":3,"file":"mem.agent.d.ts","sourceRoot":"","sources":["../../../../../src/modules/ai/agents/mem/mem.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,QAAQ;IACnB,IAAI,SAAS;IACb,KAAK,yEAAa;IAClB,WAAW,UAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,WAAW,CAAgC;gBAEvC,MAAM,EAAE,cAAc;IAK5B,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAanC,OAAO;YAkDP,SAAS;IASvB,OAAO,CAAC,WAAW;YAWL,WAAW;YAuBX,WAAW;IAgCzB,OAAO,CAAC,eAAe;CAexB"}
|
|
@@ -24,6 +24,7 @@ export class MemAgent {
|
|
|
24
24
|
let iteration = 0;
|
|
25
25
|
while (iteration < maxIterations) {
|
|
26
26
|
iteration++;
|
|
27
|
+
console.log(`\n--- Iteration ${iteration} ---`);
|
|
27
28
|
const response = await this.provider.chat(messages, {
|
|
28
29
|
tools: this.getToolDefs(),
|
|
29
30
|
sessionId: 'mem-agent',
|
|
@@ -98,12 +99,32 @@ export class MemAgent {
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
async buildPrompt() {
|
|
101
|
-
const
|
|
102
|
+
const fsPromises = await import('fs/promises');
|
|
103
|
+
const fs = await import('fs');
|
|
102
104
|
const path = await import('path');
|
|
103
105
|
const { fileURLToPath } = await import('url');
|
|
104
106
|
const __filename = fileURLToPath(import.meta.url);
|
|
105
107
|
const __dirname = path.dirname(__filename);
|
|
106
|
-
|
|
108
|
+
const rolePrompt = await fsPromises.readFile(path.join(__dirname, 'prompts', 'role.txt'), 'utf-8');
|
|
109
|
+
const workDir = this.workDir || process.cwd();
|
|
110
|
+
const memoryPath = path.join(workDir, '.txcode', 'memory', 'MEMORY.md');
|
|
111
|
+
let memorySection = '';
|
|
112
|
+
if (fs.existsSync(memoryPath)) {
|
|
113
|
+
const content = fs.readFileSync(memoryPath, 'utf-8');
|
|
114
|
+
if (content.length > 0) {
|
|
115
|
+
const entries = content.split('\n§\n').filter((e) => e.trim());
|
|
116
|
+
if (entries.length > 0) {
|
|
117
|
+
let memoryOutput = `Memory list (${entries.length} total):\n`;
|
|
118
|
+
for (let i = 0; i < entries.length; i++) {
|
|
119
|
+
const entry = entries[i].replace(/^#.*\n/, '').trim();
|
|
120
|
+
memoryOutput += `\n${i + 1}. ${entry}`;
|
|
121
|
+
}
|
|
122
|
+
memoryOutput += `\n\nTotal characters: ${content.length}/2200`;
|
|
123
|
+
memorySection = `\n\n## 当前记忆\n${memoryOutput}`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return rolePrompt + memorySection;
|
|
107
128
|
}
|
|
108
129
|
buildUserPrompt(messages) {
|
|
109
130
|
const recentMessages = messages.slice(-20);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mem.agent.js","sourceRoot":"","sources":["../../../../../src/modules/ai/agents/mem/mem.agent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iB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C,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;aAC9E,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,OAAO;;EAET,YAAY;;;CAGb,CAAC;IACA,CAAC;CACF"}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
你是 txcode
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
1
|
+
你是 txcode 代码开发agnet的记忆管理大师,负责从对话历史中识别并保存高价值信息。重点关注对夸会话有帮助的信息,包括:
|
|
2
|
+
|
|
3
|
+
1、项目基本信息 (软件架构,编程语言,项目路径,技术栈,项目模块和编译命令等)
|
|
4
|
+
2、高频使用公共组件(文件路径)
|
|
5
|
+
- 图片处理 ,比如图片如何转换,如何存储,如何下载等
|
|
6
|
+
- 文件上传存储,比如 OSS ftp 等
|
|
7
|
+
- 获取登录用户,比如通过那个组件获取 登陆用户信息,获取租户信息,获取管理员信息等
|
|
8
|
+
- 发送类,比如发送邮箱 发送短信,调用第三方工具类等
|
|
9
|
+
- 基础表,比如用户表,租户表,菜单表,权限表和角色表等
|
|
10
|
+
- 判断工具类,比如字符串判断空,对象判断空,数组判断空,对象转换等
|
|
11
|
+
3、交互流程(前端后端交互流程)
|
|
12
|
+
4、你认为对未来解决问题,开发任务有帮助的信息
|
|
13
|
+
|
|
14
|
+
## 请按以下格式记录
|
|
15
|
+
|
|
16
|
+
### 项目基本信息类格式
|
|
17
|
+
|
|
18
|
+
- **项目路径**: [这里写项目路径]
|
|
19
|
+
- **项目类型**: [这里写项目类型]
|
|
20
|
+
- **语言**: [开发语言]
|
|
21
|
+
- **架构**: [项目架构]
|
|
22
|
+
- **项目模块**: [项目模块描述,比如模块下存放那些重要的信息]
|
|
23
|
+
- **技术栈**: [项目用到的核心技术]
|
|
24
|
+
- **编译/运行命令**:[项目编译命令]
|
|
25
|
+
- **其他重要补充**: [这里写一些关键补充信息]
|
|
26
|
+
|
|
27
|
+
### 高频公共组件
|
|
28
|
+
- **关键组件**: [组件名称]+[组件路径]+[使用说明,简短说明用于干什么,比如用于调用第三方接口]
|
|
29
|
+
|
|
30
|
+
### 交互流程
|
|
31
|
+
- **交互流程**: [比如后端从api到数据库的交互流程描述,要求精简,禁止出现代码片段]
|
|
32
|
+
|
|
33
|
+
### 你认为对未来解决问题,开发任务有帮助的信息
|
|
34
|
+
- **开发洞察**:[对未来重要的事实,比如文件命名,函数命名,最佳实践,已知坑点和未来会话中仍会有用的稳定事实等]
|
|
35
|
+
|
|
36
|
+
**重要** : 禁止记录 任务进度、会话结果、已完成工作日志或临时的待办事项状态,避免重复记录
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.handler.d.ts","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,EAAE,WAAW,CAAW;IAC/B,iBAAiB,EAAE,WAAW,EAAE,CAAkC;IAE5D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.handler.d.ts","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,EAAE,WAAW,CAAW;IAC/B,iBAAiB,EAAE,WAAW,EAAE,CAAkC;IAE5D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBlD"}
|
|
@@ -10,14 +10,15 @@ export class MemoryHandler extends HookHandler {
|
|
|
10
10
|
}
|
|
11
11
|
async handle(message) {
|
|
12
12
|
try {
|
|
13
|
-
const
|
|
13
|
+
const defaultModel = configService.getDefaultModel();
|
|
14
|
+
const providerConfig = configService.getModelProvider(defaultModel);
|
|
14
15
|
if (!providerConfig) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
18
|
const provider = new OpenAIProvider({
|
|
18
19
|
apiKey: providerConfig.apiKey,
|
|
19
20
|
baseUrl: providerConfig.baseUrl,
|
|
20
|
-
defaultModel
|
|
21
|
+
defaultModel,
|
|
21
22
|
});
|
|
22
23
|
const projectPath = this.getProjectPath(message);
|
|
23
24
|
const memAgent = new MemAgent({ provider, workDir: projectPath });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.handler.js","sourceRoot":"","sources":["../../../../src/modules/hooks/handlers/memory.handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QACE,YAAO,GAAgB,OAAO,CAAC;QAC/B,sBA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jD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
将持久化信息保存到 MEMORY.md(≤2200字符)。记忆会在后续会话中注入到 system prompt。
|
|
1
|
+
将持久信息保存到跨会话保留的持久记忆中。记忆会在未来的对话轮次中被注入,因此请保持内容紧凑,专注于未来仍然重要的事实。
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
3
|
+
## 何时保存(主动执行,无需等待用户要求):
|
|
4
|
+
- 用户纠正你,或说“记住这个” / “以后别再这么做了”
|
|
5
|
+
- 用户分享偏好、习惯或个人细节(姓名、角色、时区、编码风格)
|
|
6
|
+
- 你发现了与环境相关的信息(操作系统、已安装工具、项目结构)
|
|
7
|
+
- 你了解到特定于该用户使用习惯的约定、API 特性或工作流程
|
|
8
|
+
- 你识别出在未来会话中仍会有用的稳定事实
|
|
9
9
|
|
|
10
|
-
PRIORITY
|
|
10
|
+
优先级(PRIORITY): 用户偏好与纠正 > 环境事实 > 过程性知识。最有价值的记忆是能避免用户重复自己的话。
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## 不值得记录的内容
|
|
13
|
+
- 任务进度、会话结果、已完成工作日志或临时的待办事项状态。
|
|
14
|
+
- 闲聊、打招呼、无关寒暄
|
|
15
|
+
- 单次的技术问答(除非用户表示很重要)
|
|
16
|
+
- 测试性问题、无意义的重复
|
|
17
|
+
- 用户明确表示“不用记”的内容
|
|
13
18
|
|
|
14
|
-
ACTIONS:
|
|
15
|
-
- add: 添加新条目 (需要 content)
|
|
16
|
-
- replace: 更新条目 (需要 old_text + content)
|
|
17
|
-
- remove: 删除条目 (需要 old_text)
|
|
18
|
-
- list: 列出所有条目 (无需参数)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- old_text: 要替换/删除的条目标识
|
|
20
|
+
操作类型: add(新增条目)、replace(更新已有条目——通过 old_text 定位原内容)、remove(删除——通过 old_text 定位原内容)
|
|
21
|
+
|
|
22
|
+
跳过保存的情况: 琐碎/显而易见的信息、容易重新发现的内容、原始数据转储、以及临时性的任务状态。
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as x,a as n}from"./index-
|
|
1
|
+
import{n as x,a as n}from"./index-DEabcW89.js";const c=[{key:"ai_call_logs",name:"AI 日志",icon:"fa-solid fa-robot text-xs"}],p={name:"AiLogsView",data(){return{logTypes:c,selectedLogType:c[0],logs:[],page:1,pageSize:20,total:0,totalPages:1,sessions:[],loading:!1,filters:{callType:"",sessionId:"",startTime:"",endTime:""}}},async created(){await this.loadSessions(),await this.loadLogs()},methods:{async loadSessions(){try{const s=await n.getSessions(100,0);this.sessions=s.data||[]}catch(s){console.error("Load sessions failed:",s)}},selectLogType(s){this.selectedLogType=s,this.resetFilters()},async loadLogs(){this.loading=!0;try{const s=await n.getAiCallLogs(this.page,this.pageSize);let t=s.data.rows||[];if(this.filters.callType&&(t=t.filter(e=>e.call_type===this.filters.callType)),this.filters.sessionId&&(t=t.filter(e=>e.session_id&&e.session_id.includes(this.filters.sessionId))),this.filters.startTime){const e=new Date(this.filters.startTime).getTime();t=t.filter(l=>new Date(l.request_time).getTime()>=e)}if(this.filters.endTime){const e=new Date(this.filters.endTime).getTime();t=t.filter(l=>new Date(l.request_time).getTime()<=e)}this.logs=t,this.total=s.data.total,this.totalPages=s.data.totalPages}catch(s){console.error("Load logs failed:",s),this.logs=[]}finally{this.loading=!1}},resetFilters(){this.filters.callType="",this.filters.sessionId="",this.filters.startTime="",this.filters.endTime="",this.page=1,this.loadLogs()},async prevPage(){this.page>1&&(this.page--,await this.loadLogs())},async nextPage(){this.page<this.totalPages&&(this.page++,await this.loadLogs())},formatTime(s){return s?new Date(s).toLocaleString("zh-CN"):"-"},getSessionTitle(s){if(!s)return"-";const t=this.sessions.find(e=>e.id===s);return t?t.title:s.substring(0,8)},formatDuration(s){return s?s<1e3?`${s}ms`:`${(s/1e3).toFixed(2)}s`:"0ms"}}};var b=function(){var l,d;var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden"},[e("aside",{staticClass:"w-[260px] bg-sidebar border-r border-border flex flex-col shrink-0"},[t._m(0),e("div",{staticClass:"flex-1 overflow-y-auto py-1"},t._l(t.logTypes,function(a){var i;return e("div",{key:a.key,staticClass:"flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm",class:((i=t.selectedLogType)==null?void 0:i.key)===a.key?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(r){return t.selectLogType(a)}}},[e("i",{class:a.icon}),e("span",{staticClass:"truncate"},[t._v(t._s(a.name))])])}),0)]),e("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-[#1e1e1e]"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar"},[e("div",{staticClass:"flex items-center gap-4 mb-3"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{class:(l=t.selectedLogType)==null?void 0:l.icon}),e("span",{staticClass:"text-white font-medium"},[t._v(t._s((d=t.selectedLogType)==null?void 0:d.name))])]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.total)+" 条记录")])]),e("div",{staticClass:"flex items-center gap-4 flex-wrap"},[e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("调用类型:")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.filters.callType,expression:"filters.callType"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",on:{change:[function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var o="_value"in r?r._value:r.value;return o});t.$set(t.filters,"callType",a.target.multiple?i:i[0])},t.loadLogs]}},[e("option",{attrs:{value:""}},[t._v("全部")]),e("option",{attrs:{value:"tool_call"}},[t._v("工具调用")]),e("option",{attrs:{value:"normal"}},[t._v("普通对话")])])]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("会话:")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.filters.sessionId,expression:"filters.sessionId"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",on:{change:[function(a){var i=Array.prototype.filter.call(a.target.options,function(r){return r.selected}).map(function(r){var o="_value"in r?r._value:r.value;return o});t.$set(t.filters,"sessionId",a.target.multiple?i:i[0])},t.loadLogs]}},[e("option",{attrs:{value:""}},[t._v("全部会话")]),t._l(t.sessions,function(a){return e("option",{key:a.id,domProps:{value:a.id}},[t._v(t._s(a.title))])})],2)]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("开始时间:")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.startTime,expression:"filters.startTime"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",attrs:{type:"datetime-local"},domProps:{value:t.filters.startTime},on:{change:t.loadLogs,input:function(a){a.target.composing||t.$set(t.filters,"startTime",a.target.value)}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("label",{staticClass:"text-xs text-textMuted"},[t._v("结束时间:")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.endTime,expression:"filters.endTime"}],staticClass:"bg-black/20 border border-white/10 text-white text-xs px-2 py-1 rounded",attrs:{type:"datetime-local"},domProps:{value:t.filters.endTime},on:{change:t.loadLogs,input:function(a){a.target.composing||t.$set(t.filters,"endTime",a.target.value)}}})]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.loadLogs}},[t._v(" 查询 ")]),e("button",{staticClass:"px-3 py-1 text-textMuted text-xs rounded hover:bg-white/10",on:{click:t.resetFilters}},[t._v(" 重置 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(1),e("tbody",[t._l(t.logs,function(a){return e("tr",{key:a.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.id))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatTime(a.request_time)))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("span",{staticClass:"text-xs px-2 py-0.5 rounded",class:a.call_type==="tool_call"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"},[t._v(" "+t._s(a.call_type==="tool_call"?"工具调用":"普通对话")+" ")])]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.model_name))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(t.formatDuration(a.duration_ms)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.input_tokens||0))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v(t._s(a.output_tokens||0))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30"},[t._v("$"+t._s((a.cost||0).toFixed(4)))]),e("td",{staticClass:"px-3 py-2 text-gray-300 border-b border-border/30 truncate max-w-[150px]",attrs:{title:a.session_id}},[t._v(t._s(t.getSessionTitle(a.session_id)))])])}),t.logs.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"9"}},[t._v("暂无数据")])]):t._e()],2)])]),e("div",{staticClass:"flex items-center justify-between px-4 py-2 border-t border-border bg-sidebar"},[e("span",{staticClass:"text-xs text-textMuted"},[t._v("共 "+t._s(t.total)+" 条")]),e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:t.page<=1},on:{click:t.prevPage}},[e("i",{staticClass:"fa-solid fa-chevron-left"}),t._v(" 上一页 ")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.page)+" / "+t._s(t.totalPages||1))]),e("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:t.page>=t.totalPages},on:{click:t.nextPage}},[t._v(" 下一页 "),e("i",{staticClass:"fa-solid fa-chevron-right"})])])])])])},f=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[t("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-list"}),s._v(" 日志 ")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("ID")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("时间")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("类型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("模型")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("耗时")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("输入Token")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("输出Token")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("费用")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("会话ID")])])])}],u=x(p,b,f,!1,null,null);const _=u.exports;export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n}from"./index-
|
|
1
|
+
import{n}from"./index-DEabcW89.js";const r={name:"ConfirmDialog",props:{visible:{type:Boolean,default:!1},message:{type:String,default:""}}};var i=function(){var e=this,t=e._self._c;return e.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-96"},[t("p",{staticClass:"text-gray-200 text-sm mb-4"},[e._v(e._s(e.message))]),t("div",{staticClass:"flex justify-end gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs text-gray-400 hover:text-white",on:{click:function(s){return e.$emit("cancel")}}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700",on:{click:function(s){return e.$emit("confirm")}}},[e._v("确定")])])])]):e._e()},a=[],o=n(r,i,a,!1,null,null);const d=o.exports;export{d as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as d,a as n}from"./index-
|
|
1
|
+
import{n as d,a as n}from"./index-DEabcW89.js";const u={name:"CustomActionsView",data(){return{actions:[],currentType:"design",showDialog:!1,isEditing:!1,currentAction:null,form:{action_type:"design",name:"",prompt:"",auto_send:!1,sort_order:0},actionTypes:[{value:"design",label:"方案设计"},{value:"code",label:"代码生成"},{value:"test",label:"测试验收"}]}},computed:{filteredActions(){return this.actions.filter(s=>s.action_type===this.currentType)}},async created(){await this.loadActions();const s=this.$route.query.type;s&&["design","code","test"].includes(s)&&(this.currentType=s)},methods:{async loadActions(){try{const s=await n.getCustomActions();this.actions=s.data||[]}catch(s){console.error("Load actions failed:",s),this.$message.error("加载动作失败")}},selectType(s){this.currentType=s},getCountByType(s){return this.actions.filter(t=>t.action_type===s).length},openCreateDialog(){this.isEditing=!1,this.form={action_type:this.currentType,name:"",prompt:"",auto_send:!1,sort_order:0},this.showDialog=!0},openEditDialog(s){this.isEditing=!0,this.currentAction=s,this.form={action_type:s.action_type,name:s.name,prompt:s.prompt,auto_send:!!s.auto_send,sort_order:s.sort_order||0},this.showDialog=!0},closeDialog(){this.showDialog=!1,this.currentAction=null},async saveAction(){if(!this.form.name||!this.form.prompt){this.$message.error("请填写必填项");return}try{this.isEditing&&this.currentAction?(await n.updateCustomAction(this.currentAction.id,this.form),this.$message.success("动作已更新")):(await n.createCustomAction(this.form),this.$message.success("动作已创建")),this.closeDialog(),await this.loadActions()}catch(s){this.$message.error("保存失败: "+s.message)}},async deleteAction(s){if(confirm(`确定删除动作 "${s.name}" 吗?`))try{await n.deleteCustomAction(s.id),this.$message.success("动作已删除"),await this.loadActions()}catch(t){this.$message.error("删除失败: "+t.message)}},getTypeLabel(s){return{design:"方案设计",code:"代码生成",test:"测试验收"}[s]||s}}};var p=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex-1 flex overflow-hidden bg-[#1e1e1e]"},[e("div",{staticClass:"w-48 border-r border-border bg-sidebar shrink-0 flex flex-col"},[t._m(0),e("div",{staticClass:"flex-1 overflow-auto py-2"},t._l(t.actionTypes,function(r){return e("div",{key:r.value,staticClass:"px-4 py-2 cursor-pointer flex items-center justify-between",class:t.currentType===r.value?"bg-accent/20 text-accent":"text-textMuted hover:bg-white/5",on:{click:function(a){return t.selectType(r.value)}}},[e("span",{staticClass:"text-sm"},[t._v(t._s(r.label))]),e("span",{staticClass:"text-xs opacity-60"},[t._v("("+t._s(t.getCountByType(r.value))+")")])])}),0)]),e("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[e("div",{staticClass:"px-4 py-3 border-b border-border bg-sidebar shrink-0"},[e("div",{staticClass:"flex items-center justify-between"},[e("div",{staticClass:"flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-bolt text-accent"}),e("span",{staticClass:"text-white font-medium"},[t._v("自定义动作")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v("("+t._s(t.getTypeLabel(t.currentType))+")")]),e("span",{staticClass:"text-xs text-textMuted"},[t._v(t._s(t.filteredActions.length)+" 个动作")])]),e("button",{staticClass:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent/80",on:{click:t.openCreateDialog}},[e("i",{staticClass:"fa-solid fa-plus mr-1"}),t._v(" 新增动作 ")])])]),e("div",{staticClass:"flex-1 overflow-auto p-4"},[e("table",{staticClass:"w-full text-sm"},[t._m(1),e("tbody",[t._l(t.filteredActions,function(r){return e("tr",{key:r.id,staticClass:"hover:bg-white/5"},[e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-200"},[t._v(t._s(r.name))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-300 max-w-[300px] truncate",attrs:{title:r.prompt}},[t._v(t._s(r.prompt))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[r.auto_send?e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-green-500/20 text-green-400"},[t._v("是")]):e("span",{staticClass:"text-xs px-2 py-0.5 rounded bg-gray-500/20 text-gray-400"},[t._v("否")])]),e("td",{staticClass:"px-3 py-2 border-b border-border/30 text-gray-300"},[t._v(t._s(r.sort_order))]),e("td",{staticClass:"px-3 py-2 border-b border-border/30"},[e("div",{staticClass:"flex items-center gap-2"},[e("button",{staticClass:"text-xs px-2 py-1 text-blue-400 hover:bg-blue-500/20 rounded",on:{click:function(a){return t.openEditDialog(r)}}},[t._v("编辑")]),e("button",{staticClass:"text-xs px-2 py-1 text-red-400 hover:bg-red-500/20 rounded",on:{click:function(a){return t.deleteAction(r)}}},[t._v("删除")])])])])}),t.filteredActions.length===0?e("tr",[e("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:"5"}},[t._v('暂无动作,点击"新增动作"创建')])]):t._e()],2)])])]),t.showDialog?e("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[e("div",{staticClass:"bg-sidebar border border-border rounded-lg w-[500px] max-h-[80vh] overflow-auto"},[e("div",{staticClass:"px-4 py-3 border-b border-border flex items-center justify-between"},[e("h3",{staticClass:"text-white font-medium"},[t._v(t._s(t.isEditing?"编辑动作":"新增动作"))]),e("button",{staticClass:"text-textMuted hover:text-white text-sm",on:{click:t.closeDialog}},[t._v("关闭")])]),e("div",{staticClass:"p-4 space-y-4"},[e("div",[t._m(2),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.action_type,expression:"form.action_type"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{disabled:t.isEditing},on:{change:function(r){var a=Array.prototype.filter.call(r.target.options,function(o){return o.selected}).map(function(o){var l="_value"in o?o._value:o.value;return l});t.$set(t.form,"action_type",r.target.multiple?a:a[0])}}},[e("option",{attrs:{value:"design"}},[t._v("方案设计")]),e("option",{attrs:{value:"code"}},[t._v("代码生成")]),e("option",{attrs:{value:"test"}},[t._v("测试验收")])])]),e("div",[t._m(3),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.name,expression:"form.name"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"text",placeholder:"按钮显示名称"},domProps:{value:t.form.name},on:{input:function(r){r.target.composing||t.$set(t.form,"name",r.target.value)}}})]),e("div",[t._m(4),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.form.prompt,expression:"form.prompt"}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded resize-none",attrs:{rows:"4",placeholder:"点击按钮后填入输入框的内容"},domProps:{value:t.form.prompt},on:{input:function(r){r.target.composing||t.$set(t.form,"prompt",r.target.value)}}})]),e("div",[e("label",{staticClass:"block text-xs text-textMuted mb-1"},[t._v("排序")]),e("input",{directives:[{name:"model",rawName:"v-model.number",value:t.form.sort_order,expression:"form.sort_order",modifiers:{number:!0}}],staticClass:"w-full bg-black/20 border border-white/10 text-white text-sm px-3 py-2 rounded",attrs:{type:"number",placeholder:"数字越小越靠前"},domProps:{value:t.form.sort_order},on:{input:function(r){r.target.composing||t.$set(t.form,"sort_order",t._n(r.target.value))},blur:function(r){return t.$forceUpdate()}}})]),e("div",{staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.auto_send,expression:"form.auto_send"}],staticClass:"accent-accent",attrs:{type:"checkbox",id:"autoSend"},domProps:{checked:Array.isArray(t.form.auto_send)?t._i(t.form.auto_send,null)>-1:t.form.auto_send},on:{change:function(r){var a=t.form.auto_send,o=r.target,l=!!o.checked;if(Array.isArray(a)){var c=null,i=t._i(a,c);o.checked?i<0&&t.$set(t.form,"auto_send",a.concat([c])):i>-1&&t.$set(t.form,"auto_send",a.slice(0,i).concat(a.slice(i+1)))}else t.$set(t.form,"auto_send",l)}}}),e("label",{staticClass:"text-xs text-textMuted",attrs:{for:"autoSend"}},[t._v("点击后自动发送(无需手动确认)")])])]),e("div",{staticClass:"px-4 py-3 border-t border-border flex justify-end gap-2"},[e("button",{staticClass:"px-4 py-1 text-textMuted text-sm rounded hover:bg-white/10",on:{click:t.closeDialog}},[t._v("取消")]),e("button",{staticClass:"px-4 py-1 bg-accent text-white text-sm rounded hover:bg-accent/80",on:{click:t.saveAction}},[t._v(" "+t._s(t.isEditing?"保存":"创建")+" ")])])])]):t._e()])},x=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"px-4 py-3 border-b border-border"},[t("span",{staticClass:"text-white text-sm font-medium"},[s._v("类型")])])},function(){var s=this,t=s._self._c;return t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",[t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("名称")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("提示词")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("自动发送")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("排序")]),t("th",{staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[s._v("操作")])])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("类型 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("名称 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])},function(){var s=this,t=s._self._c;return t("label",{staticClass:"block text-xs text-textMuted mb-1"},[s._v("提示词 "),t("span",{staticClass:"text-red-400"},[s._v("*")])])}],m=d(u,p,x,!1,null,null);const f=m.exports;export{f as default};
|