tianxincode 1.0.18 → 1.0.19
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/api/git.routes.d.ts +15 -0
- package/dist/api/git.routes.d.ts.map +1 -0
- package/dist/api/git.routes.js +297 -0
- package/dist/api/git.routes.js.map +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/components/Header.js +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{AiLogsView-C0kHdb9s.js → AiLogsView-YNwXiYLj.js} +1 -1
- package/web/dist/assets/DevWorkflowView-DqtaAqQj.css +1 -0
- package/web/dist/assets/DevWorkflowView-lnG06gBv.js +16 -0
- package/web/dist/assets/GitChanges-4daAIVgB.css +1 -0
- package/web/dist/assets/GitChanges-aRQE_nKK.js +2 -0
- package/web/dist/assets/Layout-CjvPVc_q.js +1 -0
- package/web/dist/assets/{TasksView-BVa0OVGg.js → TasksView-BQeG7IlT.js} +1 -1
- package/web/dist/assets/{TerminalView-DHX7n9K-.js → TerminalView-B6bgnhlc.js} +1 -1
- package/web/dist/assets/{cssMode-nwjML4Y-.js → cssMode-MrcpzGyj.js} +1 -1
- package/web/dist/assets/{freemarker2-Drsu7YmW.js → freemarker2-BmxDhO0V.js} +1 -1
- package/web/dist/assets/{handlebars-DhG5OPD4.js → handlebars-gcG5qbcr.js} +1 -1
- package/web/dist/assets/{html-DjqXVu0R.js → html-DPniLrNg.js} +1 -1
- package/web/dist/assets/{htmlMode-BKCtXi23.js → htmlMode-BoOnKRWM.js} +1 -1
- package/web/dist/assets/{index-CFykFU3g.js → index-gxvSC7oI.js} +147 -146
- package/web/dist/assets/{index-BdDihlrs.css → index-ydlSv8Nj.css} +1 -1
- package/web/dist/assets/{javascript-DXbSwQZ4.js → javascript-DIh-4rjV.js} +1 -1
- package/web/dist/assets/{jsonMode-B3aHOjRr.js → jsonMode-DfQAhip9.js} +1 -1
- package/web/dist/assets/{liquid-BzVIRhtt.js → liquid-C9Ruy3XA.js} +1 -1
- package/web/dist/assets/{mdx-0eJXxiJo.js → mdx-CSx8REuK.js} +1 -1
- package/web/dist/assets/{python-DU4ujzSB.js → python-CbBPpoMg.js} +1 -1
- package/web/dist/assets/{razor-CH0ldJCD.js → razor-k1HEP5it.js} +1 -1
- package/web/dist/assets/{tsMode-DAQallwE.js → tsMode-ZPGfOmPP.js} +1 -1
- package/web/dist/assets/{typescript-C3ZEk3-M.js → typescript-CPGMBX3f.js} +1 -1
- package/web/dist/assets/{xml-CnIfPEvz.js → xml-DpGT2I4w.js} +1 -1
- package/web/dist/assets/{yaml-BUfhf22A.js → yaml-DyniUTVI.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/DevWorkflowView-CuQYfP3P.css +0 -1
- package/web/dist/assets/DevWorkflowView-DqytYL3L.js +0 -13
- package/web/dist/assets/Layout-CJXxL4aB.js +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git 操作 API 路由模块
|
|
3
|
+
*
|
|
4
|
+
* 提供 Git 仓库的变更管理 RESTful API 接口
|
|
5
|
+
*
|
|
6
|
+
* 路由列表:
|
|
7
|
+
* - GET /api/git/status -> 获取 Git 变更状态
|
|
8
|
+
* - GET /api/git/diff/<file> -> 获取指定文件的 diff
|
|
9
|
+
* - POST /api/git/revert/<file> -> 撤销指定文件的变更
|
|
10
|
+
* - POST /api/git/revert-all -> 撤销所有变更
|
|
11
|
+
* - POST /api/git/delete-file/<file> -> 删除未跟踪的新文件
|
|
12
|
+
* - GET /api/git/is-repo -> 检查当前目录是否为 Git 仓库
|
|
13
|
+
*/
|
|
14
|
+
export declare const gitRouter: import("express-serve-static-core").Router;
|
|
15
|
+
//# sourceMappingURL=git.routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.routes.d.ts","sourceRoot":"","sources":["../../src/api/git.routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,eAAO,MAAM,SAAS,4CAAW,CAAC"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git 操作 API 路由模块
|
|
3
|
+
*
|
|
4
|
+
* 提供 Git 仓库的变更管理 RESTful API 接口
|
|
5
|
+
*
|
|
6
|
+
* 路由列表:
|
|
7
|
+
* - GET /api/git/status -> 获取 Git 变更状态
|
|
8
|
+
* - GET /api/git/diff/<file> -> 获取指定文件的 diff
|
|
9
|
+
* - POST /api/git/revert/<file> -> 撤销指定文件的变更
|
|
10
|
+
* - POST /api/git/revert-all -> 撤销所有变更
|
|
11
|
+
* - POST /api/git/delete-file/<file> -> 删除未跟踪的新文件
|
|
12
|
+
* - GET /api/git/is-repo -> 检查当前目录是否为 Git 仓库
|
|
13
|
+
*/
|
|
14
|
+
import { Router } from 'express';
|
|
15
|
+
import { exec } from 'child_process';
|
|
16
|
+
import * as fs from 'fs';
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
import { promisify } from 'util';
|
|
19
|
+
const execAsync = promisify(exec);
|
|
20
|
+
export const gitRouter = Router();
|
|
21
|
+
function logError(msg, error) {
|
|
22
|
+
console.error(`[git.routes] ${msg}:`, error);
|
|
23
|
+
}
|
|
24
|
+
function parseGitStatus(line) {
|
|
25
|
+
if (line.length < 3)
|
|
26
|
+
return null;
|
|
27
|
+
const indexStatus = line[0];
|
|
28
|
+
const workTreeStatus = line[1];
|
|
29
|
+
const filePath = line.substring(3).replace(/\\/g, '/');
|
|
30
|
+
let status;
|
|
31
|
+
let statusCode;
|
|
32
|
+
let isNew = false;
|
|
33
|
+
const statusChar = workTreeStatus !== ' ' ? workTreeStatus : indexStatus;
|
|
34
|
+
switch (statusChar) {
|
|
35
|
+
case 'M':
|
|
36
|
+
status = 'modified';
|
|
37
|
+
statusCode = 'M';
|
|
38
|
+
break;
|
|
39
|
+
case 'A':
|
|
40
|
+
status = 'added';
|
|
41
|
+
statusCode = 'A';
|
|
42
|
+
isNew = indexStatus === 'A';
|
|
43
|
+
break;
|
|
44
|
+
case 'D':
|
|
45
|
+
status = 'deleted';
|
|
46
|
+
statusCode = 'D';
|
|
47
|
+
break;
|
|
48
|
+
case 'R':
|
|
49
|
+
status = 'renamed';
|
|
50
|
+
statusCode = 'R';
|
|
51
|
+
break;
|
|
52
|
+
case '?':
|
|
53
|
+
status = 'untracked';
|
|
54
|
+
statusCode = '??';
|
|
55
|
+
isNew = true;
|
|
56
|
+
break;
|
|
57
|
+
case '!':
|
|
58
|
+
case '~':
|
|
59
|
+
return null;
|
|
60
|
+
default:
|
|
61
|
+
status = 'modified';
|
|
62
|
+
statusCode = statusChar;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
path: filePath,
|
|
66
|
+
status,
|
|
67
|
+
statusCode,
|
|
68
|
+
isNew
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async function execGitCommand(command, cwd) {
|
|
72
|
+
const options = cwd ? { cwd } : {};
|
|
73
|
+
try {
|
|
74
|
+
const { stdout, stderr } = await execAsync(command, {
|
|
75
|
+
...options,
|
|
76
|
+
encoding: 'utf-8',
|
|
77
|
+
maxBuffer: 10 * 1024 * 1024
|
|
78
|
+
});
|
|
79
|
+
return { stdout, stderr };
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return { stdout: error.stdout || '', stderr: error.stderr || error.message };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function getGitRoot() {
|
|
86
|
+
try {
|
|
87
|
+
const { stdout } = await execGitCommand('git rev-parse --show-toplevel');
|
|
88
|
+
return stdout.trim() || null;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async function isGitRepo() {
|
|
95
|
+
try {
|
|
96
|
+
await execGitCommand('git rev-parse --git-dir');
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* GET /api/git/is-repo
|
|
105
|
+
* 检查当前目录是否为 Git 仓库
|
|
106
|
+
*/
|
|
107
|
+
gitRouter.get('/is-repo', async (req, res) => {
|
|
108
|
+
try {
|
|
109
|
+
const isRepo = await isGitRepo();
|
|
110
|
+
const gitRoot = isRepo ? await getGitRoot() : null;
|
|
111
|
+
res.json({ success: true, isRepo, gitRoot });
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
logError('Failed to check git repo:', error);
|
|
115
|
+
res.status(500).json({ success: false, error: 'Failed to check git repo' });
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* GET /api/git/status
|
|
120
|
+
* 获取 Git 变更状态
|
|
121
|
+
*/
|
|
122
|
+
gitRouter.get('/status', async (req, res) => {
|
|
123
|
+
try {
|
|
124
|
+
const isRepo = await isGitRepo();
|
|
125
|
+
if (!isRepo) {
|
|
126
|
+
res.status(400).json({ success: false, error: 'Not a git repository' });
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const { stdout } = await execGitCommand('git status --porcelain');
|
|
130
|
+
const changes = [];
|
|
131
|
+
const lines = stdout.split('\n').filter(line => line.trim());
|
|
132
|
+
for (const line of lines) {
|
|
133
|
+
const change = parseGitStatus(line);
|
|
134
|
+
if (change) {
|
|
135
|
+
changes.push(change);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
res.json({ success: true, changes, count: changes.length });
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
logError('Failed to get git status:', error);
|
|
142
|
+
res.status(500).json({ success: false, error: 'Failed to get git status' });
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* GET /api/git/diff/:file
|
|
147
|
+
* 获取指定文件的 diff
|
|
148
|
+
*/
|
|
149
|
+
gitRouter.get(/\/diff(?:\/(.*))?/, async (req, res) => {
|
|
150
|
+
try {
|
|
151
|
+
const isRepo = await isGitRepo();
|
|
152
|
+
if (!isRepo) {
|
|
153
|
+
res.status(400).json({ success: false, error: 'Not a git repository' });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const filePath = req.params[0] || '';
|
|
157
|
+
if (!filePath) {
|
|
158
|
+
res.status(400).json({ success: false, error: 'File path is required' });
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
let command = `git diff -- "${filePath}"`;
|
|
162
|
+
let { stdout, stderr } = await execGitCommand(command);
|
|
163
|
+
if (!stdout && !stderr) {
|
|
164
|
+
command = `git diff --cached -- "${filePath}"`;
|
|
165
|
+
const result = await execGitCommand(command);
|
|
166
|
+
stdout = result.stdout;
|
|
167
|
+
stderr = result.stderr;
|
|
168
|
+
}
|
|
169
|
+
if (!stdout && !stderr) {
|
|
170
|
+
const fullPath = path.join(await getGitRoot() || '', filePath);
|
|
171
|
+
if (fs.existsSync(fullPath)) {
|
|
172
|
+
try {
|
|
173
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
174
|
+
stdout = `+ ${content.split('\n').join('\n+ ')}`;
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
stdout = '';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
res.json({ success: true, diff: stdout, error: stderr || null });
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
logError('Failed to get diff:', error);
|
|
185
|
+
res.status(500).json({ success: false, error: 'Failed to get diff' });
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* POST /api/git/revert/*
|
|
190
|
+
* 撤销指定文件的变更
|
|
191
|
+
*/
|
|
192
|
+
gitRouter.post(/\/revert(?:\/(.*))?/, async (req, res) => {
|
|
193
|
+
try {
|
|
194
|
+
const isRepo = await isGitRepo();
|
|
195
|
+
if (!isRepo) {
|
|
196
|
+
res.status(400).json({ success: false, error: 'Not a git repository' });
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const filePath = req.params[0] || '';
|
|
200
|
+
if (!filePath) {
|
|
201
|
+
res.status(400).json({ success: false, error: 'File path is required' });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const { stderr } = await execGitCommand(`git checkout -- "${filePath}"`);
|
|
205
|
+
if (stderr && !stderr.includes('Updated')) {
|
|
206
|
+
res.status(400).json({ success: false, error: stderr });
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
res.json({ success: true, message: `Reverted: ${filePath}` });
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
logError('Failed to revert file:', error);
|
|
213
|
+
res.status(500).json({ success: false, error: error.message || 'Failed to revert file' });
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
/**
|
|
217
|
+
* POST /api/git/revert-all
|
|
218
|
+
* 撤销所有变更
|
|
219
|
+
*/
|
|
220
|
+
gitRouter.post('/revert-all', async (req, res) => {
|
|
221
|
+
try {
|
|
222
|
+
const isRepo = await isGitRepo();
|
|
223
|
+
if (!isRepo) {
|
|
224
|
+
res.status(400).json({ success: false, error: 'Not a git repository' });
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const { stderr } = await execGitCommand('git checkout -- .');
|
|
228
|
+
if (stderr && !stderr.includes('Updated')) {
|
|
229
|
+
res.status(400).json({ success: false, error: stderr });
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
res.json({ success: true, message: 'All changes reverted' });
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
logError('Failed to revert all:', error);
|
|
236
|
+
res.status(500).json({ success: false, error: error.message || 'Failed to revert all' });
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
/**
|
|
240
|
+
* POST /api/git/delete-file/*
|
|
241
|
+
* 删除未跟踪的新文件
|
|
242
|
+
*/
|
|
243
|
+
gitRouter.post(/\/delete-file(?:\/(.*))?/, async (req, res) => {
|
|
244
|
+
try {
|
|
245
|
+
const filePath = req.params[0] || '';
|
|
246
|
+
if (!filePath) {
|
|
247
|
+
res.status(400).json({ success: false, error: 'File path is required' });
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const gitRoot = await getGitRoot();
|
|
251
|
+
if (!gitRoot) {
|
|
252
|
+
res.status(400).json({ success: false, error: 'Not a git repository' });
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const fullPath = path.join(gitRoot, filePath);
|
|
256
|
+
if (!fs.existsSync(fullPath)) {
|
|
257
|
+
res.status(404).json({ success: false, error: 'File not found' });
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const stats = fs.statSync(fullPath);
|
|
261
|
+
if (stats.isDirectory()) {
|
|
262
|
+
fs.rmSync(fullPath, { recursive: true });
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
fs.unlinkSync(fullPath);
|
|
266
|
+
}
|
|
267
|
+
res.json({ success: true, message: `Deleted: ${filePath}` });
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
logError('Failed to delete file:', error);
|
|
271
|
+
res.status(500).json({ success: false, error: error.message || 'Failed to delete file' });
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
/**
|
|
275
|
+
* POST /api/git/discard-untracked
|
|
276
|
+
* 丢弃所有未跟踪的文件
|
|
277
|
+
*/
|
|
278
|
+
gitRouter.post('/discard-untracked', async (req, res) => {
|
|
279
|
+
try {
|
|
280
|
+
const isRepo = await isGitRepo();
|
|
281
|
+
if (!isRepo) {
|
|
282
|
+
res.status(400).json({ success: false, error: 'Not a git repository' });
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const { stdout, stderr } = await execGitCommand('git clean -fd');
|
|
286
|
+
if (stderr && !stderr.includes('Removing')) {
|
|
287
|
+
res.status(400).json({ success: false, error: stderr });
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
res.json({ success: true, message: 'Untracked files removed', output: stdout + stderr });
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
logError('Failed to discard untracked:', error);
|
|
294
|
+
res.status(500).json({ success: false, error: error.message || 'Failed to discard untracked files' });
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
//# sourceMappingURL=git.routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.routes.js","sourceRoot":"","sources":["../../src/api/git.routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;AAElC,SAAS,QAAQ,CAAC,GAAW,EAAE,KAAc;IAC3C,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AASD,SAAS,cAAc,CAAC,IAAY;IAClC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEvD,IAAI,MAA2B,CAAC;IAChC,IAAI,UAAkB,CAAC;IACvB,IAAI,KAAK,GAAG,KAAK,CAAC;I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KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC,CAAC;YACxE,OAAO;QACT,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC,eAAe,CAAC,CAAC;QAEjE,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YACxD,OAAO;QACT,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC3F,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,QAAQ,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QAChD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,mCAAmC,EAAE,CAAC,CAAC;IACxG,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH,eAAO,MAAM,SAAS,4CAAW,CAAC;AAmBlC,mBAAmB,gBAAgB,CAAC"}
|
package/dist/api/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { terminalRouter } from './terminal.routes.js';
|
|
|
17
17
|
import { schedulerRouter } from './scheduler.routes.js';
|
|
18
18
|
import { emailRouter } from './email.routes.js';
|
|
19
19
|
import { workflowRouter } from './workflow.routes.js';
|
|
20
|
+
import { gitRouter } from './git.routes.js';
|
|
20
21
|
export const apiRouter = Router();
|
|
21
22
|
apiRouter.use('/chat', chatRouter);
|
|
22
23
|
apiRouter.use('/sessions', sessionRouter);
|
|
@@ -33,4 +34,5 @@ apiRouter.use('/terminal', terminalRouter);
|
|
|
33
34
|
apiRouter.use('/tasks', schedulerRouter);
|
|
34
35
|
apiRouter.use('/email', emailRouter);
|
|
35
36
|
apiRouter.use('/workflow', workflowRouter);
|
|
37
|
+
apiRouter.use('/git', gitRouter);
|
|
36
38
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EA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AAa,CAAC,CAAC;AAC1C,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACvC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACvC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACjC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC3C,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC/B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACrC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AAC/C,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AACvC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AACzC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC3C,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AACzC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACrC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC3C,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -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.19';
|
|
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/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-gxvSC7oI.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.workflow-sidebar[data-v-8e3cf2bb]{width:280px;background:#2d2d2d;border-right:1px solid #1e1e1e;display:flex;flex-direction:column;flex-shrink:0}.sidebar-header[data-v-8e3cf2bb]{padding:16px;border-bottom:1px solid #1e1e1e}.sidebar-header h3[data-v-8e3cf2bb]{font-size:14px;color:#84848a;margin-bottom:12px}.sidebar-header .el-select[data-v-8e3cf2bb]{width:100%;margin-bottom:8px}.project-display-row[data-v-8e3cf2bb]{display:flex;justify-content:space-between;gap:8px;margin-bottom:8px;padding:8px 10px;background:#ffffff0a;border:1px solid #3f3f46;border-radius:6px}.project-display-row .label[data-v-8e3cf2bb]{color:#84848a;font-size:12px}.project-display-row .value[data-v-8e3cf2bb]{color:#d4d4d8;font-size:12px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.step-list[data-v-8e3cf2bb]{flex:1;overflow-y:auto;padding:16px}.step-item[data-v-8e3cf2bb]{display:flex;align-items:center;gap:12px;padding:14px 16px;border-radius:8px;margin-bottom:8px;cursor:pointer;transition:all .2s;border:1px solid transparent}.step-item[data-v-8e3cf2bb]:hover{background:#ffffff0d}.step-item.active[data-v-8e3cf2bb]{background:#409eff26;border-color:#409eff}.step-item.completed .step-icon[data-v-8e3cf2bb]{background:#22c55e}.step-item.active .step-icon[data-v-8e3cf2bb]{background:#409eff}.step-icon[data-v-8e3cf2bb]{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:14px;color:#fff;flex-shrink:0}.step-info[data-v-8e3cf2bb]{flex:1}.step-title[data-v-8e3cf2bb]{font-size:14px;font-weight:500;margin-bottom:2px;color:#f4f4f5}.step-desc[data-v-8e3cf2bb]{font-size:12px;color:#84848a}.step-status[data-v-8e3cf2bb]{font-size:14px}.step1-container[data-v-bf976168]{height:100%;padding:24px;overflow:hidden}.step1-main[data-v-bf976168]{max-width:600px;margin:0 auto}.panel-section[data-v-bf976168]{background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden}.panel-section-header[data-v-bf976168]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 16px;font-size:14px;font-weight:500;display:flex;align-items:center;justify-content:space-between;color:#f4f4f5}.panel-section-header .el-button[data-v-bf976168]{padding:4px 8px;font-size:12px}.panel-section-body[data-v-bf976168]{padding:24px}.form-hint[data-v-bf976168]{font-size:12px;color:#84848a;margin-top:8px}.form-hint code[data-v-bf976168]{background:#18191b;padding:2px 6px;border-radius:4px;font-family:ui-monospace,monospace;color:#409eff}.flex[data-v-bf976168]{display:flex}.gap-2[data-v-bf976168]{gap:8px}.step2-container[data-v-61478fe3]{height:100%;display:flex;flex-direction:column}.step2-main[data-v-61478fe3]{display:flex;flex:1;gap:16px;overflow:hidden;padding:16px}.editor-panel[data-v-61478fe3]{flex:1;min-width:300px;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.editor-header[data-v-61478fe3]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 16px;font-size:13px;color:#84848a;display:flex;align-items:center;gap:8px}.editor-container[data-v-61478fe3]{flex:1;min-height:0}.chat-panel[data-v-61478fe3]{width:480px;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column;flex-shrink:0}.panel-header[data-v-61478fe3]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 16px;font-size:14px;font-weight:500;color:#f4f4f5;flex-shrink:0}.chat-messages[data-v-61478fe3]{flex:1;overflow-y:auto;padding:0 16px 16px;font-size:14px;line-height:1.6}.empty-state[data-v-61478fe3]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#84848a}.empty-state i[data-v-61478fe3]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-61478fe3]{margin-bottom:16px;color:#d4d4d8}.todo-item[data-v-61478fe3]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-61478fe3]{color:#60a5fa;font-weight:700;margin-bottom:16px}.user-question[data-v-61478fe3] p{color:#d4d4d8;font-weight:400;margin:0 0 8px}.ai-thought[data-v-61478fe3]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-61478fe3]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-success[data-v-61478fe3]{color:#22c55e}.tool-fail[data-v-61478fe3]{color:#ef4444}.tool-input[data-v-61478fe3]{color:#60a5fa;margin-left:8px}.build-info[data-v-61478fe3]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-61478fe3]{border-top:1px solid #1e1e1e;padding:12px 16px;background:#121212;display:flex;flex-direction:column;gap:8px;flex-shrink:0}.input-area[data-v-61478fe3]{width:100%}.input-actions[data-v-61478fe3]{display:flex;justify-content:flex-end;gap:8px}.status-bar[data-v-61478fe3]{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-61478fe3]{color:#3f3f46}.status-ready[data-v-61478fe3]{color:#22c55e}.status-thinking[data-v-61478fe3]{color:#60a5fa}.thinking-spinner[data-v-61478fe3]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-61478fe3 .8s linear infinite}@keyframes spin-61478fe3{to{transform:rotate(360deg)}}.model-selector[data-v-61478fe3]{cursor:pointer}.model-selector[data-v-61478fe3]:hover{color:#60a5fa}.step3-container[data-v-43ff4355]{height:100%;display:flex;flex-direction:column}.step3-main[data-v-43ff4355]{display:flex;flex:1;overflow:hidden;padding:16px}.code-chat-panel[data-v-43ff4355]{flex:1;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.panel-header[data-v-43ff4355]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#121212;border-bottom:1px solid #1e1e1e;flex-shrink:0}.panel-header span[data-v-43ff4355]{font-size:14px;font-weight:500;color:#f4f4f5}.chat-messages[data-v-43ff4355]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6}.empty-state[data-v-43ff4355]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#84848a}.empty-state i[data-v-43ff4355]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-43ff4355]{margin-bottom:16px;color:#d4d4d8}.todo-item[data-v-43ff4355]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-43ff4355]{color:#60a5fa;font-weight:700;margin-bottom:16px}.user-question[data-v-43ff4355] p{color:#d4d4d8;font-weight:400;margin:0 0 8px}.ai-thought[data-v-43ff4355]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-43ff4355]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-success[data-v-43ff4355]{color:#22c55e}.tool-fail[data-v-43ff4355]{color:#ef4444}.tool-input[data-v-43ff4355]{color:#60a5fa;margin-left:8px}.build-info[data-v-43ff4355]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-43ff4355]{border-top:1px solid #1e1e1e;padding:12px 16px;background:#121212;display:flex;flex-direction:column;gap:8px;flex-shrink:0}.input-area[data-v-43ff4355]{width:100%}.input-actions[data-v-43ff4355]{display:flex;justify-content:flex-end;gap:8px}.status-bar[data-v-43ff4355]{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-43ff4355]{color:#3f3f46}.status-ready[data-v-43ff4355]{color:#22c55e}.status-thinking[data-v-43ff4355]{color:#60a5fa}.thinking-spinner[data-v-43ff4355]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-43ff4355 .8s linear infinite}@keyframes spin-43ff4355{to{transform:rotate(360deg)}}.model-selector[data-v-43ff4355]{cursor:pointer}.model-selector[data-v-43ff4355]:hover{color:#60a5fa}.step4-container[data-v-bb32b3e1]{height:100%;display:flex;flex-direction:column}.step4-main[data-v-bb32b3e1]{display:flex;flex:1;overflow:hidden;padding:16px}.code-chat-panel[data-v-bb32b3e1]{flex:1;background:#121212;border:1px solid #1e1e1e;border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.panel-header[data-v-bb32b3e1]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#121212;border-bottom:1px solid #1e1e1e;flex-shrink:0}.panel-header span[data-v-bb32b3e1]{font-size:14px;font-weight:500;color:#f4f4f5}.chat-messages[data-v-bb32b3e1]{flex:1;overflow-y:auto;padding:16px;font-size:14px;line-height:1.6}.empty-state[data-v-bb32b3e1]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:#84848a}.empty-state i[data-v-bb32b3e1]{font-size:48px;margin-bottom:16px;opacity:.5}.todos-list[data-v-bb32b3e1]{margin-bottom:16px;color:#d4d4d8}.todo-item[data-v-bb32b3e1]{display:flex;align-items:center;gap:8px;padding:2px 0}.user-question[data-v-bb32b3e1]{color:#60a5fa;font-weight:700;margin-bottom:16px}.user-question[data-v-bb32b3e1] p{color:#d4d4d8;font-weight:400;margin:0 0 8px}.ai-thought[data-v-bb32b3e1]{color:#d4d4d8;margin-bottom:16px}.log-mute[data-v-bb32b3e1]{color:#84848a;margin-bottom:16px;white-space:pre}.tool-success[data-v-bb32b3e1]{color:#22c55e}.tool-fail[data-v-bb32b3e1]{color:#ef4444}.tool-input[data-v-bb32b3e1]{color:#60a5fa;margin-left:8px}.build-info[data-v-bb32b3e1]{color:#84848a;display:flex;align-items:center;gap:8px;margin-bottom:16px}.chat-input-area[data-v-bb32b3e1]{border-top:1px solid #1e1e1e;padding:12px 16px;background:#121212;display:flex;flex-direction:column;gap:8px;flex-shrink:0}.input-area[data-v-bb32b3e1]{width:100%}.input-actions[data-v-bb32b3e1]{display:flex;justify-content:flex-end;gap:8px}.status-bar[data-v-bb32b3e1]{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-bb32b3e1]{color:#3f3f46}.status-ready[data-v-bb32b3e1]{color:#22c55e}.status-thinking[data-v-bb32b3e1]{color:#60a5fa}.thinking-spinner[data-v-bb32b3e1]{display:inline-block;width:12px;height:12px;border:2px solid #60a5fa;border-top-color:transparent;border-radius:50%;animation:spin-bb32b3e1 .8s linear infinite}@keyframes spin-bb32b3e1{to{transform:rotate(360deg)}}.model-selector[data-v-bb32b3e1]{cursor:pointer}.model-selector[data-v-bb32b3e1]:hover{color:#60a5fa}.dev-workflow-view[data-v-df83d415]{display:flex;height:100%;overflow:hidden;background:#0a0a09}.main-content[data-v-df83d415]{flex:1;display:flex;flex-direction:column;overflow:hidden}.panel-header[data-v-df83d415]{background:#121212;border-bottom:1px solid #1e1e1e;padding:12px 24px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.panel-title[data-v-df83d415]{font-size:16px;font-weight:500;color:#f4f4f5}.panel-actions[data-v-df83d415]{display:flex;gap:12px}.step-content[data-v-df83d415]{flex:1;overflow:hidden}.status-bar[data-v-df83d415]{background:#121212;border-top:1px solid #1e1e1e;padding:8px 24px;font-size:12px;color:#84848a;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{n as c,F as d,C as u,M as h,g as p,a as n,e as C,K as _,b as v}from"./index-gxvSC7oI.js";const b={name:"WorkflowSidebar",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>{}},currentCategory:{type:String,default:""},currentProject:{type:String,default:""},currentStep:{type:Number,default:1},isLoading:{type:Boolean,default:!1}},data(){return{selectedCategory:"",selectedProject:"",steps:[{id:1,title:"新建需求",desc:"创建新的需求项目",icon:"el-icon-folder-add"},{id:2,title:"方案设计",desc:"编写需求方案",icon:"el-icon-edit"},{id:3,title:"代码生成",desc:"根据方案生成代码",icon:"el-icon-document"},{id:4,title:"测试验收",desc:"测试验证功能",icon:"el-icon-s-check"}]}},computed:{hasAnyProject(){return Object.keys(this.projects||{}).length>0},visibleSteps(){return this.hasAnyProject?this.steps:this.steps.filter(s=>s.id===1)}},watch:{currentCategory(s){this.selectedCategory=s},currentProject(s){this.selectedProject=s}},methods:{onCategoryChange(s){this.selectedProject="",this.$emit("category-change",s)},onProjectChange(s){this.$emit("project-change",s)},onStepClick(s){this.$emit("step-change",s)},isStepCompleted(s){var i;if(!this.currentProject)return!1;const e=`${this.currentCategory}/${this.currentProject}`,t=this.projects[e];return((i=t==null?void 0:t.stepStatus)==null?void 0:i[s])===!0}}};var S=function(){var e=this,t=e._self._c;return t("div",{staticClass:"workflow-sidebar"},[t("div",{staticClass:"sidebar-header"},[t("h3",[e._v("当前项目")]),t("div",{staticClass:"project-display-row"},[t("span",{staticClass:"label"},[e._v("大类")]),t("span",{staticClass:"value"},[e._v(e._s(e.currentCategory||"-"))])]),t("div",{staticClass:"project-display-row"},[t("span",{staticClass:"label"},[e._v("需求")]),t("span",{staticClass:"value"},[e._v(e._s(e.currentProject||"-"))])])]),t("div",{staticClass:"step-list"},e._l(e.visibleSteps,function(i){return t("div",{key:i.id,class:["step-item",{active:e.currentStep===i.id,completed:e.isStepCompleted(i.id)}],on:{click:function(a){return e.onStepClick(i.id)}}},[t("div",{staticClass:"step-icon"},[t("i",{class:i.icon})]),t("div",{staticClass:"step-info"},[t("div",{staticClass:"step-title"},[e._v(e._s(i.title))]),t("div",{staticClass:"step-desc"},[e._v(e._s(i.desc))])]),t("div",{staticClass:"step-status"},[e.isStepCompleted(i.id)?t("i",{staticClass:"el-icon-circle-check",staticStyle:{color:"#22c55e"}}):e._e()])])}),0)])},I=[],w=c(b,S,I,!1,null,"8e3cf2bb");const $=w.exports,k={name:"Step1NewReq",props:{categories:{type:Array,default:()=>[]},projects:{type:Object,default:()=>({})},basePath:{type:String,default:""},currentCategory:{type:String,default:""},currentProject:{type:String,default:""}},data(){return{selectedCategory:"",selectedProject:"",dialogVisible:!1,dialogInput:"",requirementDialogVisible:!1,requirementDialogInput:""}},computed:{existingRequirementList(){if(!this.selectedCategory)return[];const s=`${this.selectedCategory}/`;return Object.keys(this.projects).filter(e=>e.startsWith(s)).map(e=>e.split("/")[1]).sort()}},watch:{currentCategory:{immediate:!0,handler(s){this.selectedCategory=s||""}},currentProject:{immediate:!0,handler(s){this.selectedProject=s||""}},selectedCategory(s){s||(this.selectedProject="")},existingRequirementList(s){this.selectedProject&&(!Array.isArray(s)||s.length===0||s.includes(this.selectedProject)||(this.selectedProject=""))}},methods:{onCategoryChange(){this.selectedProject="",this.$emit("category-change",this.selectedCategory||""),this.$emit("project-change","")},onProjectChange(){this.$emit("project-change",this.selectedProject||"")},showCreateRequirementDialog(){if(!this.selectedCategory){this.$message.warning("请先选择大类");return}this.requirementDialogInput="",this.requirementDialogVisible=!0},handleCreateRequirementConfirm(){const s=this.requirementDialogInput.trim();if(!s){this.$message.warning("需求名称不能为空");return}if(this.existingRequirementList.includes(s)){this.$message.warning("该需求已存在");return}this.$emit("create-requirement",{category:this.selectedCategory,name:s}),this.requirementDialogVisible=!1},showCreateCategoryDialog(){this.dialogInput="",this.dialogVisible=!0},handleDialogConfirm(){const s=this.dialogInput.trim();if(!s){this.$message.warning("名称不能为空");return}this.$emit("create-category",s),this.dialogVisible=!1}}};var M=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step1-container"},[t("div",{staticClass:"step1-main"},[t("div",{staticClass:"panel-section"},[e._m(0),t("div",{staticClass:"panel-section-body"},[t("el-form",{attrs:{"label-position":"top",size:"small"}},[t("el-form-item",{attrs:{label:"所属大类"}},[t("div",{staticClass:"flex gap-2"},[t("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"请选择大类"},on:{change:e.onCategoryChange},model:{value:e.selectedCategory,callback:function(i){e.selectedCategory=i},expression:"selectedCategory"}},e._l(e.categories,function(i){return t("el-option",{key:i,attrs:{label:i,value:i}})}),1),t("el-button",{on:{click:e.showCreateCategoryDialog}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建 ")])],1)]),t("el-form-item",{attrs:{label:"选择需求"}},[t("div",{staticClass:"flex gap-2"},[t("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"选择已有需求目录",disabled:!e.selectedCategory},on:{change:e.onProjectChange},model:{value:e.selectedProject,callback:function(i){e.selectedProject=i},expression:"selectedProject"}},e._l(e.existingRequirementList,function(i){return t("el-option",{key:i,attrs:{label:i,value:i}})}),1),t("el-button",{attrs:{disabled:!e.selectedCategory},on:{click:e.showCreateRequirementDialog}},[t("i",{staticClass:"el-icon-plus"}),e._v(" 新建 ")])],1)]),t("div",{staticClass:"form-hint",staticStyle:{color:"#84848a"}},[e._v(" "+e._s(e.selectedCategory?"可直接选择已有需求,或点击“新建”创建需求目录":"请先选择大类")+" ")])],1)],1)])]),t("el-dialog",{attrs:{title:"新建大类",visible:e.dialogVisible,width:"400px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[t("el-form",[t("el-form-item",{attrs:{label:"大类名称"}},[t("el-input",{attrs:{placeholder:"输入大类名称"},model:{value:e.dialogInput,callback:function(i){e.dialogInput=i},expression:"dialogInput"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleDialogConfirm}},[e._v("确定")])],1)],1),t("el-dialog",{attrs:{title:"新建需求",visible:e.requirementDialogVisible,width:"400px"},on:{"update:visible":function(i){e.requirementDialogVisible=i}}},[t("el-form",[t("el-form-item",{attrs:{label:"需求目录名称"}},[t("el-input",{attrs:{placeholder:"输入需求名称,如:用户管理"},model:{value:e.requirementDialogInput,callback:function(i){e.requirementDialogInput=i},expression:"requirementDialogInput"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.requirementDialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleCreateRequirementConfirm}},[e._v("确定")])],1)],1)],1)},P=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"panel-section-header"},[e("span",[e("i",{staticClass:"el-icon-folder-add"}),s._v(" 创建新需求")])])}],j=c(k,M,P,!1,null,"bf976168");const D=j.exports,T={name:"Step2Design",components:{ModelSelectDialog:h,CommandDialog:u,FileSelectDialog:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{editor:null,specContent:"",inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle"}},computed:{specFilePath(){return!this.category||!this.name?"等待选择需求...":`${this.reqBasePath}\\${this.category}\\${this.name}\\${this.name}_方案.md`}},watch:{category:{handler(){this.loadData()}},name:{handler(){this.loadData()}}},async mounted(){this.initMonacoEditor(),await this.loadData(),await this.loadDefaultModel(),n.ws.init()},beforeDestroy(){this.editor&&(this.editor.dispose(),this.editor=null),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
|
|
2
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadData(){await Promise.all([this.loadSpec(),this.loadSession()])},async loadSpec(){if(!this.category||!this.name){this.specContent=`# 选择或创建需求项目开始设计
|
|
3
|
+
`,this.syncEditorContent(this.specContent);return}try{const s=this.specFilePath,e=await n.getFileContent(s);this.specContent=e.content||"",this.syncEditorContent(this.specContent)}catch(s){console.error("Load spec failed:",s),this.specContent="",this.syncEditorContent("")}},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}\\${this.category}\\${this.name}\\session.json`,e=await n.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.designSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},syncEditorContent(s){if(!this.editor||s===void 0||s===null)return;const e=String(s);this.editor.getValue()!==e&&this.editor.setValue(e)},initMonacoEditor(){this.editor||this.$nextTick(()=>{this.createEditor()})},createEditor(){this.editor||(this.editor=C.create(this.$refs.editorContainer,{value:this.specContent||`# 选择或创建需求项目开始设计
|
|
4
|
+
`,language:"markdown",theme:"vs-dark",fontSize:14,fontFamily:"ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Monaco, Consolas, monospace",minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:16}}),this.editor.addCommand(_.CtrlCmd|v.KeyS,()=>{this.saveSpec()}),this.syncEditorContent(this.specContent))},saveSpec(){if(!this.editor)return;const s=this.editor.getValue();this.$emit("save-spec",s)},async sendMessage(){const s=this.inputMessage.trim();if(!s||this.disabled)return;if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession();const e=`先在 ${this.specFilePath} 生成方案,先不要修改代码。
|
|
5
|
+
|
|
6
|
+
用户输入: ${s}`;this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),n.sessionWsSend(this.sessionId,"chat",{message:e,sessionId:this.sessionId,modelName:this.modelName||void 0})},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,n.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=n.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},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.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.$emit("spec-updated"),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await n.getMessages(this.sessionId);this.logItems=s.data||[]}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await n.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,n.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},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?p(s):""}}};var x=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step2-container"},[t("div",{staticClass:"step2-main"},[t("div",{staticClass:"editor-panel"},[t("div",{staticClass:"editor-header"},[t("i",{staticClass:"el-icon-document"}),t("span",[e._v(e._s(e.specFilePath))])]),t("div",{ref:"editorContainer",staticClass:"editor-container"})]),t("div",{staticClass:"chat-panel"},[e._m(0),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("输入需求描述,AI将协助您完善方案")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(o,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(o.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(o.name))])])}),0):i.type==="chat"||i.type==="think"?t("div",{staticClass:"user-question",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(o,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(o.function.name)+" "),o.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(o.function.name,o.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("el-input",{staticClass:"input-area",attrs:{type:"textarea",rows:3,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},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("div",{staticClass:"input-actions"},[e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],1)],1),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("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}})],1)},F=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"panel-header"},[e("span",[e("i",{staticClass:"el-icon-chat-dot-round"}),s._v(" AI 方案助手")])])}],q=c(T,x,F,!1,null,"61478fe3");const V=q.exports,B={name:"Step3CodeGen",components:{ModelSelectDialog:h,CommandDialog:u,FileSelectDialog:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,dotAnimation:"",dotInterval:null,dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"],logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle"}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}\\${this.category}\\${this.name}\\${this.name}_方案.md`}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){await this.loadSession(),await this.loadDefaultModel(),n.ws.init()},beforeDestroy(){this.dotInterval&&clearInterval(this.dotInterval),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
|
|
7
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}\\${this.category}\\${this.name}\\session.json`,e=await n.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.codeSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},insertGenerateCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案开发相应功能,先不要修改方案文档。`)},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),n.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,n.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=n.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},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.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await n.getMessages(this.sessionId);this.logItems=s.data||[]}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await n.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,n.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},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?p(s):""}}};var N=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step3-container"},[t("div",{staticClass:"step3-main"},[t("div",{staticClass:"code-chat-panel"},[t("div",{staticClass:"panel-header"},[e._m(0),t("el-button",{attrs:{type:"primary",size:"small",disabled:e.disabled},on:{click:e.insertGenerateCommand}},[t("i",{staticClass:"el-icon-document"}),e._v(" 根据方案生成代码 ")])],1),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("点击上方按钮或输入需求生成代码")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(o,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(o.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(o.name))])])}),0):i.type==="chat"||i.type==="think"?t("div",{staticClass:"user-question",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(o,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(o.function.name)+" "),o.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(o.function.name,o.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("el-input",{staticClass:"input-area",attrs:{type:"textarea",rows:3,placeholder:"输入代码修改要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},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("div",{staticClass:"input-actions"},[e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],1)],1),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("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}})],1)},R=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-code"}),s._v(" 代码生成对话")])}],E=c(B,N,R,!1,null,"43ff4355");const L=E.exports,O={name:"Step4Test",components:{ModelSelectDialog:h,CommandDialog:u,FileSelectDialog:d},props:{category:{type:String,default:""},name:{type:String,default:""},reqBasePath:{type:String,default:""}},data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,dotAnimation:"",dotInterval:null,dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"],logItems:[],modelName:"",modelSelectVisible:!1,commandDialogVisible:!1,fileSelectVisible:!1,sessionId:"",sessionStatus:"idle"}},computed:{specFilePath(){return!this.category||!this.name?"":`${this.reqBasePath}\\${this.category}\\${this.name}\\${this.name}_方案.md`}},watch:{category:{handler(){this.loadSession()}},name:{handler(){this.loadSession()}}},async mounted(){await this.loadSession(),await this.loadDefaultModel(),n.ws.init()},beforeDestroy(){this.dotInterval&&clearInterval(this.dotInterval),this.wsUnsubscribe&&this.wsUnsubscribe()},methods:{handleKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd,a=this.inputMessage;this.inputMessage=a.substring(0,t)+`
|
|
8
|
+
`+a.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.sendMessage()},async loadSession(){if(!this.category||!this.name){this.sessionId="";return}try{const s=`${this.reqBasePath}\\${this.category}\\${this.name}\\session.json`,e=await n.getFileContent(s);if(e&&e.content){const t=JSON.parse(e.content);this.sessionId=t.testSessionId||""}else this.sessionId="";this.sessionId?(await this.loadMessages(),this.subscribeSession()):this.logItems=[]}catch(s){console.error("Load session failed:",s),this.sessionId="",this.logItems=[]}},insertTestCommand(){this.specFilePath&&(this.inputMessage=`根据 ${this.specFilePath} 方案测试相应功能是否实现。`)},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){if(!this.sessionId){this.$message.error("会话不存在,请刷新页面");return}this.wsUnsubscribe||this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),n.sessionWsSend(this.sessionId,"chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,n.sessionWsSend(this.sessionId,"stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=n.wsSubscribe(this.sessionId,{running_sessions:s=>{const t=((s==null?void 0:s.runningSessionIds)||[]).includes(this.sessionId);this.sessionStatus=t?"processing":"idle",this.disabled=t},todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},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.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`}),this.loadMessages()},done:s=>{var e;this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response}),this.scrollToBottom()},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push({type:"think",content:"【已停止】"}),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},scrollToBottom(){this.$nextTick(()=>{const s=this.$refs.messagesContainer;s&&(s.scrollTop=s.scrollHeight)})},async loadMessages(){if(this.sessionId)try{const s=await n.getMessages(this.sessionId);this.logItems=s.data||[]}catch(s){console.error("Load messages failed:",s)}},async loadDefaultModel(){var s;try{const e=await n.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch(e){console.error("Load default model failed:",e)}},openModelSelector(){this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,n.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},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},formatInput(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}},renderMarkdown(s){return s?p(s):""}}};var U=function(){var e=this,t=e._self._c;return t("div",{staticClass:"step4-container"},[t("div",{staticClass:"step4-main"},[t("div",{staticClass:"code-chat-panel"},[t("div",{staticClass:"panel-header"},[e._m(0),t("el-button",{attrs:{type:"primary",size:"small",disabled:e.disabled},on:{click:e.insertTestCommand}},[t("i",{staticClass:"el-icon-s-claim"}),e._v(" 根据方案测试 ")])],1),t("div",{ref:"messagesContainer",staticClass:"chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("i",{staticClass:"el-icon-chat-dot-round"}),t("p",[e._v("点击上方按钮或输入测试要求进行验收")])]),e._l(e.logItems,function(i,a){return[i.type==="todos"?t("div",{staticClass:"todos-list"},e._l(i.todos,function(o,r){return t("div",{key:r,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(o.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(o.name))])])}),0):i.type==="chat"||i.type==="think"?t("div",{staticClass:"user-question",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(o,r){return t("div",{key:r,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(o.function.name)+" "),o.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(o.function.name,o.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"chat-input-area"},[t("el-input",{staticClass:"input-area",attrs:{type:"textarea",rows:3,placeholder:"输入测试要求... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)",disabled:e.disabled&&!e.stopping},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("div",{staticClass:"input-actions"},[e.disabled&&!e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"danger"},on:{click:e.stopChat}},[e._v(" ■ 停止 ")]):e.stopping?t("el-button",{staticClass:"stop-btn",attrs:{type:"info",disabled:""}},[e._v(" 停止中... ")]):t("el-button",{staticClass:"send-btn",attrs:{type:"primary",disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v(" 发送 ")])],1)],1),t("div",{staticClass:"status-bar"},[t("span",{class:e.sessionStatus==="processing"?"status-thinking":"status-ready"},[e.sessionStatus==="processing"?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.sessionStatus==="processing"?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:e.openModelSelector,mousedown:function(i){i.preventDefault()}}},[e._v(" 模型:"+e._s(e.modelName||"-")+" ▾ ")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("会话:"+e._s(e.sessionId?e.sessionId.slice(0,8):"--------"))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",[e._v("token:"+e._s(e.promptTokens||0))]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openCommandDialog,mousedown:function(i){i.preventDefault()}}},[e._v("命令")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:e.openFileSelect,mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")])])])]),t("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}})],1)},K=[function(){var s=this,e=s._self._c;return e("span",[e("i",{staticClass:"el-icon-s-check"}),s._v(" 测试验收对话")])}],W=c(O,U,K,!1,null,"bb32b3e1");const H=W.exports,A={name:"DevWorkflowView",components:{WorkflowSidebar:$,Step1NewReq:D,Step2Design:V,Step3CodeGen:L,Step4Test:H},props:{sidebarVisible:{type:Boolean,default:!0}},data(){return{currentCategory:"",currentProject:"",currentStep:1,categories:[],projects:{},reqBasePath:"",isLoadingProjects:!1}},computed:{projectKey(){return!this.currentCategory||!this.currentProject?"":`${this.currentCategory}/${this.currentProject}`},hasSelectedProject(){return!!this.currentProject},stepTitle(){return{1:"新建需求",2:"方案设计",3:"代码生成",4:"测试验收"}[this.currentStep]||""},statusText(){return this.projectKey?`步骤 ${this.currentStep} / 4`:"就绪"}},created(){this.loadState(),this.loadCategories()},methods:{async loadState(){try{const e=(await n.getWorkflowState()).data;e&&(this.currentCategory=e.currentCategory||"",this.currentProject=e.currentProject||"",this.currentStep=e.currentStep||1)}catch(s){console.error("Load workflow state failed:",s)}},async saveState(){try{await n.updateWorkflowState(this.currentCategory,this.currentProject,this.currentStep)}catch(s){console.error("Save workflow state failed:",s)}},async loadCategories(){var s,e;try{const t=await n.getCwd();this.reqBasePath=((s=t.data)==null?void 0:s.basePath)||"";const a=((e=(await n.browseFilesystem(this.reqBasePath)).data)==null?void 0:e.items)||[];this.categories=a.filter(o=>o.is_directory).map(o=>o.name),this.categories.sort(),this.currentCategory&&this.categories.includes(this.currentCategory)&&await this.loadProjectsForCategory(this.currentCategory)}catch(t){console.error("Load categories failed:",t),this.categories=[]}},async loadProjectsForCategory(s){var e;if(s){this.isLoadingProjects=!0;try{const t=`${this.reqBasePath}\\${s}`,a=((e=(await n.browseFilesystem(t)).data)==null?void 0:e.items)||[];this.projects={},a.filter(o=>o.is_directory).forEach(o=>{const r=`${s}/${o.name}`;this.projects[r]={name:o.name,stepStatus:{}}})}catch(t){console.error("Load projects failed:",t)}finally{this.isLoadingProjects=!1}}},async onCategoryChange(s){this.currentCategory=s,this.currentProject="",this.currentStep=1,s?await this.loadProjectsForCategory(s):this.projects={}},onProjectChange(s){this.currentProject=s,!this.currentProject&&this.currentStep>1&&(this.currentStep=1)},onStepChange(s){!this.currentProject&&s>1||(this.currentStep=s)},async createCategory(s){if(this.categories.includes(s)){this.$message.warning("大类已存在");return}try{const e=`${this.reqBasePath}\\${s}`;await n.createDirectory(e),this.categories.push(s),this.categories.sort(),this.$message.success(`大类「${s}」创建成功`)}catch(e){console.error("Create category failed:",e),this.$message.error("创建大类失败")}},async renameCategory({oldName:s,newName:e}){if(this.categories.includes(e)){this.$message.warning("名称已存在");return}try{const t=`${this.reqBasePath}\\${s}`;await n.renameFile(t,e);const i=this.categories.indexOf(s);i>-1&&(this.categories[i]=e),this.categories.sort(),this.currentCategory===s&&(this.currentCategory=e,await this.loadProjectsForCategory(e)),await this.saveState(),this.$message.success(`已重命名为「${e}」`)}catch(t){console.error("Rename category failed:",t),this.$message.error("重命名大类失败")}},async deleteCategory(s){try{const e=`${this.reqBasePath}\\${s}`;await n.deleteFile(e),this.categories=this.categories.filter(t=>t!==s),this.currentCategory===s&&(this.currentCategory="",this.currentProject="",this.currentStep=1,this.projects={}),await this.saveState(),this.$message.success(`大类「${s}」已删除`)}catch(e){console.error("Delete category failed:",e),this.$message.error("删除大类失败")}},async createRequirement({category:s,name:e}){var o,r,g;if(this.projects[e]){this.$message.warning("需求已存在");return}try{const l=`${this.reqBasePath}\\${s}\\${e}`;await n.createDirectory(l)}catch(l){console.error("Create requirement directory failed:",l)}const t=`# ${e}方案
|
|
9
|
+
|
|
10
|
+
> 所属大类:${s}
|
|
11
|
+
|
|
12
|
+
## 业务目标
|
|
13
|
+
|
|
14
|
+
## 功能点
|
|
15
|
+
|
|
16
|
+
`;try{const l=`${this.reqBasePath}\\${s}\\${e}\\${e}_方案.md`;await n.writeFile(l,t)}catch(l){console.error("Write spec file failed:",l)}let i={designSessionId:"",codeSessionId:"",testSessionId:""};try{const[l,f,m]=await Promise.all([n.createSession(`workflow:${s}/${e}:design`),n.createSession(`workflow:${s}/${e}:code`),n.createSession(`workflow:${s}/${e}:test`)]);i={designSessionId:((o=l.data)==null?void 0:o.id)||"",codeSessionId:((r=f.data)==null?void 0:r.id)||"",testSessionId:((g=m.data)==null?void 0:g.id)||""};const y=`${this.reqBasePath}\\${s}\\${e}\\session.json`;await n.writeFile(y,JSON.stringify(i,null,2))}catch(l){console.error("Create sessions failed:",l)}const a=`${s}/${e}`;this.$set(this.projects,a,{name:e,stepStatus:{}}),this.currentCategory=s,this.currentProject=e,this.$message.success(`需求「${e}」创建成功`),this.$nextTick(()=>{this.currentStep=2})},async onSaveSpec(s){if(!this.projectKey)return;const e=`${this.reqBasePath}\\${this.currentCategory}\\${this.currentProject}\\${this.currentProject}_方案.md`;try{await n.writeFile(e,s),this.$message.success("方案已保存")}catch(t){console.error("Save spec failed:",t),this.$message.error("保存方案失败")}},saveSpec(){this.$refs.step2Ref&&this.$refs.step2Ref.saveSpec()},async refreshSpec(){var s;(s=this.$refs.step2Ref)!=null&&s.loadSpec&&await this.$refs.step2Ref.loadSpec(),this.$message.success("方案已刷新")}}};var J=function(){var e=this,t=e._self._c;return t("div",{staticClass:"dev-workflow-view"},[t("WorkflowSidebar",{ref:"sidebar",attrs:{categories:e.categories,projects:e.projects,"current-category":e.currentCategory,"current-project":e.currentProject,"current-step":e.currentStep,"is-loading":e.isLoadingProjects},on:{"category-change":e.onCategoryChange,"project-change":e.onProjectChange,"step-change":e.onStepChange,"delete-category":e.deleteCategory,"rename-category":e.renameCategory}}),t("div",{staticClass:"main-content"},[t("div",{staticClass:"panel-header"},[t("span",{staticClass:"panel-title"},[e._v(e._s(e.stepTitle))]),t("div",{staticClass:"panel-actions"},[e.currentStep===2?[t("el-button",{attrs:{type:"primary",plain:""},on:{click:e.saveSpec}},[t("i",{staticClass:"el-icon-save"}),e._v(" 保存方案 ")]),t("el-button",{attrs:{type:"info",plain:""},on:{click:e.refreshSpec}},[t("i",{staticClass:"el-icon-refresh"}),e._v(" 刷新方案 ")])]:e._e()],2)]),t("div",{staticClass:"step-content"},[t("Step1NewReq",{directives:[{name:"show",rawName:"v-show",value:e.currentStep===1,expression:"currentStep === 1"}],attrs:{categories:e.categories,projects:e.projects,"base-path":e.reqBasePath,"current-category":e.currentCategory,"current-project":e.currentProject},on:{"category-change":e.onCategoryChange,"project-change":e.onProjectChange,"create-category":e.createCategory,"create-requirement":e.createRequirement}}),e.currentStep===2&&e.hasSelectedProject?t("Step2Design",{ref:"step2Ref",attrs:{category:e.currentCategory,name:e.currentProject,"req-base-path":e.reqBasePath},on:{"update:sessionId":e.updateDesignSessionId,"save-spec":e.onSaveSpec,"spec-updated":e.refreshSpec}}):e._e(),e.currentStep===3&&e.hasSelectedProject?t("Step3CodeGen",{ref:"step3Ref",attrs:{category:e.currentCategory,name:e.currentProject,"req-base-path":e.reqBasePath},on:{"update:sessionId":e.updateCodeSessionId}}):e._e(),e.currentStep===4&&e.hasSelectedProject?t("Step4Test",{ref:"step4Ref",attrs:{category:e.currentCategory,name:e.currentProject,"req-base-path":e.reqBasePath},on:{"update:sessionId":e.updateTestSessionId}}):e._e()],1),t("div",{staticClass:"status-bar"},[t("span",[t("i",{staticClass:"el-icon-info"}),e._v(" "+e._s(e.statusText)+" ")]),t("span",[e._v(e._s(e.projectKey||"未选择项目"))])])])],1)},z=[],G=c(A,J,z,!1,null,"df83d415");const X=G.exports;export{X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sidebar-scroll[data-v-42cc079f]::-webkit-scrollbar{width:8px}.sidebar-scroll[data-v-42cc079f]::-webkit-scrollbar-track{background:transparent}.sidebar-scroll[data-v-42cc079f]::-webkit-scrollbar-thumb{background:#404040;border-radius:4px}.sidebar-scroll[data-v-42cc079f]::-webkit-scrollbar-thumb:hover{background:#505050}
|