hermes-web-ui 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/hermes-web-ui.mjs +50 -13
- package/dist/client/assets/{Button-zECKCotA.js → Button-Cxh6x3Um.js} +1 -1
- package/dist/client/assets/ChannelsView-CQJ1fX8O.js +1 -0
- package/dist/client/assets/{ChannelsView-xCdAEZam.css → ChannelsView-D168bwSq.css} +1 -1
- package/dist/client/assets/{ChatView-CJZahJ1V.js → ChatView-nxyDDB73.js} +5 -5
- package/dist/client/assets/{Close-DjLWDodG.js → Close-hb0eNgAb.js} +1 -1
- package/dist/client/assets/{FormItem-CZ9auYA2.js → FormItem-dHtHjgtl.js} +3 -3
- package/dist/client/assets/{Input-DxJk6pT-.js → Input-CZZ9TfBw.js} +1 -1
- package/dist/client/assets/{InputNumber-BTqp81h0.js → InputNumber-qFTlSmmT.js} +1 -1
- package/dist/client/assets/{JobsView-DsfGyjnT.js → JobsView-rFyONi-b.js} +2 -2
- package/dist/client/assets/{LoginView-BiWaCYS0.js → LoginView-C6C3nX0Y.js} +1 -1
- package/dist/client/assets/{LogsView-DuORyFFY.js → LogsView-CO8aslfu.js} +1 -1
- package/dist/client/assets/{MarkdownRenderer-BA3oPVqT.js → MarkdownRenderer-Cy_O_tQS.js} +1 -1
- package/dist/client/assets/MemoryView-DZjJTdI6.js +7 -0
- package/dist/client/assets/MemoryView-hIfyUkwz.css +1 -0
- package/dist/client/assets/{Modal-WQKdvHJY.js → Modal-BLinjj9c.js} +6 -6
- package/dist/client/assets/ModelsView-CvHz1aiJ.js +1 -0
- package/dist/client/assets/Popconfirm-JTALkPda.js +16 -0
- package/dist/client/assets/Popover-0__1CUa3.js +117 -0
- package/dist/client/assets/ProfilesView-Dv1-Qa9-.js +1 -0
- package/dist/client/assets/ProfilesView-oIk8yBVG.css +1 -0
- package/dist/client/assets/{Scrollbar-Bg2FeTtI.js → Scrollbar-BHJ682ve.js} +1 -1
- package/dist/client/assets/Select-DqPBeTT3.js +340 -0
- package/dist/client/assets/{SettingRow-CLLFxWP3.js → SettingRow-pvADoOth.js} +1 -1
- package/dist/client/assets/SettingsView-Y522req-.js +352 -0
- package/dist/client/assets/{SkillsView-D6CegW4w.js → SkillsView-Bl8tqv9V.js} +1 -1
- package/dist/client/assets/{Spin-lybeIDeX.js → Spin-BbaC-FmW.js} +1 -1
- package/dist/client/assets/{Suffix-Dv1UElLH.js → Suffix-yRSbGVfA.js} +1 -1
- package/dist/client/assets/{Switch-mgeu-lpD.js → Switch-Svs0Rnhi.js} +1 -1
- package/dist/client/assets/{Tag-DWc4lbAm.js → Tag-DdwPhG9T.js} +1 -1
- package/dist/client/assets/{TerminalView-DmnXOHFu.js → TerminalView-XDDNp69h.js} +1 -1
- package/dist/client/assets/{Tooltip-DrDTmrj3.js → Tooltip-CHbB9ntH.js} +1 -1
- package/dist/client/assets/{UsageView-C3O6-vbW.js → UsageView-xqsO8W9W.js} +1 -1
- package/dist/client/assets/{Warning-t1i_4T5i.js → Warning-Srffo82k.js} +1 -1
- package/dist/client/assets/{_plugin-vue_export-helper-BkT4A29V.js → _plugin-vue_export-helper-TyZ5GTTn.js} +1 -1
- package/dist/client/assets/app-CpUVwd9n.js +1 -0
- package/dist/client/assets/app-DTyari-k.js +1 -0
- package/dist/client/assets/{browser-DzAOCZtm.js → browser-DbKCW2k6.js} +1 -1
- package/dist/client/assets/{chat-CX1Hza8X.js → chat-BmXwfHmM.js} +2 -2
- package/dist/client/assets/composables-BoU_Wud6.js +1 -0
- package/dist/client/assets/create-5zWq3BEB.js +1 -0
- package/dist/client/assets/fade-in-scale-up.cssr-CiZdBCR3.js +1 -0
- package/dist/client/assets/get-DUDt1SRf.js +1 -0
- package/dist/client/assets/index-BT19Bivl.css +1 -0
- package/dist/client/assets/index-WIPEA9ik.js +306 -0
- package/dist/client/assets/{jobs-B9NHIxuL.js → jobs-DxRPm5Sf.js} +1 -1
- package/dist/client/assets/{pinia-bPUFQqFK.js → pinia-BTE-WqCz.js} +1 -1
- package/dist/client/assets/profiles-C9UmdPLd.js +1 -0
- package/dist/client/assets/{router-COwpqexM.js → router-mPoLLYeq.js} +2 -2
- package/dist/client/assets/{sessions-B1SPfe-R.js → sessions-Bv5JsX3U.js} +1 -1
- package/dist/client/assets/{skills-CRtljpt6.js → skills-CXFhBwRj.js} +1 -1
- package/dist/client/assets/use-compitable-aofta5ri.js +1 -0
- package/dist/client/assets/use-message-B3svE98N.js +1 -0
- package/dist/client/index.html +25 -22
- package/dist/server/data/.token +1 -0
- package/dist/server/index.js +70 -4
- package/dist/server/routes/hermes/config.js +11 -11
- package/dist/server/routes/hermes/filesystem.js +154 -29
- package/dist/server/routes/hermes/profiles.js +84 -9
- package/dist/server/routes/hermes/terminal.js +12 -34
- package/dist/server/routes/hermes/weixin.js +6 -6
- package/dist/server/services/hermes-cli.d.ts +4 -0
- package/dist/server/services/hermes-cli.js +17 -0
- package/dist/server/services/hermes-profile.d.ts +22 -0
- package/dist/server/services/hermes-profile.js +60 -0
- package/dist/server/shared/providers.js +8 -14
- package/package.json +1 -1
- package/dist/client/assets/ChannelsView-Bvh3tnio.js +0 -1
- package/dist/client/assets/MemoryView-CU3JHweh.css +0 -1
- package/dist/client/assets/MemoryView-VgQFNMsP.js +0 -5
- package/dist/client/assets/ModelsView-QDRloKd5.js +0 -1
- package/dist/client/assets/Popconfirm-02A7vL_z.js +0 -16
- package/dist/client/assets/Popover-2C1zuptC.js +0 -117
- package/dist/client/assets/Select-C_hKaXgI.js +0 -340
- package/dist/client/assets/SettingsView-CeScqhwO.js +0 -352
- package/dist/client/assets/app-BUjbfMSg.js +0 -1
- package/dist/client/assets/app-p59ZckFN.js +0 -1
- package/dist/client/assets/context-BM8ZQCOz.js +0 -1
- package/dist/client/assets/fade-in-scale-up.cssr-DQl-Z54c.js +0 -1
- package/dist/client/assets/index-95z-iQoj.js +0 -306
- package/dist/client/assets/index-C33O1KZm.css +0 -1
- package/dist/client/assets/use-compitable-BnlNjEug.js +0 -1
- package/dist/client/assets/use-message-g8F4Z57w.js +0 -1
- /package/dist/client/assets/{omit-C4dR5R2G.js → omit-DKSz8IbY.js} +0 -0
|
@@ -38,7 +38,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.profileRoutes = void 0;
|
|
40
40
|
const router_1 = __importDefault(require("@koa/router"));
|
|
41
|
+
const fs_1 = require("fs");
|
|
42
|
+
const path_1 = require("path");
|
|
43
|
+
const os_1 = require("os");
|
|
44
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
41
45
|
const hermesCli = __importStar(require("../../services/hermes-cli"));
|
|
46
|
+
const apiServerDefaults = {
|
|
47
|
+
enabled: true,
|
|
48
|
+
host: '127.0.0.1',
|
|
49
|
+
port: 8642,
|
|
50
|
+
key: '',
|
|
51
|
+
cors_origins: '*',
|
|
52
|
+
};
|
|
53
|
+
function ensureApiServerConfig(profilePath) {
|
|
54
|
+
const configPath = (0, path_1.join)(profilePath, 'config.yaml');
|
|
55
|
+
try {
|
|
56
|
+
if (!(0, fs_1.existsSync)(configPath)) {
|
|
57
|
+
// Profile has no config.yaml — run hermes setup --reset to generate full defaults,
|
|
58
|
+
// then inject api_server config (setup itself doesn't add it)
|
|
59
|
+
console.log(`[Profile] No config.yaml for ${profilePath}, running setup --reset`);
|
|
60
|
+
return { needSetup: true, path: profilePath };
|
|
61
|
+
}
|
|
62
|
+
const content = (0, fs_1.readFileSync)(configPath, 'utf-8');
|
|
63
|
+
const cfg = js_yaml_1.default.load(content) || {};
|
|
64
|
+
if (!cfg.platforms)
|
|
65
|
+
cfg.platforms = {};
|
|
66
|
+
if (!cfg.platforms.api_server) {
|
|
67
|
+
cfg.platforms.api_server = { ...apiServerDefaults };
|
|
68
|
+
(0, fs_1.writeFileSync)(configPath, js_yaml_1.default.dump(cfg), 'utf-8');
|
|
69
|
+
console.log(`[Profile] Ensured api_server config for: ${profilePath}`);
|
|
70
|
+
}
|
|
71
|
+
return { needSetup: false, path: profilePath };
|
|
72
|
+
}
|
|
73
|
+
catch { }
|
|
74
|
+
return { needSetup: false, path: profilePath };
|
|
75
|
+
}
|
|
42
76
|
exports.profileRoutes = new router_1.default();
|
|
43
77
|
// GET /api/profiles - List all profiles
|
|
44
78
|
exports.profileRoutes.get('/api/hermes/profiles', async (ctx) => {
|
|
@@ -136,12 +170,12 @@ exports.profileRoutes.put('/api/hermes/profiles/active', async (ctx) => {
|
|
|
136
170
|
return;
|
|
137
171
|
}
|
|
138
172
|
try {
|
|
139
|
-
// 1. Stop gateway
|
|
173
|
+
// 1. Stop gateway
|
|
140
174
|
try {
|
|
141
175
|
await hermesCli.stopGateway();
|
|
142
176
|
}
|
|
143
177
|
catch { }
|
|
144
|
-
// 2. Kill gateway by port if still running
|
|
178
|
+
// 2. Kill gateway by port if still running
|
|
145
179
|
try {
|
|
146
180
|
const { execSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
|
|
147
181
|
const isWin = process.platform === 'win32';
|
|
@@ -168,12 +202,38 @@ exports.profileRoutes.put('/api/hermes/profiles/active', async (ctx) => {
|
|
|
168
202
|
// 3. Switch profile
|
|
169
203
|
const output = await hermesCli.useProfile(name);
|
|
170
204
|
await new Promise(r => setTimeout(r, 1000));
|
|
171
|
-
// 4.
|
|
205
|
+
// 4. Ensure api_server config for new profile
|
|
206
|
+
try {
|
|
207
|
+
const detail = await hermesCli.getProfile(name);
|
|
208
|
+
console.log(`[Profile] detail.path = ${detail.path}`);
|
|
209
|
+
const result = ensureApiServerConfig(detail.path);
|
|
210
|
+
if (result?.needSetup) {
|
|
211
|
+
// No config.yaml — run setup --reset to create full default config,
|
|
212
|
+
// then ensure api_server is present
|
|
213
|
+
try {
|
|
214
|
+
await hermesCli.setupReset();
|
|
215
|
+
}
|
|
216
|
+
catch { }
|
|
217
|
+
ensureApiServerConfig(detail.path);
|
|
218
|
+
}
|
|
219
|
+
// Create .env if target has none
|
|
220
|
+
const profileEnv = (0, path_1.join)(detail.path, '.env');
|
|
221
|
+
console.log(`[Profile] .env exists: ${(0, fs_1.existsSync)(profileEnv)}, path: ${profileEnv}`);
|
|
222
|
+
if (!(0, fs_1.existsSync)(profileEnv)) {
|
|
223
|
+
(0, fs_1.writeFileSync)(profileEnv, '# Hermes Agent Environment Configuration\n', 'utf-8');
|
|
224
|
+
console.log(`[Profile] Created .env for: ${detail.path}`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch (err) {
|
|
228
|
+
console.error(`[Profile] Ensure config failed:`, err.message);
|
|
229
|
+
}
|
|
230
|
+
// 5. Start gateway
|
|
172
231
|
try {
|
|
173
|
-
await hermesCli.
|
|
232
|
+
await hermesCli.startGateway();
|
|
233
|
+
console.log('[Profile] Gateway started');
|
|
174
234
|
}
|
|
175
235
|
catch {
|
|
176
|
-
// Fallback for WSL
|
|
236
|
+
// Fallback: background mode (for WSL etc.)
|
|
177
237
|
try {
|
|
178
238
|
const pid = await hermesCli.startGatewayBackground();
|
|
179
239
|
await new Promise(r => setTimeout(r, 3000));
|
|
@@ -190,13 +250,28 @@ exports.profileRoutes.put('/api/hermes/profiles/active', async (ctx) => {
|
|
|
190
250
|
ctx.body = { error: err.message };
|
|
191
251
|
}
|
|
192
252
|
});
|
|
193
|
-
// POST /api/profiles/:name/export - Export profile to archive
|
|
253
|
+
// POST /api/profiles/:name/export - Export profile to archive and download
|
|
194
254
|
exports.profileRoutes.post('/api/hermes/profiles/:name/export', async (ctx) => {
|
|
195
255
|
const { name } = ctx.params;
|
|
196
|
-
const
|
|
256
|
+
const outputPath = (0, path_1.join)((0, os_1.tmpdir)(), `hermes-profile-${name}.tar.gz`);
|
|
197
257
|
try {
|
|
198
|
-
|
|
199
|
-
|
|
258
|
+
await hermesCli.exportProfile(name, outputPath);
|
|
259
|
+
if (!(0, fs_1.existsSync)(outputPath)) {
|
|
260
|
+
ctx.status = 500;
|
|
261
|
+
ctx.body = { error: 'Export file not found' };
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const filename = (0, path_1.basename)(outputPath);
|
|
265
|
+
ctx.set('Content-Disposition', `attachment; filename="${filename}"`);
|
|
266
|
+
ctx.set('Content-Type', 'application/gzip');
|
|
267
|
+
ctx.body = (0, fs_1.createReadStream)(outputPath);
|
|
268
|
+
// Clean up temp file after response ends
|
|
269
|
+
ctx.res.on('finish', () => {
|
|
270
|
+
try {
|
|
271
|
+
(0, fs_1.unlinkSync)(outputPath);
|
|
272
|
+
}
|
|
273
|
+
catch { }
|
|
274
|
+
});
|
|
200
275
|
}
|
|
201
276
|
catch (err) {
|
|
202
277
|
ctx.status = 500;
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.setupTerminalWebSocket = setupTerminalWebSocket;
|
|
37
4
|
const ws_1 = require("ws");
|
|
38
5
|
const fs_1 = require("fs");
|
|
39
|
-
const pty = __importStar(require("node-pty"));
|
|
40
6
|
const auth_1 = require("../../services/auth");
|
|
7
|
+
let pty = null;
|
|
8
|
+
try {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
10
|
+
pty = require('node-pty');
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
console.warn('[Terminal] node-pty failed to load, terminal feature disabled');
|
|
14
|
+
}
|
|
41
15
|
// ─── Shell detection ────────────────────────────────────────────
|
|
42
16
|
function findShell() {
|
|
43
17
|
const candidates = [
|
|
@@ -85,6 +59,10 @@ function createSession(shell) {
|
|
|
85
59
|
}
|
|
86
60
|
// ─── WebSocket server setup ─────────────────────────────────────
|
|
87
61
|
function setupTerminalWebSocket(httpServer) {
|
|
62
|
+
if (!pty) {
|
|
63
|
+
console.warn('[Terminal] node-pty not available, skipping terminal WebSocket setup');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
88
66
|
const wss = new ws_1.WebSocketServer({ noServer: true });
|
|
89
67
|
const defaultShell = findShell();
|
|
90
68
|
httpServer.on('upgrade', async (req, socket, head) => {
|
|
@@ -8,10 +8,9 @@ const router_1 = __importDefault(require("@koa/router"));
|
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
9
|
const promises_1 = require("fs/promises");
|
|
10
10
|
const promises_2 = require("fs/promises");
|
|
11
|
-
const path_1 = require("path");
|
|
12
|
-
const os_1 = require("os");
|
|
13
11
|
const hermes_cli_1 = require("../../services/hermes-cli");
|
|
14
|
-
const
|
|
12
|
+
const hermes_profile_1 = require("../../services/hermes-profile");
|
|
13
|
+
const envPath = () => (0, hermes_profile_1.getActiveEnvPath)();
|
|
15
14
|
const ILINK_BASE = 'https://ilinkai.weixin.qq.com';
|
|
16
15
|
exports.weixinRoutes = new router_1.default();
|
|
17
16
|
// GET /api/weixin/qrcode — fetch QR code from Tencent iLink API
|
|
@@ -79,7 +78,7 @@ exports.weixinRoutes.post('/api/hermes/weixin/save', async (ctx) => {
|
|
|
79
78
|
try {
|
|
80
79
|
let raw;
|
|
81
80
|
try {
|
|
82
|
-
raw = await (0, promises_1.readFile)(envPath, 'utf-8');
|
|
81
|
+
raw = await (0, promises_1.readFile)(envPath(), 'utf-8');
|
|
83
82
|
}
|
|
84
83
|
catch {
|
|
85
84
|
raw = '';
|
|
@@ -116,9 +115,10 @@ exports.weixinRoutes.post('/api/hermes/weixin/save', async (ctx) => {
|
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
let output = result.join('\n').replace(/\n{3,}/g, '\n\n').replace(/\n+$/, '') + '\n';
|
|
119
|
-
|
|
118
|
+
const ep = envPath();
|
|
119
|
+
await (0, promises_1.writeFile)(ep, output, 'utf-8');
|
|
120
120
|
try {
|
|
121
|
-
await (0, promises_2.chmod)(
|
|
121
|
+
await (0, promises_2.chmod)(ep, 0o600);
|
|
122
122
|
}
|
|
123
123
|
catch { /* ignore */ }
|
|
124
124
|
await (0, hermes_cli_1.restartGateway)();
|
|
@@ -115,6 +115,10 @@ export declare function useProfile(name: string): Promise<string>;
|
|
|
115
115
|
* Export profile to archive
|
|
116
116
|
*/
|
|
117
117
|
export declare function exportProfile(name: string, outputPath?: string): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Run hermes setup --non-interactive --reset to generate default config for current profile
|
|
120
|
+
*/
|
|
121
|
+
export declare function setupReset(): Promise<string>;
|
|
118
122
|
/**
|
|
119
123
|
* Import profile from archive
|
|
120
124
|
*/
|
|
@@ -18,6 +18,7 @@ exports.deleteProfile = deleteProfile;
|
|
|
18
18
|
exports.renameProfile = renameProfile;
|
|
19
19
|
exports.useProfile = useProfile;
|
|
20
20
|
exports.exportProfile = exportProfile;
|
|
21
|
+
exports.setupReset = setupReset;
|
|
21
22
|
exports.importProfile = importProfile;
|
|
22
23
|
const child_process_1 = require("child_process");
|
|
23
24
|
const util_1 = require("util");
|
|
@@ -429,6 +430,22 @@ async function exportProfile(name, outputPath) {
|
|
|
429
430
|
throw new Error(`Failed to export profile: ${err.message}`);
|
|
430
431
|
}
|
|
431
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Run hermes setup --non-interactive --reset to generate default config for current profile
|
|
435
|
+
*/
|
|
436
|
+
async function setupReset() {
|
|
437
|
+
try {
|
|
438
|
+
const { stdout, stderr } = await execFileAsync('hermes', ['setup', '--non-interactive', '--reset'], {
|
|
439
|
+
timeout: 30000,
|
|
440
|
+
...execOpts,
|
|
441
|
+
});
|
|
442
|
+
return stdout || stderr;
|
|
443
|
+
}
|
|
444
|
+
catch (err) {
|
|
445
|
+
console.error('[Hermes CLI] setup reset failed:', err.message);
|
|
446
|
+
throw new Error(`Failed to reset config: ${err.message}`);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
432
449
|
/**
|
|
433
450
|
* Import profile from archive
|
|
434
451
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the active profile's home directory.
|
|
3
|
+
* default → ~/.hermes/
|
|
4
|
+
* other → ~/.hermes/profiles/{name}/
|
|
5
|
+
*/
|
|
6
|
+
export declare function getActiveProfileDir(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the active profile's config.yaml path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getActiveConfigPath(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the active profile's auth.json path.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getActiveAuthPath(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the active profile's .env path.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getActiveEnvPath(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the active profile name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getActiveProfileName(): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getActiveProfileDir = getActiveProfileDir;
|
|
4
|
+
exports.getActiveConfigPath = getActiveConfigPath;
|
|
5
|
+
exports.getActiveAuthPath = getActiveAuthPath;
|
|
6
|
+
exports.getActiveEnvPath = getActiveEnvPath;
|
|
7
|
+
exports.getActiveProfileName = getActiveProfileName;
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const os_1 = require("os");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const HERMES_BASE = (0, path_1.resolve)((0, os_1.homedir)(), '.hermes');
|
|
12
|
+
/**
|
|
13
|
+
* Get the active profile's home directory.
|
|
14
|
+
* default → ~/.hermes/
|
|
15
|
+
* other → ~/.hermes/profiles/{name}/
|
|
16
|
+
*/
|
|
17
|
+
function getActiveProfileDir() {
|
|
18
|
+
const activeFile = (0, path_1.join)(HERMES_BASE, 'active_profile');
|
|
19
|
+
try {
|
|
20
|
+
const name = (0, fs_1.readFileSync)(activeFile, 'utf-8').trim();
|
|
21
|
+
if (name && name !== 'default') {
|
|
22
|
+
const dir = (0, path_1.join)(HERMES_BASE, 'profiles', name);
|
|
23
|
+
if ((0, fs_1.existsSync)(dir))
|
|
24
|
+
return dir;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
return HERMES_BASE;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the active profile's config.yaml path.
|
|
32
|
+
*/
|
|
33
|
+
function getActiveConfigPath() {
|
|
34
|
+
return (0, path_1.join)(getActiveProfileDir(), 'config.yaml');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the active profile's auth.json path.
|
|
38
|
+
*/
|
|
39
|
+
function getActiveAuthPath() {
|
|
40
|
+
return (0, path_1.join)(getActiveProfileDir(), 'auth.json');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the active profile's .env path.
|
|
44
|
+
*/
|
|
45
|
+
function getActiveEnvPath() {
|
|
46
|
+
return (0, path_1.join)(getActiveProfileDir(), '.env');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the active profile name.
|
|
50
|
+
*/
|
|
51
|
+
function getActiveProfileName() {
|
|
52
|
+
const activeFile = (0, path_1.join)(HERMES_BASE, 'active_profile');
|
|
53
|
+
try {
|
|
54
|
+
const name = (0, fs_1.readFileSync)(activeFile, 'utf-8').trim();
|
|
55
|
+
return name || 'default';
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return 'default';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -39,7 +39,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
39
39
|
{
|
|
40
40
|
label: 'DeepSeek',
|
|
41
41
|
value: 'deepseek',
|
|
42
|
-
base_url: 'https://api.deepseek.com
|
|
42
|
+
base_url: 'https://api.deepseek.com',
|
|
43
43
|
models: ['deepseek-chat', 'deepseek-reasoner'],
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -49,8 +49,8 @@ exports.PROVIDER_PRESETS = [
|
|
|
49
49
|
models: ['glm-5', 'glm-5-turbo', 'glm-4.7', 'glm-4.5', 'glm-4.5-flash'],
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
label: 'Kimi Coding
|
|
53
|
-
value: 'kimi-coding',
|
|
52
|
+
label: 'Kimi for Coding',
|
|
53
|
+
value: 'kimi-for-coding',
|
|
54
54
|
base_url: 'https://api.kimi.com/coding/v1',
|
|
55
55
|
models: [
|
|
56
56
|
'kimi-for-coding',
|
|
@@ -61,12 +61,6 @@ exports.PROVIDER_PRESETS = [
|
|
|
61
61
|
'kimi-k2-0905-preview',
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
|
-
{
|
|
65
|
-
label: 'Moonshot (Pay-as-you-go)',
|
|
66
|
-
value: 'moonshot',
|
|
67
|
-
base_url: 'https://api.moonshot.ai/v1',
|
|
68
|
-
models: ['kimi-k2.5', 'kimi-k2-thinking', 'kimi-k2-turbo-preview', 'kimi-k2-0905-preview'],
|
|
69
|
-
},
|
|
70
64
|
{
|
|
71
65
|
label: 'xAI',
|
|
72
66
|
value: 'xai',
|
|
@@ -87,7 +81,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
87
81
|
{
|
|
88
82
|
label: 'MiniMax',
|
|
89
83
|
value: 'minimax',
|
|
90
|
-
base_url: 'https://api.minimax.io/anthropic',
|
|
84
|
+
base_url: 'https://api.minimax.io/anthropic/v1',
|
|
91
85
|
models: ['MiniMax-M2.7', 'MiniMax-M2.5', 'MiniMax-M2.1', 'MiniMax-M2'],
|
|
92
86
|
},
|
|
93
87
|
{
|
|
@@ -133,7 +127,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
133
127
|
},
|
|
134
128
|
{
|
|
135
129
|
label: 'Kilo Code',
|
|
136
|
-
value: '
|
|
130
|
+
value: 'kilo',
|
|
137
131
|
base_url: 'https://api.kilo.ai/api/gateway',
|
|
138
132
|
models: [
|
|
139
133
|
'anthropic/claude-opus-4.6',
|
|
@@ -144,8 +138,8 @@ exports.PROVIDER_PRESETS = [
|
|
|
144
138
|
],
|
|
145
139
|
},
|
|
146
140
|
{
|
|
147
|
-
label: 'AI Gateway',
|
|
148
|
-
value: '
|
|
141
|
+
label: 'Vercel AI Gateway',
|
|
142
|
+
value: 'vercel',
|
|
149
143
|
base_url: 'https://ai-gateway.vercel.sh/v1',
|
|
150
144
|
models: [
|
|
151
145
|
'anthropic/claude-opus-4.6',
|
|
@@ -164,7 +158,7 @@ exports.PROVIDER_PRESETS = [
|
|
|
164
158
|
},
|
|
165
159
|
{
|
|
166
160
|
label: 'OpenCode Zen',
|
|
167
|
-
value: 'opencode
|
|
161
|
+
value: 'opencode',
|
|
168
162
|
base_url: 'https://opencode.ai/zen/v1',
|
|
169
163
|
models: [
|
|
170
164
|
'gpt-5.4-pro',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermes-web-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Web dashboard for Hermes Agent — multi-platform AI chat, session management, scheduled jobs, usage analytics & channel configuration (Telegram, Discord, Slack, WhatsApp)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,G as i,J as a,Q as o,T as s,U as c,W as l,Y as u,ct as d,gt as f,j as p,k as m,mt as h,pt as g,q as _,w as v,y}from"./router-COwpqexM.js";import{r as b,t as x}from"./_plugin-vue_export-helper-BkT4A29V.js";import{t as S}from"./Button-zECKCotA.js";import{t as C}from"./Input-DxJk6pT-.js";import{t as w}from"./Tag-DWc4lbAm.js";import{t as T}from"./use-message-g8F4Z57w.js";import{t as E}from"./Spin-lybeIDeX.js";import{t as D}from"./Switch-mgeu-lpD.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./SettingRow-CLLFxWP3.js";var P={class:`platform-info`},F=[`innerHTML`],I={class:`platform-name`},L={key:0,class:`platform-card-body`},R=x(p({__name:`PlatformCard`,props:{name:{},icon:{},config:{},credentials:{}},setup(s){let c=s,l=d(!0),{t:u}=b(),p=t(()=>{let e=c.credentials;if(!e)return!1;let t=[`token`,`api_key`,`app_id`,`client_id`,`secret`,`app_secret`,`client_secret`,`access_token`,`bot_id`,`account_id`,`enabled`];return[e,e.extra].filter(Boolean).some(e=>t.some(t=>{let n=e[t];return n!=null&&n!==``&&n!==!1}))});return(t,c)=>(i(),n(`div`,{class:h([`platform-card`,{configured:p.value}])},[v(`div`,{class:`platform-card-header`,onClick:c[0]||=e=>l.value=!l.value},[v(`div`,P,[v(`span`,{class:`platform-icon`,innerHTML:s.icon},null,8,F),v(`span`,I,f(s.name),1),e(g(w),{type:p.value?`success`:`default`,size:`small`,round:``},{default:o(()=>[m(f(p.value?g(u)(`common.configured`):g(u)(`common.notConfigured`)),1)]),_:1},8,[`type`])]),v(`span`,{class:h([`expand-icon`,{expanded:l.value}])},`▾`,2)]),l.value?(i(),n(`div`,L,[a(t.$slots,`default`,{},void 0,!0)])):r(``,!0)],2))}}),[[`__scopeId`,`data-v-07636e04`]]),z={class:`settings-section`},B={class:`weixin-qr-section`},V={key:1,class:`weixin-qr-loading`},H={key:2,class:`weixin-qr-hint`},U=x(p({__name:`PlatformSettings`,setup(t){let a=A(),c=T(),{t:p}=b();async function h(e,t){try{await a.saveSection(e,t),c.success(p(`settings.saved`))}catch{c.error(p(`settings.saveFailed`))}}let x=d(!1);async function w(e,t){x.value=!0;try{await O(e,t),await a.fetchSettings(),c.success(p(`settings.saved`))}catch{c.error(p(`settings.saveFailed`))}finally{x.value=!1}}function E(e){return a.platforms[e]||{}}let P=d(``),F=d(``),I=d(`idle`),L=null;async function U(){I.value=`loading`,P.value=``,F.value=``,G();try{let e=await M();F.value=e.qrcode,P.value=e.qrcode_url,window.open(e.qrcode_url,`_blank`),I.value=`waiting`,W()}catch(e){I.value=`error`,c.error(e.message||p(`platform.qrFetching`))}}function W(){F.value&&(L=setTimeout(async()=>{try{let e=await k(F.value);e.status===`wait`?W():e.status===`scaned`?(I.value=`scaned`,W()):e.status===`expired`?I.value=`expired`:e.status===`confirmed`&&(I.value=`confirmed`,await j({account_id:e.account_id,token:e.token,base_url:e.base_url}),await a.fetchSettings(),c.success(p(`settings.saved`)))}catch{W()}},3e3))}function G(){L&&=(clearTimeout(L),null)}l(()=>{G()});let K=[{key:`telegram`,name:`Telegram`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>`},{key:`discord`,name:`Discord`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189z"/></svg>`},{key:`slack`,name:`Slack`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zm10.122 0a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V5.042zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1 2.523-2.52h6.313A2.528 2.528 0 0 1 24 18.956a2.528 2.528 0 0 1-2.522 2.523h-6.313z"/></svg>`},{key:`whatsapp`,name:`WhatsApp`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg>`},{key:`matrix`,name:`Matrix`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.48.324.448.217.786.619 1.017 1.205.24-.376.558-.702.956-.98.398-.277.872-.414 1.424-.414.41 0 .784.065 1.122.194.34.13.629.325.87.588.241.263.428.59.56.984.132.393.198.85.198 1.368v5.89h-2.49v-4.893c0-.268-.016-.525-.048-.77a1.627 1.627 0 00-.2-.63 1.028 1.028 0 00-.392-.426 1.294 1.294 0 00-.616-.134c-.277 0-.508.05-.693.15a1.043 1.043 0 00-.43.41 1.768 1.768 0 00-.214.616 4.15 4.15 0 00-.06.74v4.937H9.29v-4.937c0-.25-.01-.498-.032-.742a1.84 1.84 0 00-.166-.638.998.998 0 00-.363-.448 1.206 1.206 0 00-.624-.154c-.26 0-.483.048-.67.144a1.055 1.055 0 00-.436.402 1.744 1.744 0 00-.227.616 4.108 4.108 0 00-.063.74v4.937H5.21V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z"/></svg>`},{key:`feishu`,name:`Feishu`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M6.59 3.41a2.25 2.25 0 0 1 3.182 0L13.5 7.14l-3.182 3.182L6.59 7.59a2.25 2.25 0 0 1 0-3.182zm5.303 5.303L15.075 5.53a2.25 2.25 0 0 1 3.182 3.182L15.075 11.894 11.893 8.713zM3.41 6.59a2.25 2.25 0 0 1 3.182 0l3.182 3.182-3.182 3.182a2.25 2.25 0 0 1-3.182-3.182L3.41 6.59zm5.303 5.303L11.894 15.075a2.25 2.25 0 0 1-3.182 3.182L5.53 15.075 8.713 11.893zm5.303-5.303L17.478 9.778a2.25 2.25 0 0 1-3.182 3.182L10.53 10.075l3.182-3.182 0 .023z"/></svg>`},{key:`weixin`,name:`Weixin`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>`},{key:`wecom`,name:`WeCom`,icon:`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 00.167-.054l1.903-1.114a.864.864 0 01.717-.098 10.16 10.16 0 002.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178A1.17 1.17 0 014.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 01-1.162 1.178 1.17 1.17 0 01-1.162-1.178c0-.651.52-1.18 1.162-1.18zm3.68 4.025c-3.694 0-6.69 2.462-6.69 5.496 0 3.034 2.996 5.496 6.69 5.496.753 0 1.477-.1 2.158-.28a.66.66 0 01.548.074l1.46.854a.25.25 0 00.127.041.224.224 0 00.221-.225c0-.055-.022-.109-.037-.162l-.298-1.131a.453.453 0 01.163-.509C21.81 18.613 22.77 16.973 22.77 15.512c0-3.034-2.996-5.496-6.69-5.496h.198zm-2.454 3.347c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902zm4.912 0c.491 0 .889.404.889.902a.896.896 0 01-.889.903.896.896 0 01-.889-.903c0-.498.398-.902.889-.902z"/></svg>`}];return(t,c)=>{let l=u(`NSpin`);return i(),n(`section`,z,[(i(),n(y,null,_(K,t=>e(R,{key:t.key,name:t.name,icon:t.icon,config:g(a)[t.key],credentials:E(t.key)},{default:o(()=>[t.key===`telegram`?(i(),n(y,{key:0},[e(N,{label:g(p)(`platform.botToken`),hint:g(p)(`platform.botTokenHint`)},{default:o(()=>[e(g(C),{value:E(`telegram`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`123456:ABC-DEF...`,"onUpdate:value":c[0]||=e=>w(`telegram`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).telegram.require_mention,"onUpdate:value":c[1]||=e=>h(`telegram`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.reactions`),hint:g(p)(`platform.reactionsHint`)},{default:o(()=>[e(g(D),{value:g(a).telegram.reactions,"onUpdate:value":c[2]||=e=>h(`telegram`,{reactions:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).telegram.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[3]||=e=>h(`telegram`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.mentionPatterns`),hint:g(p)(`platform.mentionPatternsHint`)},{default:o(()=>[e(g(C),{value:(g(a).telegram.mention_patterns||[]).join(`, `),size:`small`,placeholder:`pattern1, pattern2`,"onUpdate:value":c[4]||=e=>h(`telegram`,{mention_patterns:e?e.split(`,`).map(e=>e.trim()):[]})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`discord`?(i(),n(y,{key:1},[e(N,{label:g(p)(`platform.botToken`),hint:g(p)(`platform.botTokenHint`)},{default:o(()=>[e(g(C),{value:E(`discord`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Bot token...`,"onUpdate:value":c[5]||=e=>w(`discord`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionChannel`)},{default:o(()=>[e(g(D),{value:g(a).discord.require_mention,"onUpdate:value":c[6]||=e=>h(`discord`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.autoThread`),hint:g(p)(`platform.autoThreadHint`)},{default:o(()=>[e(g(D),{value:g(a).discord.auto_thread,"onUpdate:value":c[7]||=e=>h(`discord`,{auto_thread:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.reactions`),hint:g(p)(`platform.reactionsHint`)},{default:o(()=>[e(g(D),{value:g(a).discord.reactions,"onUpdate:value":c[8]||=e=>h(`discord`,{reactions:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChannels`),hint:g(p)(`platform.freeResponseChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.free_response_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[9]||=e=>h(`discord`,{free_response_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.allowedChannels`),hint:g(p)(`platform.allowedChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.allowed_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[10]||=e=>h(`discord`,{allowed_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.ignoredChannels`),hint:g(p)(`platform.ignoredChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.ignored_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[11]||=e=>h(`discord`,{ignored_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.noThreadChannels`),hint:g(p)(`platform.noThreadChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).discord.no_thread_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[12]||=e=>h(`discord`,{no_thread_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`slack`?(i(),n(y,{key:2},[e(N,{label:g(p)(`platform.botToken`),hint:g(p)(`platform.botTokenHint`)},{default:o(()=>[e(g(C),{value:E(`slack`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`xoxb-...`,"onUpdate:value":c[13]||=e=>w(`slack`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionChannel`)},{default:o(()=>[e(g(D),{value:g(a).slack.require_mention,"onUpdate:value":c[14]||=e=>h(`slack`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.allowBots`),hint:g(p)(`platform.allowBotsHint`)},{default:o(()=>[e(g(D),{value:g(a).slack.allow_bots,"onUpdate:value":c[15]||=e=>h(`slack`,{allow_bots:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChannels`),hint:g(p)(`platform.freeResponseChannelsHint`)},{default:o(()=>[e(g(C),{value:g(a).slack.free_response_channels||``,size:`small`,placeholder:`channel_id1,channel_id2`,"onUpdate:value":c[16]||=e=>h(`slack`,{free_response_channels:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`whatsapp`?(i(),n(y,{key:3},[e(N,{label:g(p)(`platform.waEnabled`),hint:g(p)(`platform.waEnabledHint`)},{default:o(()=>[e(g(D),{value:E(`whatsapp`).enabled,"onUpdate:value":c[17]||=e=>w(`whatsapp`,{enabled:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).whatsapp.require_mention,"onUpdate:value":c[18]||=e=>h(`whatsapp`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).whatsapp.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[19]||=e=>h(`whatsapp`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.mentionPatterns`),hint:g(p)(`platform.mentionPatternsHint`)},{default:o(()=>[e(g(C),{value:(g(a).whatsapp.mention_patterns||[]).join(`, `),size:`small`,placeholder:`pattern1, pattern2`,"onUpdate:value":c[20]||=e=>h(`whatsapp`,{mention_patterns:e?e.split(`,`).map(e=>e.trim()):[]})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`matrix`?(i(),n(y,{key:4},[e(N,{label:g(p)(`platform.accessToken`),hint:g(p)(`platform.accessTokenHint`)},{default:o(()=>[e(g(C),{value:E(`matrix`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`syt_...`,"onUpdate:value":c[21]||=e=>w(`matrix`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.homeserver`),hint:g(p)(`platform.homeserverHint`)},{default:o(()=>[e(g(C),{value:E(`matrix`).extra?.homeserver||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`https://matrix.org`,"onUpdate:value":c[22]||=e=>w(`matrix`,{extra:{...E(`matrix`).extra,homeserver:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionRoom`)},{default:o(()=>[e(g(D),{value:g(a).matrix.require_mention,"onUpdate:value":c[23]||=e=>h(`matrix`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.autoThread`),hint:g(p)(`platform.autoThreadHintRoom`)},{default:o(()=>[e(g(D),{value:g(a).matrix.auto_thread,"onUpdate:value":c[24]||=e=>h(`matrix`,{auto_thread:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.dmMentionThreads`),hint:g(p)(`platform.dmMentionThreadsHint`)},{default:o(()=>[e(g(D),{value:g(a).matrix.dm_mention_threads,"onUpdate:value":c[25]||=e=>h(`matrix`,{dm_mention_threads:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseRooms`),hint:g(p)(`platform.freeResponseRoomsHint`)},{default:o(()=>[e(g(C),{value:g(a).matrix.free_response_rooms||``,size:`small`,placeholder:`room_id1,room_id2`,"onUpdate:value":c[26]||=e=>h(`matrix`,{free_response_rooms:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`feishu`?(i(),n(y,{key:5},[e(N,{label:g(p)(`platform.appId`),hint:g(p)(`platform.appIdHint`)},{default:o(()=>[e(g(C),{value:E(`feishu`).extra?.app_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`cli_...`,"onUpdate:value":c[27]||=e=>w(`feishu`,{extra:{...E(`feishu`).extra,app_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.appSecret`),hint:g(p)(`platform.appSecretHint`)},{default:o(()=>[e(g(C),{value:E(`feishu`).extra?.app_secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`App Secret`,"onUpdate:value":c[28]||=e=>w(`feishu`,{extra:{...E(`feishu`).extra,app_secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).feishu.require_mention,"onUpdate:value":c[29]||=e=>h(`feishu`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).feishu.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[30]||=e=>h(`feishu`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`dingtalk`?(i(),n(y,{key:6},[e(N,{label:g(p)(`platform.clientId`),hint:g(p)(`platform.clientIdHint`)},{default:o(()=>[e(g(C),{value:E(`dingtalk`).extra?.client_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Client ID`,"onUpdate:value":c[31]||=e=>w(`dingtalk`,{extra:{...E(`dingtalk`).extra,client_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.clientSecret`),hint:g(p)(`platform.clientSecretHint`)},{default:o(()=>[e(g(C),{value:E(`dingtalk`).extra?.client_secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Client Secret`,"onUpdate:value":c[32]||=e=>w(`dingtalk`,{extra:{...E(`dingtalk`).extra,client_secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.requireMention`),hint:g(p)(`platform.requireMentionGroup`)},{default:o(()=>[e(g(D),{value:g(a).dingtalk.require_mention,"onUpdate:value":c[33]||=e=>h(`dingtalk`,{require_mention:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.freeResponseChats`),hint:g(p)(`platform.freeResponseChatsHint`)},{default:o(()=>[e(g(C),{value:g(a).dingtalk.free_response_chats||``,size:`small`,placeholder:`chat_id1,chat_id2`,"onUpdate:value":c[34]||=e=>h(`dingtalk`,{free_response_chats:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`weixin`?(i(),n(y,{key:7},[v(`div`,B,[I.value===`idle`||I.value===`error`||I.value===`expired`||I.value===`confirmed`?(i(),s(g(S),{key:0,type:`primary`,size:`small`,onClick:U},{default:o(()=>[m(f(I.value===`confirmed`?g(p)(`platform.qrRelogin`):g(p)(`platform.qrLogin`)),1)]),_:1})):r(``,!0),I.value===`loading`?(i(),n(`div`,V,[e(l,{size:`small`}),v(`span`,null,f(g(p)(`platform.qrFetching`)),1)])):r(``,!0),I.value===`waiting`||I.value===`scaned`?(i(),n(`div`,H,f(I.value===`scaned`?g(p)(`platform.qrScanedHint`):g(p)(`platform.qrScanHint`)),1)):r(``,!0)]),e(N,{label:g(p)(`platform.weixinToken`),hint:g(p)(`platform.weixinTokenHint`)},{default:o(()=>[e(g(C),{value:E(`weixin`).token||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Token`,"onUpdate:value":c[35]||=e=>w(`weixin`,{token:e})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.accountId`),hint:g(p)(`platform.accountIdHint`)},{default:o(()=>[e(g(C),{value:E(`weixin`).extra?.account_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Account ID`,"onUpdate:value":c[36]||=e=>w(`weixin`,{extra:{...E(`weixin`).extra,account_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0),t.key===`wecom`?(i(),n(y,{key:8},[e(N,{label:g(p)(`platform.botId`),hint:g(p)(`platform.botIdHint`)},{default:o(()=>[e(g(C),{value:E(`wecom`).extra?.bot_id||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Bot ID`,"onUpdate:value":c[37]||=e=>w(`wecom`,{extra:{...E(`wecom`).extra,bot_id:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`]),e(N,{label:g(p)(`platform.appSecret`),hint:g(p)(`platform.wecomSecretHint`)},{default:o(()=>[e(g(C),{value:E(`wecom`).extra?.secret||``,clearable:``,size:`small`,class:`input-lg`,placeholder:`Secret`,"onUpdate:value":c[38]||=e=>w(`wecom`,{extra:{...E(`wecom`).extra,secret:e}})},null,8,[`value`])]),_:1},8,[`label`,`hint`])],64)):r(``,!0)]),_:2},1032,[`name`,`icon`,`config`,`credentials`])),64))])}}}),[[`__scopeId`,`data-v-89b6c2e1`]]),W={class:`channels-view`},G={class:`page-header`},K={class:`header-title`},q={class:`channels-content`},J=x(p({__name:`ChannelsView`,setup(t){let r=A(),{t:a}=b();return c(()=>{r.fetchSettings()}),(t,s)=>(i(),n(`div`,W,[v(`header`,G,[v(`h2`,K,f(g(a)(`sidebar.channels`)),1)]),v(`div`,q,[e(g(E),{show:g(r).loading||g(r).saving,size:`large`,description:g(a)(`common.loading`)},{default:o(()=>[e(U)]),_:1},8,[`show`,`description`])])]))}}),[[`__scopeId`,`data-v-51c1ea7b`]]);export{J as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.memory-view[data-v-f871a6dd]{height:calc(100 * var(--vh));flex-direction:column;display:flex}.memory-content[data-v-f871a6dd]{flex-direction:column;flex:1;padding:20px;display:flex;overflow:hidden}.memory-loading[data-v-f871a6dd]{color:#999;flex:1;justify-content:center;align-items:center;font-size:13px;display:flex}.memory-sections[data-v-f871a6dd]{flex:1;gap:16px;min-height:0;display:flex}@media (width<=768px){.memory-sections[data-v-f871a6dd]{flex-direction:column}}.memory-section[data-v-f871a6dd]{border:1px solid #e0e0e0;border-radius:10px;flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.section-header[data-v-f871a6dd]{background:#f0f0f0;border-bottom:1px solid #e0e0e0;flex-shrink:0;justify-content:space-between;align-items:center;padding:10px 16px;display:flex}.section-title-row[data-v-f871a6dd]{align-items:center;gap:8px;display:flex}.section-icon[data-v-f871a6dd]{color:#666;display:flex}.section-title[data-v-f871a6dd]{color:#1a1a1a;font-size:14px;font-weight:600}.section-mtime[data-v-f871a6dd]{color:#999;font-size:11px}.section-body[data-v-f871a6dd]{flex:1;min-height:0;padding:16px;overflow-y:auto}.empty-text[data-v-f871a6dd]{color:#999;font-size:13px;font-style:italic}.section-edit[data-v-f871a6dd]{flex-direction:column;flex:1;min-height:0;padding:12px 16px;display:flex}.edit-textarea[data-v-f871a6dd]{color:#1a1a1a;resize:none;background:#fff;border:1px solid #e0e0e0;border-radius:6px;outline:none;flex:1;width:100%;min-height:0;padding:12px;font-family:JetBrains Mono,Fira Code,Consolas,monospace;font-size:13px;line-height:1.6}.edit-textarea[data-v-f871a6dd]:focus{border-color:#333}.edit-actions[data-v-f871a6dd]{justify-content:flex-end;gap:8px;margin-top:10px;display:flex}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,C as n,D as r,E as i,G as a,O as o,Q as s,T as c,U as l,ct as u,gt as d,j as f,k as p,m,pt as h,w as g}from"./router-COwpqexM.js";import{r as _,t as v}from"./_plugin-vue_export-helper-BkT4A29V.js";import{t as y}from"./Button-zECKCotA.js";import{t as b}from"./use-message-g8F4Z57w.js";import{t as x}from"./MarkdownRenderer-BA3oPVqT.js";import{a as ee,t as te}from"./skills-CRtljpt6.js";var S={class:`memory-view`},C={class:`page-header`},w={class:`header-title`},ne={class:`memory-content`},re={key:0,class:`memory-loading`},ie={key:1,class:`memory-sections`},ae={class:`memory-section`},T={class:`section-header`},E={class:`section-title-row`},D={class:`section-title`},O={key:0,class:`section-mtime`},k={key:0,class:`section-body`},A={key:1,class:`empty-text`},j={key:1,class:`section-edit`},M=[`placeholder`],N={class:`edit-actions`},P={class:`memory-section`},F={class:`section-header`},I={class:`section-title-row`},L={class:`section-title`},R={key:0,class:`section-mtime`},z={key:0,class:`section-body`},oe={key:1,class:`empty-text`},B={key:1,class:`section-edit`},V=[`placeholder`],H={class:`edit-actions`},U=v(f({__name:`MemoryView`,setup(f){let{t:v}=_(),U=b(),W=u(!1),G=u(null),K=u(null),q=u(``),J=u(!1);l(Y);async function Y(){W.value=!0;try{G.value=await te()}catch(e){console.error(`Failed to load memory:`,e),U.error(v(`memory.loadFailed`))}finally{W.value=!1}}function X(e){K.value=e,q.value=G.value?.[e]||``}function Z(){K.value=null,q.value=``}async function Q(){if(K.value){J.value=!0;try{await ee(K.value,q.value),await Y(),K.value=null,q.value=``,U.success(v(`common.saved`))}catch(e){U.error(`${v(`common.saveFailed`)}: ${e.message}`)}finally{J.value=!1}}}function $(e){return e?new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``}let se=n(()=>!G.value?.memory?.trim()),ce=n(()=>!G.value?.user?.trim()),le=n(()=>(G.value?.memory||``).replace(/§/g,`
|
|
2
|
-
|
|
3
|
-
`)),ue=n(()=>(G.value?.user||``).replace(/§/g,`
|
|
4
|
-
|
|
5
|
-
`));return(n,l)=>(a(),r(`div`,S,[g(`header`,C,[g(`h2`,w,d(h(v)(`memory.title`)),1),t(h(y),{size:`small`,quaternary:``,onClick:Y},{icon:s(()=>[...l[4]||=[g(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},[g(`polyline`,{points:`23 4 23 10 17 10`}),g(`path`,{d:`M20.49 15a9 9 0 1 1-2.12-9.36L23 10`})],-1)]]),default:s(()=>[p(` `+d(h(v)(`memory.refresh`)),1)]),_:1})]),g(`div`,ne,[W.value&&!G.value?(a(),r(`div`,re,d(h(v)(`common.loading`)),1)):(a(),r(`div`,ie,[g(`div`,ae,[g(`div`,T,[g(`div`,E,[l[5]||=o(`<span class="section-icon" data-v-f871a6dd><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-v-f871a6dd><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" data-v-f871a6dd></path><polyline points="14 2 14 8 20 8" data-v-f871a6dd></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-f871a6dd></line><line x1="16" y1="17" x2="8" y2="17" data-v-f871a6dd></line></svg></span>`,1),g(`span`,D,d(h(v)(`memory.myNotes`)),1),G.value?.memory_mtime?(a(),r(`span`,O,d($(G.value.memory_mtime)),1)):i(``,!0)]),K.value===`memory`?i(``,!0):(a(),c(h(y),{key:0,size:`tiny`,quaternary:``,onClick:l[0]||=e=>X(`memory`)},{icon:s(()=>[...l[6]||=[g(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[g(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),g(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1)]]),default:s(()=>[p(` `+d(h(v)(`common.edit`)),1)]),_:1}))]),K.value===`memory`?(a(),r(`div`,j,[e(g(`textarea`,{"onUpdate:modelValue":l[1]||=e=>q.value=e,class:`edit-textarea`,placeholder:h(v)(`memory.notesPlaceholder`),spellcheck:`false`},null,8,M),[[m,q.value]]),g(`div`,N,[t(h(y),{size:`small`,onClick:Z},{default:s(()=>[p(d(h(v)(`common.cancel`)),1)]),_:1}),t(h(y),{size:`small`,type:`primary`,loading:J.value,onClick:Q},{default:s(()=>[p(d(h(v)(`common.save`)),1)]),_:1},8,[`loading`])])])):(a(),r(`div`,k,[se.value?(a(),r(`p`,A,d(h(v)(`memory.noNotes`)),1)):(a(),c(x,{key:0,content:le.value},null,8,[`content`]))]))]),g(`div`,P,[g(`div`,F,[g(`div`,I,[l[7]||=g(`span`,{class:`section-icon`},[g(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[g(`path`,{d:`M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2`}),g(`circle`,{cx:`12`,cy:`7`,r:`4`})])],-1),g(`span`,L,d(h(v)(`memory.userProfile`)),1),G.value?.user_mtime?(a(),r(`span`,R,d($(G.value.user_mtime)),1)):i(``,!0)]),K.value===`user`?i(``,!0):(a(),c(h(y),{key:0,size:`tiny`,quaternary:``,onClick:l[2]||=e=>X(`user`)},{icon:s(()=>[...l[8]||=[g(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[g(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),g(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1)]]),default:s(()=>[p(` `+d(h(v)(`common.edit`)),1)]),_:1}))]),K.value===`user`?(a(),r(`div`,B,[e(g(`textarea`,{"onUpdate:modelValue":l[3]||=e=>q.value=e,class:`edit-textarea`,placeholder:h(v)(`memory.profilePlaceholder`),spellcheck:`false`},null,8,V),[[m,q.value]]),g(`div`,H,[t(h(y),{size:`small`,onClick:Z},{default:s(()=>[p(d(h(v)(`common.cancel`)),1)]),_:1}),t(h(y),{size:`small`,type:`primary`,loading:J.value,onClick:Q},{default:s(()=>[p(d(h(v)(`common.save`)),1)]),_:1},8,[`loading`])])])):(a(),r(`div`,z,[ce.value?(a(),r(`p`,oe,d(h(v)(`memory.noProfile`)),1)):(a(),c(x,{key:0,content:ue.value},null,8,[`content`]))]))])]))])]))}}),[[`__scopeId`,`data-v-f871a6dd`]]);export{U as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,F as i,G as a,Q as o,T as s,U as c,X as l,ct as u,gt as d,j as f,k as p,mt as m,pt as h,q as g,w as _,y as v}from"./router-COwpqexM.js";import{n as y}from"./pinia-bPUFQqFK.js";import{r as b,t as x}from"./_plugin-vue_export-helper-BkT4A29V.js";import{J as S}from"./browser-DzAOCZtm.js";import{a as C,t as w}from"./Modal-WQKdvHJY.js";import{n as ee,t as T}from"./FormItem-CZ9auYA2.js";import{t as E}from"./Select-C_hKaXgI.js";import{t as D}from"./Button-zECKCotA.js";import{t as O}from"./Input-DxJk6pT-.js";import{t as k}from"./use-message-g8F4Z57w.js";import{t as A}from"./Spin-lybeIDeX.js";import{a as j,i as M,n as N,r as P,t as F}from"./app-BUjbfMSg.js";function I(){let e=i(C,null);return e===null&&S(`use-dialog`,`No outer <n-dialog-provider /> founded.`),e}var L=y(`models`,()=>{let e=u([]),n=u(``),r=u(!1),i=t(()=>e.value.filter(e=>e.provider.startsWith(`custom:`))),a=t(()=>e.value.filter(e=>!e.provider.startsWith(`custom:`))),o=t(()=>e.value.flatMap(e=>e.models.map(t=>({id:t,provider:e.provider,label:e.label,base_url:e.base_url,isDefault:t===n.value}))));async function s(){r.value=!0;try{let t=await P();e.value=t.groups,n.value=t.default}catch(e){console.error(`Failed to fetch providers:`,e)}finally{r.value=!1}}async function c(e,t){await j({default:e,provider:t}),n.value=e,F().loadModels()}async function l(e){await N(e),await s(),F().loadModels()}async function d(e){await M(e),await s(),F().loadModels()}return{providers:e,defaultModel:n,loading:r,customProviders:i,builtinProviders:a,allModels:o,fetchProviders:s,setDefaultModel:c,addProvider:l,removeProvider:d}}),R={class:`provider-card`},z={class:`card-header`},B={class:`provider-name`},V={class:`card-body`},H={class:`info-row`},U={class:`info-label`},W={class:`info-value mono`},G={class:`info-row`},K={class:`info-label`},q={class:`info-value mono`},J={class:`card-actions`},Y=x(f({__name:`ProviderCard`,props:{provider:{}},setup(r){let i=r,{t:s}=b(),c=L(),l=k(),u=I(),f=t(()=>i.provider.provider.startsWith(`custom:`)),g=t(()=>i.provider.label);async function v(){u.warning({title:s(`models.deleteProvider`),content:s(`models.deleteConfirm`,{name:g.value}),positiveText:s(`common.delete`),negativeText:s(`common.cancel`),onPositiveClick:async()=>{try{await c.removeProvider(i.provider.provider),l.success(s(`models.providerDeleted`))}catch(e){l.error(e.message)}}})}return(t,i)=>(a(),n(`div`,R,[_(`div`,z,[_(`h3`,B,d(g.value),1),_(`span`,{class:m([`type-badge`,f.value?`custom`:`builtin`])},d(f.value?h(s)(`models.customType`):h(s)(`models.builtIn`)),3)]),_(`div`,V,[_(`div`,H,[_(`span`,U,d(h(s)(`models.provider`)),1),_(`code`,W,d(r.provider.provider),1)]),_(`div`,G,[_(`span`,K,d(h(s)(`models.baseUrl`)),1),_(`code`,q,d(r.provider.base_url),1)])]),_(`div`,J,[e(h(D),{size:`tiny`,quaternary:``,type:`error`,onClick:v},{default:o(()=>[p(d(h(s)(`common.delete`)),1)]),_:1})])]))}}),[[`__scopeId`,`data-v-bd3d787c`]]),X={key:0,class:`empty-state`},Z={key:1,class:`providers-grid`},Q=x(f({__name:`ProvidersPanel`,setup(e){let{t}=b(),r=L();return(e,i)=>h(r).providers.length===0?(a(),n(`div`,X,[i[0]||=_(`svg`,{width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,class:`empty-icon`},[_(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),_(`path`,{d:`M2 17l10 5 10-5`}),_(`path`,{d:`M2 12l10 5 10-5`})],-1),_(`p`,null,d(h(t)(`models.noProviders`)),1)])):(a(),n(`div`,Z,[(a(!0),n(v,null,g(h(r).providers,e=>(a(),s(Y,{key:e.provider,provider:e},null,8,[`provider`]))),128))]))}}),[[`__scopeId`,`data-v-76eec30b`]]),$=[{label:`Anthropic`,value:`anthropic`,base_url:`https://api.anthropic.com`,models:[`claude-opus-4-6`,`claude-sonnet-4-6`,`claude-opus-4-5-20251101`,`claude-sonnet-4-5-20250929`,`claude-opus-4-20250514`,`claude-sonnet-4-20250514`,`claude-haiku-4-5-20251001`]},{label:`Google AI Studio`,value:`gemini`,base_url:`https://generativelanguage.googleapis.com/v1beta/openai`,models:[`gemini-3.1-pro-preview`,`gemini-3-flash-preview`,`gemini-3.1-flash-lite-preview`,`gemini-2.5-pro`,`gemini-2.5-flash`,`gemini-2.5-flash-lite`,`gemma-4-31b-it`,`gemma-4-26b-it`]},{label:`DeepSeek`,value:`deepseek`,base_url:`https://api.deepseek.com/v1`,models:[`deepseek-chat`,`deepseek-reasoner`]},{label:`Z.AI / GLM`,value:`zai`,base_url:`https://api.z.ai/api/paas/v4`,models:[`glm-5`,`glm-5-turbo`,`glm-4.7`,`glm-4.5`,`glm-4.5-flash`]},{label:`Kimi Coding Plan`,value:`kimi-coding`,base_url:`https://api.kimi.com/coding/v1`,models:[`kimi-for-coding`,`kimi-k2.5`,`kimi-k2-thinking`,`kimi-k2-thinking-turbo`,`kimi-k2-turbo-preview`,`kimi-k2-0905-preview`]},{label:`Moonshot (Pay-as-you-go)`,value:`moonshot`,base_url:`https://api.moonshot.ai/v1`,models:[`kimi-k2.5`,`kimi-k2-thinking`,`kimi-k2-turbo-preview`,`kimi-k2-0905-preview`]},{label:`xAI`,value:`xai`,base_url:`https://api.x.ai/v1`,models:[`grok-4.20-0309-reasoning`,`grok-4.20-0309-non-reasoning`,`grok-4-1-fast-reasoning`,`grok-4-1-fast-non-reasoning`,`grok-4-fast-reasoning`,`grok-4-fast-non-reasoning`,`grok-4-0709`,`grok-code-fast-1`,`grok-3`,`grok-3-mini`]},{label:`MiniMax`,value:`minimax`,base_url:`https://api.minimax.io/anthropic`,models:[`MiniMax-M2.7`,`MiniMax-M2.5`,`MiniMax-M2.1`,`MiniMax-M2`]},{label:`MiniMax (China)`,value:`minimax-cn`,base_url:`https://api.minimaxi.com/v1`,models:[`MiniMax-M2.7`,`MiniMax-M2.5`,`MiniMax-M2.1`,`MiniMax-M2`]},{label:`Alibaba Cloud`,value:`alibaba`,base_url:`https://dashscope-intl.aliyuncs.com/compatible-mode/v1`,models:[`qwen3.5-plus`,`qwen3-coder-plus`,`qwen3-coder-next`,`glm-5`,`glm-4.7`,`kimi-k2.5`,`MiniMax-M2.5`]},{label:`Hugging Face`,value:`huggingface`,base_url:`https://router.huggingface.co/v1`,models:[`Qwen/Qwen3.5-397B-A17B`,`Qwen/Qwen3.5-35B-A3B`,`deepseek-ai/DeepSeek-V3.2`,`moonshotai/Kimi-K2.5`,`MiniMaxAI/MiniMax-M2.5`,`zai-org/GLM-5`,`XiaomiMiMo/MiMo-V2-Flash`,`moonshotai/Kimi-K2-Thinking`]},{label:`Xiaomi MiMo`,value:`xiaomi`,base_url:`https://api.xiaomimimo.com/v1`,models:[`mimo-v2-pro`,`mimo-v2-omni`,`mimo-v2-flash`]},{label:`Kilo Code`,value:`kilocode`,base_url:`https://api.kilo.ai/api/gateway`,models:[`anthropic/claude-opus-4.6`,`anthropic/claude-sonnet-4.6`,`openai/gpt-5.4`,`google/gemini-3-pro-preview`,`google/gemini-3-flash-preview`]},{label:`AI Gateway`,value:`ai-gateway`,base_url:`https://ai-gateway.vercel.sh/v1`,models:[`anthropic/claude-opus-4.6`,`anthropic/claude-sonnet-4.6`,`anthropic/claude-sonnet-4.5`,`anthropic/claude-haiku-4.5`,`openai/gpt-5`,`openai/gpt-4.1`,`openai/gpt-4.1-mini`,`google/gemini-3-pro-preview`,`google/gemini-3-flash`,`google/gemini-2.5-pro`,`google/gemini-2.5-flash`,`deepseek/deepseek-v3.2`]},{label:`OpenCode Zen`,value:`opencode-zen`,base_url:`https://opencode.ai/zen/v1`,models:[`gpt-5.4-pro`,`gpt-5.4`,`gpt-5.3-codex`,`gpt-5.2`,`gpt-5.1`,`claude-opus-4-6`,`claude-sonnet-4-6`,`claude-haiku-4-5`,`gemini-3.1-pro`,`gemini-3-pro`,`gemini-3-flash`,`minimax-m2.7`,`minimax-m2.5`,`glm-5`,`glm-4.7`,`kimi-k2.5`]},{label:`OpenCode Go`,value:`opencode-go`,base_url:`https://opencode.ai/zen/go/v1`,models:[`glm-5`,`kimi-k2.5`,`mimo-v2-pro`,`mimo-v2-omni`,`minimax-m2.7`,`minimax-m2.5`]},{label:`OpenRouter`,value:`openrouter`,base_url:`https://openrouter.ai/api/v1`,models:[]}],te={style:{display:`flex`,gap:`12px`}},ne={style:{display:`flex`,gap:`8px`,width:`100%`}},re={class:`modal-footer`},ie=x(f({__name:`ProviderFormModal`,emits:[`close`,`saved`],setup(t,{emit:n}){let{t:i}=b(),c=n,f=L(),m=k(),g=u(!0),v=u(!1),y=u(!1),x=u(`preset`),S=u(null),C=u({name:``,base_url:``,api_key:``,model:``}),A=u([]),j=$;function M(e){let t=e.replace(/^https?:\/\//,``).replace(/\/v1\/?$/,``).split(`/`)[0];return t.includes(`localhost`)||t.includes(`127.0.0.1`)?i(`models.local`,{host:t}):t.charAt(0).toUpperCase()+t.slice(1)}l(S,e=>{if(C.value.model=``,e){let t=j.find(t=>t.value===e);t&&(C.value.name=t.label,C.value.base_url=t.base_url,A.value=t.models.map(e=>({label:e,value:e})),t.models.length>0&&(C.value.model=t.models[0]))}}),l(()=>C.value.base_url,e=>{x.value===`custom`&&e.trim()&&(C.value.name=M(e.trim()))}),l(x,()=>{A.value=[],C.value={name:``,base_url:``,api_key:``,model:``},S.value=null});async function N(){let{base_url:e}=C.value;if(!e.trim()){m.warning(i(`models.enterBaseUrl`));return}y.value=!0;try{let t=e.replace(/\/+$/,``)+`/models`,n={};C.value.api_key.trim()&&(n.Authorization=`Bearer ${C.value.api_key.trim()}`);let r=await fetch(t,{headers:n,signal:AbortSignal.timeout(8e3)});if(!r.ok)throw Error(`HTTP ${r.status}`);let a=await r.json();if(!Array.isArray(a.data))throw Error(i(`models.unexpectedFormat`));A.value=a.data.map(e=>({label:e.id,value:e.id})),A.value.length>0&&!C.value.model&&(C.value.model=A.value[0].value),m.success(i(`models.foundModels`,{count:A.value.length}))}catch(e){m.error(i(`models.fetchFailed`)+`: `+e.message)}finally{y.value=!1}}async function P(){if(x.value===`preset`&&!S.value){m.warning(i(`models.selectProviderRequired`));return}if(!C.value.base_url.trim()){m.warning(i(`models.baseUrlRequired`));return}if(!C.value.api_key.trim()){m.warning(i(`models.apiKeyRequired`));return}if(!C.value.model){m.warning(i(`models.modelRequired`));return}v.value=!0;try{let e=x.value===`preset`&&j.find(e=>e.value===S.value)?.value||null;await f.addProvider({name:C.value.name.trim(),base_url:C.value.base_url.trim(),api_key:C.value.api_key.trim(),model:C.value.model,providerKey:e}),m.success(i(`models.providerAdded`)),c(`saved`)}catch(e){m.error(e.message)}finally{v.value=!1}}function F(){g.value=!1,setTimeout(()=>c(`close`),200)}return(t,n)=>(a(),s(h(w),{show:g.value,"onUpdate:show":n[7]||=e=>g.value=e,preset:`card`,title:h(i)(`models.addProvider`),style:{width:`min(520px, calc(100vw - 32px))`},"mask-closable":!v.value,onAfterLeave:n[8]||=e=>c(`close`)},{footer:o(()=>[_(`div`,re,[e(h(D),{onClick:F},{default:o(()=>[p(d(h(i)(`common.cancel`)),1)]),_:1}),e(h(D),{type:`primary`,loading:v.value,onClick:P},{default:o(()=>[p(d(h(i)(`common.add`)),1)]),_:1},8,[`loading`])])]),default:o(()=>[e(h(ee),{"label-placement":`top`},{default:o(()=>[e(h(T),{label:h(i)(`models.providerType`)},{default:o(()=>[_(`div`,te,[e(h(D),{type:x.value===`preset`?`primary`:`default`,size:`small`,onClick:n[0]||=e=>x.value=`preset`},{default:o(()=>[p(d(h(i)(`models.preset`)),1)]),_:1},8,[`type`]),e(h(D),{type:x.value===`custom`?`primary`:`default`,size:`small`,onClick:n[1]||=e=>x.value=`custom`},{default:o(()=>[p(d(h(i)(`models.custom`)),1)]),_:1},8,[`type`])])]),_:1},8,[`label`]),x.value===`preset`?(a(),s(h(T),{key:0,label:h(i)(`models.selectProvider`),required:``},{default:o(()=>[e(h(E),{value:S.value,"onUpdate:value":n[2]||=e=>S.value=e,options:h(j),placeholder:h(i)(`models.chooseProvider`),filterable:``},null,8,[`value`,`options`,`placeholder`])]),_:1},8,[`label`])):r(``,!0),x.value===`custom`?(a(),s(h(T),{key:1,label:h(i)(`models.name`)},{default:o(()=>[e(h(O),{value:C.value.name,"onUpdate:value":n[3]||=e=>C.value.name=e,placeholder:h(i)(`models.autoGeneratedName`),disabled:``},null,8,[`value`,`placeholder`])]),_:1},8,[`label`])):r(``,!0),e(h(T),{label:h(i)(`models.baseUrl`),required:``},{default:o(()=>[e(h(O),{value:C.value.base_url,"onUpdate:value":n[4]||=e=>C.value.base_url=e,placeholder:h(i)(`models.baseUrlPlaceholder`),disabled:x.value===`preset`},null,8,[`value`,`placeholder`,`disabled`])]),_:1},8,[`label`]),e(h(T),{label:h(i)(`models.apiKey`),required:``},{default:o(()=>[e(h(O),{value:C.value.api_key,"onUpdate:value":n[5]||=e=>C.value.api_key=e,type:`password`,"show-password-on":`click`,placeholder:h(i)(`models.apiKeyPlaceholder`)},null,8,[`value`,`placeholder`])]),_:1},8,[`label`]),e(h(T),{label:h(i)(`models.defaultModel`),required:``},{default:o(()=>[_(`div`,ne,[e(h(E),{value:C.value.model,"onUpdate:value":n[6]||=e=>C.value.model=e,options:A.value,filterable:``,placeholder:h(i)(`models.selectModel`),style:{flex:`1`}},null,8,[`value`,`options`,`placeholder`]),x.value===`custom`||x.value===`preset`&&A.value.length===0?(a(),s(h(D),{key:0,loading:y.value,onClick:N},{default:o(()=>[p(d(h(i)(`common.fetch`)),1)]),_:1},8,[`loading`])):r(``,!0)])]),_:1},8,[`label`])]),_:1})]),_:1},8,[`show`,`title`,`mask-closable`]))}}),[[`__scopeId`,`data-v-c6cd4f75`]]),ae={class:`models-view`},oe={class:`page-header`},se={class:`header-title`},ce={class:`models-content`},le=x(f({__name:`ModelsView`,setup(t){let{t:i}=b(),l=L(),f=u(!1);c(()=>{l.fetchProviders()});function m(){f.value=!0}function g(){f.value=!1}async function v(){await l.fetchProviders(),g()}return(t,c)=>(a(),n(`div`,ae,[_(`header`,oe,[_(`h2`,se,d(h(i)(`models.title`)),1),e(h(D),{type:`primary`,size:`small`,onClick:m},{icon:o(()=>[...c[0]||=[_(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},[_(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),_(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})],-1)]]),default:o(()=>[p(` `+d(h(i)(`models.addProvider`)),1)]),_:1})]),_(`div`,ce,[e(h(A),{show:h(l).loading&&h(l).providers.length===0},{default:o(()=>[e(Q)]),_:1},8,[`show`])]),f.value?(a(),s(ie,{key:0,onClose:g,onSaved:v})):r(``,!0)]))}}),[[`__scopeId`,`data-v-f120758c`]]);export{le as default};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{C as e,F as t,K as n,N as r,ct as i,dt as a,j as o}from"./router-COwpqexM.js";import{B as s,K as c,Q as l,W as u,at as d,c as f,ct as p,n as m,ot as h,q as g,s as _,z as v}from"./browser-DzAOCZtm.js";import{i as y,n as b,o as x,t as S}from"./Popover-2C1zuptC.js";import{o as C,s as w}from"./Scrollbar-Bg2FeTtI.js";import{r as T,t as E}from"./Button-zECKCotA.js";import{n as D,t as O}from"./Warning-t1i_4T5i.js";import{t as k}from"./omit-C4dR5R2G.js";var A={iconSize:`22px`};function j(e){let{fontSize:t,warningColor:n}=e;return Object.assign(Object.assign({},A),{fontSize:t,iconColor:n})}var M=_({name:`Popconfirm`,common:m,peers:{Button:T,Popover:y},self:j}),N=l(`n-popconfirm`),P={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},F=D(P),I=o({name:`NPopconfirmPanel`,props:P,setup(n){let{localeRef:r}=w(`Popconfirm`),{inlineThemeDisabled:i}=s(),{mergedClsPrefixRef:o,mergedThemeRef:c,props:l}=t(N),u=e(()=>{let{common:{cubicBezierEaseInOut:e},self:{fontSize:t,iconSize:n,iconColor:r}}=c.value;return{"--n-bezier":e,"--n-font-size":t,"--n-icon-size":n,"--n-icon-color":r}}),d=i?v(`popconfirm-panel`,void 0,u,l):void 0;return Object.assign(Object.assign({},w(`Popconfirm`)),{mergedClsPrefix:o,cssVars:i?void 0:u,localizedPositiveText:e(()=>n.positiveText||r.value.positiveText),localizedNegativeText:e(()=>n.negativeText||r.value.negativeText),positiveButtonProps:a(l,`positiveButtonProps`),negativeButtonProps:a(l,`negativeButtonProps`),handlePositiveClick(e){n.onPositiveClick(e)},handleNegativeClick(e){n.onNegativeClick(e)},themeClass:d?.themeClass,onRender:d?.onRender})},render(){var e;let{mergedClsPrefix:t,showIcon:n,$slots:i}=this,a=u(i.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&r(E,Object.assign({size:`small`,onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&r(E,Object.assign({size:`small`,type:`primary`,onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(e=this.onRender)==null||e.call(this),r(`div`,{class:[`${t}-popconfirm__panel`,this.themeClass],style:this.cssVars},c(i.default,e=>n||e?r(`div`,{class:`${t}-popconfirm__body`},n?r(`div`,{class:`${t}-popconfirm__icon`},u(i.icon,()=>[r(C,{clsPrefix:t},{default:()=>r(O,null)})])):null,e):null),a?r(`div`,{class:[`${t}-popconfirm__action`]},a):null)}}),L=h(`popconfirm`,[p(`body`,`
|
|
2
|
-
font-size: var(--n-font-size);
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
flex-wrap: nowrap;
|
|
6
|
-
position: relative;
|
|
7
|
-
`,[p(`icon`,`
|
|
8
|
-
display: flex;
|
|
9
|
-
font-size: var(--n-icon-size);
|
|
10
|
-
color: var(--n-icon-color);
|
|
11
|
-
transition: color .3s var(--n-bezier);
|
|
12
|
-
margin: 0 8px 0 0;
|
|
13
|
-
`)]),p(`action`,`
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: flex-end;
|
|
16
|
-
`,[d(`&:not(:first-child)`,`margin-top: 8px`),h(`button`,[d(`&:not(:last-child)`,`margin-right: 8px;`)])])]),R=o({name:`Popconfirm`,props:Object.assign(Object.assign(Object.assign({},f.props),b),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:`click`},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),slots:Object,__popover__:!0,setup(e){let{mergedClsPrefixRef:t}=s(),r=f(`Popconfirm`,`-popconfirm`,L,M,e,t),a=i(null);function o(t){if(!a.value?.getMergedShow())return;let{onPositiveClick:n,"onUpdate:show":r}=e;Promise.resolve(n?n(t):!0).then(e=>{var t;e!==!1&&((t=a.value)==null||t.setShow(!1),r&&g(r,!1))})}function c(t){if(!a.value?.getMergedShow())return;let{onNegativeClick:n,"onUpdate:show":r}=e;Promise.resolve(n?n(t):!0).then(e=>{var t;e!==!1&&((t=a.value)==null||t.setShow(!1),r&&g(r,!1))})}return n(N,{mergedThemeRef:r,mergedClsPrefixRef:t,props:e}),{setShow(e){var t;(t=a.value)==null||t.setShow(e)},syncPosition(){var e;(e=a.value)==null||e.syncPosition()},mergedTheme:r,popoverInstRef:a,handlePositiveClick:o,handleNegativeClick:c}},render(){let{$slots:e,$props:t,mergedTheme:n}=this;return r(S,Object.assign({},k(t,F),{theme:n.peers.Popover,themeOverrides:n.peerOverrides.Popover,internalExtraClass:[`popconfirm`],ref:`popoverInstRef`}),{trigger:e.trigger,default:()=>{let n=x(t,F);return r(I,Object.assign({},n,{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),e)}})}});export{R as t};
|