codexmate 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -76
- package/README.zh.md +18 -1
- package/cli/session-convert-args.js +5 -1
- package/cli/session-convert.js +111 -4
- package/cli.js +329 -32
- package/package.json +1 -1
- package/web-ui/app.js +1 -0
- package/web-ui/modules/app.methods.codex-config.mjs +0 -76
- package/web-ui/modules/app.methods.session-actions.mjs +16 -18
- package/web-ui/modules/i18n.dict.mjs +30 -2
- package/web-ui/partials/index/panel-config-codex.html +31 -11
- package/web-ui/partials/index/panel-config-codex.html.bak +337 -0
- package/web-ui/partials/index/panel-sessions.html +4 -10
- package/web-ui/session-helpers.mjs +0 -3
- package/web-ui/styles/bridge-pool.css +197 -0
- package/web-ui/styles/responsive.css +3 -3
- package/web-ui/styles/sessions-list.css +2 -2
- package/web-ui/styles/sessions-toolbar-trash.css +14 -0
- package/web-ui/styles.css +1 -0
|
@@ -10,22 +10,8 @@ export function createSessionActionMethods(options = {}) {
|
|
|
10
10
|
} = options;
|
|
11
11
|
|
|
12
12
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!sessionId) return false;
|
|
16
|
-
return /-\d{8}-\d{6}-[0-9a-f]{6}$/i.test(sessionId);
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
isDerivedSession(session) {
|
|
20
|
-
if (!session || typeof session !== 'object') return false;
|
|
21
|
-
if (session.derived === true) return true;
|
|
22
|
-
if (this.isDerivedSessionId(session.sessionId)) return true;
|
|
23
|
-
const rawFilePath = typeof session.filePath === 'string' ? session.filePath.trim() : '';
|
|
24
|
-
if (!rawFilePath) return false;
|
|
25
|
-
const normalized = rawFilePath.replace(/\\/g, '/');
|
|
26
|
-
if (normalized.includes('/.codexmate/sessions/derived/')) return true;
|
|
27
|
-
if (normalized.includes('/codexmate-derived/')) return true;
|
|
28
|
-
return false;
|
|
13
|
+
getResumeCommandTitle(session) {
|
|
14
|
+
return (typeof this.t === 'function' ? this.t('sessions.copyResume') : 'Copy resume command');
|
|
29
15
|
},
|
|
30
16
|
|
|
31
17
|
getSessionStandaloneContext() {
|
|
@@ -122,13 +108,25 @@ export function createSessionActionMethods(options = {}) {
|
|
|
122
108
|
return `${origin}/session?${params.toString()}`;
|
|
123
109
|
},
|
|
124
110
|
|
|
125
|
-
|
|
111
|
+
async copySessionLink(session) {
|
|
126
112
|
const url = this.buildSessionStandaloneUrl(session);
|
|
127
113
|
if (!url) {
|
|
128
114
|
this.showMessage('无法生成链接', 'error');
|
|
129
115
|
return;
|
|
130
116
|
}
|
|
131
|
-
|
|
117
|
+
const ok = this.fallbackCopyText(url);
|
|
118
|
+
if (ok) {
|
|
119
|
+
this.showMessage('已复制链接', 'success');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
124
|
+
await navigator.clipboard.writeText(url);
|
|
125
|
+
this.showMessage('已复制链接', 'success');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
} catch (_) {}
|
|
129
|
+
this.showMessage('复制失败', 'error');
|
|
132
130
|
},
|
|
133
131
|
|
|
134
132
|
getSessionExportKey(session) {
|
|
@@ -547,7 +547,21 @@ const DICT = Object.freeze({
|
|
|
547
547
|
'sessions.preview.convert': '生成派生会话',
|
|
548
548
|
'sessions.preview.converting': '生成中...',
|
|
549
549
|
'sessions.preview.convert.loadedOnly': '仅转换已加载消息',
|
|
550
|
-
'sessions.preview.
|
|
550
|
+
'sessions.preview.importNative': '导入原生目录',
|
|
551
|
+
'sessions.preview.importingNative': '导入中...',
|
|
552
|
+
'sessions.preview.importNative.unsupported': '不支持此操作',
|
|
553
|
+
'sessions.preview.importNative.confirmTitle': '覆盖原生会话文件?',
|
|
554
|
+
'sessions.preview.importNative.confirmMessage': '原生会话文件已存在,覆盖后会替换目标工具原生目录中的同名会话。',
|
|
555
|
+
'sessions.preview.importNative.confirmText': '覆盖',
|
|
556
|
+
'sessions.preview.importNative.cancelled': '已取消导入',
|
|
557
|
+
'sessions.preview.importNative.conflict': '原生会话已存在',
|
|
558
|
+
'sessions.preview.importNative.invalidSource': '会话来源无效',
|
|
559
|
+
'sessions.preview.importNative.fileNotFound': '未找到会话文件',
|
|
560
|
+
'sessions.preview.importNative.nativePathUnavailable': '无法解析原生会话路径',
|
|
561
|
+
'sessions.preview.importNative.success': '已导入原生目录',
|
|
562
|
+
'sessions.preview.importNative.failed': '导入失败',
|
|
563
|
+
'sessions.preview.importNative.failedWithReason': '导入原生目录失败:{reason}',
|
|
564
|
+
'sessions.preview.copyLink': '复制链接',
|
|
551
565
|
'sessions.preview.loadingBody': '正在加载会话内容...',
|
|
552
566
|
'sessions.preview.emptyMsgs': '当前会话暂无可展示消息',
|
|
553
567
|
'sessions.preview.rendering': '正在渲染会话内容...',
|
|
@@ -2645,7 +2659,21 @@ const DICT = Object.freeze({
|
|
|
2645
2659
|
'sessions.preview.convert': 'Create derived',
|
|
2646
2660
|
'sessions.preview.converting': 'Creating...',
|
|
2647
2661
|
'sessions.preview.convert.loadedOnly': 'Converted loaded messages only',
|
|
2648
|
-
'sessions.preview.
|
|
2662
|
+
'sessions.preview.importNative': 'Import to Native',
|
|
2663
|
+
'sessions.preview.importingNative': 'Importing...',
|
|
2664
|
+
'sessions.preview.importNative.unsupported': 'This operation is not supported',
|
|
2665
|
+
'sessions.preview.importNative.confirmTitle': 'Overwrite native session file?',
|
|
2666
|
+
'sessions.preview.importNative.confirmMessage': 'A native session file already exists. Overwriting will replace the matching session in the target tool native directory.',
|
|
2667
|
+
'sessions.preview.importNative.confirmText': 'Overwrite',
|
|
2668
|
+
'sessions.preview.importNative.cancelled': 'Import cancelled',
|
|
2669
|
+
'sessions.preview.importNative.conflict': 'Native session already exists',
|
|
2670
|
+
'sessions.preview.importNative.invalidSource': 'Invalid session source',
|
|
2671
|
+
'sessions.preview.importNative.fileNotFound': 'Session file not found',
|
|
2672
|
+
'sessions.preview.importNative.nativePathUnavailable': 'Native session path unavailable',
|
|
2673
|
+
'sessions.preview.importNative.success': 'Imported to native directory',
|
|
2674
|
+
'sessions.preview.importNative.failed': 'Import failed',
|
|
2675
|
+
'sessions.preview.importNative.failedWithReason': 'Import to native failed: {reason}',
|
|
2676
|
+
'sessions.preview.copyLink': 'Copy link',
|
|
2649
2677
|
'sessions.preview.loadingBody': 'Loading session content...',
|
|
2650
2678
|
'sessions.preview.emptyMsgs': 'No messages to display',
|
|
2651
2679
|
'sessions.preview.rendering': 'Rendering session content...',
|
|
@@ -320,17 +320,37 @@
|
|
|
320
320
|
</div>
|
|
321
321
|
</div>
|
|
322
322
|
|
|
323
|
-
<div v-if="displayCurrentProvider === 'local'" class="
|
|
324
|
-
<div
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
323
|
+
<div v-if="displayCurrentProvider === 'local'" class="bridge-pool-panel">
|
|
324
|
+
<div class="bridge-pool-header">
|
|
325
|
+
<span class="bridge-pool-icon">
|
|
326
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14">
|
|
327
|
+
<circle cx="6" cy="6" r="2"/>
|
|
328
|
+
<circle cx="18" cy="6" r="2"/>
|
|
329
|
+
<circle cx="12" cy="18" r="2"/>
|
|
330
|
+
<path d="M6 8v4h6v4"/>
|
|
331
|
+
<path d="M18 8v4h-6v4"/>
|
|
332
|
+
</svg>
|
|
333
|
+
</span>
|
|
334
|
+
<span class="bridge-pool-title">轮询池</span>
|
|
335
|
+
<span class="bridge-pool-hint">勾选参与负载均衡的提供商</span>
|
|
336
|
+
</div>
|
|
337
|
+
<div v-if="localBridgeCandidateProviders().length === 0" class="bridge-pool-empty">
|
|
338
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" width="16" height="16">
|
|
339
|
+
<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/>
|
|
340
|
+
</svg>
|
|
341
|
+
<span>暂无可用上游 provider,请先添加直连 provider</span>
|
|
342
|
+
</div>
|
|
343
|
+
<div v-else class="bridge-pool-list">
|
|
344
|
+
<label v-for="cp in localBridgeCandidateProviders()" :key="cp.name" class="bridge-pool-item">
|
|
345
|
+
<span class="bridge-pool-item-name">{{ cp.name }}</span>
|
|
346
|
+
<span class="bridge-pool-item-status" :class="{ active: !isLocalBridgeExcluded(cp.name) }">
|
|
347
|
+
{{ isLocalBridgeExcluded(cp.name) ? '未启用' : '已启用' }}
|
|
348
|
+
</span>
|
|
349
|
+
<input type="checkbox"
|
|
350
|
+
:checked="!isLocalBridgeExcluded(cp.name)"
|
|
351
|
+
@change="toggleLocalBridgeExcluded(cp.name)" />
|
|
352
|
+
</label>
|
|
353
|
+
</div>
|
|
334
354
|
</div>
|
|
335
355
|
|
|
336
356
|
</template>
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<!-- Provider 配置模式(Codex) -->
|
|
2
|
+
<div
|
|
3
|
+
v-show="mainTab === 'config' && isProviderConfigMode"
|
|
4
|
+
class="mode-content mode-cards"
|
|
5
|
+
id="panel-config-provider"
|
|
6
|
+
role="tabpanel"
|
|
7
|
+
:aria-labelledby="forceCompactLayout ? 'tab-config' : ('side-tab-config-' + configMode)">
|
|
8
|
+
<div v-if="forceCompactLayout && !sessionStandalone" class="segmented-control">
|
|
9
|
+
<button type="button" :class="['segment', { active: configMode === 'codex' }]" @click="switchConfigMode('codex')">{{ t('tab.config.codex') }}</button>
|
|
10
|
+
<button type="button" :class="['segment', { active: configMode === 'claude' }]" @click="switchConfigMode('claude')">{{ t('tab.config.claude') }}</button>
|
|
11
|
+
<button type="button" :class="['segment', { active: configMode === 'openclaw' }]" @click="switchConfigMode('openclaw')">{{ t('tab.config.openclaw') }}</button>
|
|
12
|
+
</div>
|
|
13
|
+
<template v-if="isCodexConfigMode && shouldShowCliInstallPlaceholder('codex')">
|
|
14
|
+
<div class="selector-section">
|
|
15
|
+
<div class="empty-state">
|
|
16
|
+
<div class="empty-state-title">{{ t('cli.missing.title', { name: 'Codex' }) }}</div>
|
|
17
|
+
<div class="empty-state-subtitle">{{ t('cli.missing.subtitle', { name: 'Codex' }) }}</div>
|
|
18
|
+
<div class="docs-command-row">
|
|
19
|
+
<div class="docs-command-box" role="group" :aria-label="t('cli.missing.commandAria', { name: 'Codex' })">
|
|
20
|
+
<code class="install-command">{{ getInstallCommand('codex', 'install') }}</code>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="btn-mini docs-copy-btn"
|
|
24
|
+
:disabled="!getInstallCommand('codex', 'install')"
|
|
25
|
+
@click="copyInstallCommand(getInstallCommand('codex', 'install'))">{{ t('common.copy') }}</button>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<button type="button" class="btn-tool btn-tool-compact" @click="mainTab = 'docs'; setInstallCommandAction('install')">{{ t('cli.missing.openDocs') }}</button>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<template v-else>
|
|
33
|
+
<!-- 添加提供商按钮 -->
|
|
34
|
+
<button class="btn-add" @click="showAddModal = true" v-if="!loading && !initError">
|
|
35
|
+
<svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2">
|
|
36
|
+
<path d="M10 4v12M4 10h12"/>
|
|
37
|
+
</svg>
|
|
38
|
+
{{ t('config.addProvider') }}
|
|
39
|
+
</button>
|
|
40
|
+
|
|
41
|
+
<!-- 服务预设 -->
|
|
42
|
+
<div class="selector-section" v-if="isCodexConfigMode && codexProviderTemplates.length">
|
|
43
|
+
<div class="selector-header">
|
|
44
|
+
<span class="selector-title">{{ t('config.providerTemplate.title') }}</span>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="btn-group" style="flex-wrap: wrap; gap: 8px; margin-top: 0;">
|
|
47
|
+
<button
|
|
48
|
+
v-for="tpl in codexProviderTemplates"
|
|
49
|
+
:key="tpl.name"
|
|
50
|
+
type="button"
|
|
51
|
+
class="btn-mini"
|
|
52
|
+
@click="newProvider.name = tpl.name;
|
|
53
|
+
newProvider.url = tpl.url;
|
|
54
|
+
newProvider._suggestedModel = tpl.model || '';
|
|
55
|
+
newProvider.useTransform = !!tpl.useTransform;
|
|
56
|
+
showAddModal = true">
|
|
57
|
+
{{ tpl.label }}
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<!-- 模型选择器 -->
|
|
63
|
+
<div class="selector-section">
|
|
64
|
+
<div class="selector-header">
|
|
65
|
+
<span class="selector-title">{{ t('config.models') }}</span>
|
|
66
|
+
<div class="selector-actions">
|
|
67
|
+
<button class="btn-icon" @click="showModelModal = true" :aria-label="t('modal.modelAdd.title')" :title="t('modal.modelAdd.title')" v-if="modelsSource === 'legacy'">+</button>
|
|
68
|
+
<button class="btn-icon" @click="showModelListModal = true" :aria-label="t('modal.modelManage.title')" :title="t('modal.modelManage.title')" v-if="modelsSource === 'legacy'">≡</button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
<select
|
|
72
|
+
v-if="codexModelsLoading || modelsSource === 'remote'"
|
|
73
|
+
class="model-select"
|
|
74
|
+
v-model="currentModel"
|
|
75
|
+
@change="onModelChange"
|
|
76
|
+
:disabled="codexModelsLoading"
|
|
77
|
+
>
|
|
78
|
+
<option v-if="codexModelsLoading" value="">{{ t('config.modelLoading') }}</option>
|
|
79
|
+
<option v-else v-for="model in codexModelOptions" :key="model" :value="model">{{ model }}</option>
|
|
80
|
+
</select>
|
|
81
|
+
<input
|
|
82
|
+
v-if="!codexModelsLoading && (modelsSource !== 'remote' || !modelsHasCurrent)"
|
|
83
|
+
class="model-input"
|
|
84
|
+
v-model="currentModel"
|
|
85
|
+
@blur="onModelChange"
|
|
86
|
+
@keyup.enter="onModelChange"
|
|
87
|
+
:placeholder="activeProviderModelPlaceholder"
|
|
88
|
+
:list="codexModelHasList ? 'codex-model-options' : null"
|
|
89
|
+
>
|
|
90
|
+
<datalist v-if="codexModelHasList" id="codex-model-options">
|
|
91
|
+
<option v-for="model in codexModelOptions" :key="model" :value="model"></option>
|
|
92
|
+
</datalist>
|
|
93
|
+
<div class="config-template-hint" v-if="modelsSource === 'unlimited'">
|
|
94
|
+
{{ t('config.models.unlimited') }}
|
|
95
|
+
</div>
|
|
96
|
+
<div class="config-template-hint" v-if="modelsSource === 'error'">
|
|
97
|
+
{{ t('config.models.error') }}
|
|
98
|
+
</div>
|
|
99
|
+
<div class="config-template-hint" v-if="modelsSource === 'remote' && !modelsHasCurrent">
|
|
100
|
+
{{ isCodexConfigMode ? t('config.models.notInList.codex') : t('config.models.notInList.other') }}
|
|
101
|
+
</div>
|
|
102
|
+
<div class="config-template-hint" v-if="isCodexConfigMode">
|
|
103
|
+
{{ t('config.template.editFirst') }}
|
|
104
|
+
</div>
|
|
105
|
+
<div class="config-template-hint" v-else-if="activeProviderBridgeHint">
|
|
106
|
+
{{ t('config.template.bridgeCodexOnly', { hint: activeProviderBridgeHint }) }}
|
|
107
|
+
</div>
|
|
108
|
+
<button class="btn-tool btn-template-editor" v-if="isCodexConfigMode" @click="openConfigTemplateEditor" :disabled="loading || !!initError">
|
|
109
|
+
{{ t('config.template.openEditor') }}
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<template v-if="isCodexConfigMode">
|
|
114
|
+
<div class="selector-section">
|
|
115
|
+
<div class="selector-header">
|
|
116
|
+
<span class="selector-title">{{ t('config.serviceTier') }}</span>
|
|
117
|
+
</div>
|
|
118
|
+
<select class="model-select" v-model="serviceTier" @change="onServiceTierChange">
|
|
119
|
+
<option value="fast">{{ t('config.serviceTier.fast') }}</option>
|
|
120
|
+
<option value="standard">{{ t('config.serviceTier.standard') }}</option>
|
|
121
|
+
</select>
|
|
122
|
+
<div class="config-template-hint">
|
|
123
|
+
{{ t('config.serviceTier.hint', { field: 'service_tier' }) }}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div class="selector-section">
|
|
128
|
+
<div class="selector-header">
|
|
129
|
+
<span class="selector-title">{{ t('config.reasoningEffort') }}</span>
|
|
130
|
+
</div>
|
|
131
|
+
<select class="model-select" v-model="modelReasoningEffort" @change="onReasoningEffortChange">
|
|
132
|
+
<option value="high">high</option>
|
|
133
|
+
<option value="medium">{{ t('config.reasoningEffort.medium') }}</option>
|
|
134
|
+
<option value="low">low</option>
|
|
135
|
+
<option value="xhigh">xhigh</option>
|
|
136
|
+
</select>
|
|
137
|
+
<div class="config-template-hint">
|
|
138
|
+
{{ t('config.reasoningEffort.hint') }}
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div class="selector-section">
|
|
143
|
+
<div class="selector-header">
|
|
144
|
+
<span class="selector-title">{{ t('config.contextBudget') }}</span>
|
|
145
|
+
<div class="selector-actions">
|
|
146
|
+
<button
|
|
147
|
+
class="btn-tool btn-tool-compact"
|
|
148
|
+
@click="resetCodexContextBudgetDefaults"
|
|
149
|
+
:disabled="loading || !!initError || codexApplying">
|
|
150
|
+
{{ t('config.reset') }}
|
|
151
|
+
</button>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
<div class="codex-config-grid">
|
|
155
|
+
<div class="form-group codex-config-field">
|
|
156
|
+
<label class="form-label" for="codex-model-context-window">model_context_window</label>
|
|
157
|
+
<input
|
|
158
|
+
id="codex-model-context-window"
|
|
159
|
+
v-model="modelContextWindowInput"
|
|
160
|
+
class="form-input"
|
|
161
|
+
inputmode="numeric"
|
|
162
|
+
autocomplete="off"
|
|
163
|
+
:placeholder="t('config.example', { value: 190000 })"
|
|
164
|
+
@focus="editingCodexBudgetField = 'modelContextWindowInput'"
|
|
165
|
+
@input="sanitizePositiveIntegerDraft('modelContextWindowInput')"
|
|
166
|
+
@blur="onModelContextWindowBlur"
|
|
167
|
+
@keydown.enter.prevent="onModelContextWindowBlur">
|
|
168
|
+
<div class="form-hint">{{ t('config.contextWindow.hint') }}</div>
|
|
169
|
+
</div>
|
|
170
|
+
<div class="form-group codex-config-field">
|
|
171
|
+
<label class="form-label" for="codex-model-auto-compact-token-limit">model_auto_compact_token_limit</label>
|
|
172
|
+
<input
|
|
173
|
+
id="codex-model-auto-compact-token-limit"
|
|
174
|
+
v-model="modelAutoCompactTokenLimitInput"
|
|
175
|
+
class="form-input"
|
|
176
|
+
inputmode="numeric"
|
|
177
|
+
autocomplete="off"
|
|
178
|
+
:placeholder="t('config.example', { value: 185000 })"
|
|
179
|
+
@focus="editingCodexBudgetField = 'modelAutoCompactTokenLimitInput'"
|
|
180
|
+
@input="sanitizePositiveIntegerDraft('modelAutoCompactTokenLimitInput')"
|
|
181
|
+
@blur="onModelAutoCompactTokenLimitBlur"
|
|
182
|
+
@keydown.enter.prevent="onModelAutoCompactTokenLimitBlur">
|
|
183
|
+
<div class="form-hint">{{ t('config.autoCompact.hint') }}</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div class="selector-section">
|
|
189
|
+
<div class="selector-header">
|
|
190
|
+
<span class="selector-title">AGENTS.md</span>
|
|
191
|
+
</div>
|
|
192
|
+
<button class="btn-tool" @click="openAgentsEditor" :disabled="loading || !!initError || agentsLoading">
|
|
193
|
+
{{ agentsLoading ? t('config.modelLoading') : t('config.agents.open') }}
|
|
194
|
+
</button>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div class="selector-section">
|
|
198
|
+
<div class="selector-header">
|
|
199
|
+
<span class="selector-title">{{ t('config.health.title') }}</span>
|
|
200
|
+
</div>
|
|
201
|
+
<button class="btn-tool" @click="runHealthCheck" :disabled="healthCheckLoading || loading || !!initError">
|
|
202
|
+
{{ healthCheckLoading ? t('config.health.running') : t('config.health.run') }}
|
|
203
|
+
</button>
|
|
204
|
+
<div class="config-template-hint">{{ t('config.health.hint') }}</div>
|
|
205
|
+
<div v-if="healthCheckLoading && healthCheckBatchTotal" class="config-template-hint">
|
|
206
|
+
{{ t('config.health.progress', { done: healthCheckBatchDone, total: healthCheckBatchTotal, failed: healthCheckBatchFailed }) }}
|
|
207
|
+
</div>
|
|
208
|
+
<div v-if="healthCheckResult && !healthCheckLoading" class="config-template-hint">
|
|
209
|
+
{{ healthCheckResult.ok ? t('config.health.ok') : t('config.health.fail') }} · {{ t('config.health.issues', { count: (healthCheckResult.issues || []).length }) }}
|
|
210
|
+
</div>
|
|
211
|
+
<button v-if="healthCheckResult && !healthCheckLoading" type="button" class="btn-mini" @click="showHealthCheckModal = true">
|
|
212
|
+
{{ t('common.detail') }}
|
|
213
|
+
</button>
|
|
214
|
+
<div v-if="healthCheckResult && !healthCheckLoading && (healthCheckResult.issues || []).length">
|
|
215
|
+
<div v-for="(issue, index) in healthCheckResult.issues" :key="issue.code || ('issue-' + index)" class="config-template-hint">
|
|
216
|
+
{{ issue.message || issue.code || '' }}<span v-if="issue.suggestion"> · {{ issue.suggestion }}</span>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
</template>
|
|
222
|
+
|
|
223
|
+
<div v-if="!loading && !initError" class="card-list">
|
|
224
|
+
<div v-for="provider in displayProvidersList" :key="provider.name"
|
|
225
|
+
:class="['card', { active: displayCurrentProvider === provider.name }]"
|
|
226
|
+
@click="switchProvider(provider.name)"
|
|
227
|
+
@keydown.enter.self.prevent="switchProvider(provider.name)"
|
|
228
|
+
@keydown.space.self.prevent="switchProvider(provider.name)"
|
|
229
|
+
tabindex="0"
|
|
230
|
+
role="button"
|
|
231
|
+
:aria-current="displayCurrentProvider === provider.name ? 'true' : null">
|
|
232
|
+
<div class="card-leading">
|
|
233
|
+
<div class="card-icon">{{ provider.name.charAt(0).toUpperCase() }}<span v-if="isTransformProvider(provider)" class="card-icon-dot" title="通过内建转换适配"></span></div>
|
|
234
|
+
<div class="card-content">
|
|
235
|
+
<div class="card-title">
|
|
236
|
+
<span>{{ provider.name }}</span>
|
|
237
|
+
<span v-if="provider.readOnly" class="provider-readonly-badge">{{ t('config.badge.system') }}</span>
|
|
238
|
+
</div>
|
|
239
|
+
<div v-if="provider.name !== 'local'" class="card-subtitle card-subtitle-model">
|
|
240
|
+
{{ activeProviderModel(provider.name) || t('config.model.unset') }}
|
|
241
|
+
</div>
|
|
242
|
+
<div v-if="provider.name !== 'local'" class="card-subtitle card-subtitle-url">
|
|
243
|
+
{{ displayProviderUrl(provider) || t('config.url.unset') }}
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
<div class="card-trailing">
|
|
248
|
+
<span v-if="speedResults[provider.name]" :class="['latency', speedResults[provider.name].ok ? 'ok' : 'error']">
|
|
249
|
+
{{ formatLatency(speedResults[provider.name]) }}
|
|
250
|
+
</span>
|
|
251
|
+
<span :class="['pill', providerPillConfigured(provider) ? 'configured' : 'empty']">
|
|
252
|
+
{{ providerPillText(provider) }}
|
|
253
|
+
</span>
|
|
254
|
+
<div class="card-actions" @click.stop>
|
|
255
|
+
<button
|
|
256
|
+
class="card-action-btn"
|
|
257
|
+
:class="{ loading: speedLoading[provider.name] }"
|
|
258
|
+
:disabled="!!speedLoading[provider.name]"
|
|
259
|
+
@click="runSpeedTest(provider.name, { silent: true })"
|
|
260
|
+
:aria-label="t('config.availabilityTestAria', { name: provider.name })"
|
|
261
|
+
:title="t('config.availabilityTest')"
|
|
262
|
+
>
|
|
263
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
264
|
+
<path d="M13 2L3 14h7l-1 8 12-14h-7l1-6z"/>
|
|
265
|
+
</svg>
|
|
266
|
+
</button>
|
|
267
|
+
<button
|
|
268
|
+
v-if="!provider.readOnly"
|
|
269
|
+
class="card-action-btn"
|
|
270
|
+
:class="{ loading: providerShareLoading[provider.name], disabled: !shouldAllowProviderShare(provider) }"
|
|
271
|
+
:disabled="providerShareLoading[provider.name] || !shouldAllowProviderShare(provider)"
|
|
272
|
+
@click="copyProviderShareCommand(provider)"
|
|
273
|
+
:title="shouldAllowProviderShare(provider) ? t('config.shareCommand') : t('config.shareDisabled')"
|
|
274
|
+
:aria-label="t('config.shareCommand.aria')">
|
|
275
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
276
|
+
<path d="M4 12v7a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-7"/>
|
|
277
|
+
<path d="M16 6l-4-4-4 4"/>
|
|
278
|
+
<path d="M12 2v14"/>
|
|
279
|
+
</svg>
|
|
280
|
+
</button>
|
|
281
|
+
<button
|
|
282
|
+
v-if="!provider.readOnly"
|
|
283
|
+
class="card-action-btn"
|
|
284
|
+
:class="{ disabled: !shouldShowProviderEdit(provider) }"
|
|
285
|
+
:disabled="!shouldShowProviderEdit(provider)"
|
|
286
|
+
@click="openEditModal(provider)"
|
|
287
|
+
:aria-label="t('config.provider.edit.aria', { name: provider.name })"
|
|
288
|
+
:title="shouldShowProviderEdit(provider) ? t('common.edit') : t('common.notEditable')">
|
|
289
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
290
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
|
291
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
292
|
+
</svg>
|
|
293
|
+
</button>
|
|
294
|
+
<button
|
|
295
|
+
v-if="!provider.readOnly"
|
|
296
|
+
class="card-action-btn"
|
|
297
|
+
@click="openCloneProviderModal(provider)"
|
|
298
|
+
:aria-label="t('config.provider.clone.aria', { name: provider.name })"
|
|
299
|
+
:title="t('config.provider.clone')">
|
|
300
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
301
|
+
<rect x="9" y="9" width="13" height="13" rx="2"/>
|
|
302
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
|
303
|
+
</svg>
|
|
304
|
+
</button>
|
|
305
|
+
<button
|
|
306
|
+
v-if="!provider.readOnly"
|
|
307
|
+
class="card-action-btn delete"
|
|
308
|
+
:class="{ disabled: !shouldShowProviderDelete(provider) }"
|
|
309
|
+
:disabled="!shouldShowProviderDelete(provider)"
|
|
310
|
+
@click="deleteProvider(provider.name)"
|
|
311
|
+
:aria-label="t('config.provider.delete.aria', { name: provider.name })"
|
|
312
|
+
:title="shouldShowProviderDelete(provider) ? t('common.delete') : t('common.notDeletable')">
|
|
313
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
314
|
+
<path d="M3 6h18"/>
|
|
315
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
|
|
316
|
+
</svg>
|
|
317
|
+
</button>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<div v-if="displayCurrentProvider === 'local'" class="local-bridge-panel" style="margin-top:12px;padding:12px;background:var(--card-bg);border-radius:8px;border:1px solid var(--border-color)">
|
|
324
|
+
<div style="font-size:13px;font-weight:600;margin-bottom:8px;color:var(--text-secondary)">轮询池 — 勾选参与负载均衡的提供商</div>
|
|
325
|
+
<div v-if="localBridgeCandidateProviders().length === 0" style="font-size:12px;color:var(--text-muted)">暂无可用上游 provider,请先添加直连 provider</div>
|
|
326
|
+
<label v-for="cp in localBridgeCandidateProviders()" :key="cp.name"
|
|
327
|
+
style="display:flex;align-items:center;gap:8px;padding:6px 0;cursor:pointer;font-size:13px">
|
|
328
|
+
<input type="checkbox"
|
|
329
|
+
:checked="!isLocalBridgeExcluded(cp.name)"
|
|
330
|
+
@change="toggleLocalBridgeExcluded(cp.name)"
|
|
331
|
+
style="accent-color:var(--accent-color)" />
|
|
332
|
+
<span>{{ cp.name }}</span>
|
|
333
|
+
</label>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
</template>
|
|
337
|
+
</div>
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
class="session-item-copy"
|
|
169
169
|
@click.stop="copyResumeCommand(session)"
|
|
170
170
|
:disabled="sessionsLoading"
|
|
171
|
-
:aria-label="
|
|
172
|
-
:title="
|
|
171
|
+
:aria-label="getResumeCommandTitle(session)"
|
|
172
|
+
:title="getResumeCommandTitle(session)">
|
|
173
173
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
174
174
|
<rect x="8" y="8" width="12" height="12" rx="2"></rect>
|
|
175
175
|
<path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"></path>
|
|
@@ -218,17 +218,11 @@
|
|
|
218
218
|
:disabled="!activeSession || sessionExporting[getSessionExportKey(activeSession)]">
|
|
219
219
|
{{ (activeSession && sessionExporting[getSessionExportKey(activeSession)]) ? t('sessions.preview.exporting') : t('sessions.preview.export') }}
|
|
220
220
|
</button>
|
|
221
|
-
<button
|
|
222
|
-
class="btn-session-export"
|
|
223
|
-
@click="convertSession(activeSession)"
|
|
224
|
-
:disabled="true">
|
|
225
|
-
{{ (activeSession && sessionConverting[getSessionExportKey(activeSession)]) ? t('sessions.preview.converting') : t('sessions.preview.convert') }}
|
|
226
|
-
</button>
|
|
227
221
|
<button
|
|
228
222
|
class="btn-session-open"
|
|
229
|
-
@click="
|
|
223
|
+
@click="copySessionLink(activeSession)"
|
|
230
224
|
:disabled="!activeSession">
|
|
231
|
-
{{ t('sessions.preview.
|
|
225
|
+
{{ t('sessions.preview.copyLink') }}
|
|
232
226
|
</button>
|
|
233
227
|
</div>
|
|
234
228
|
</div>
|
|
@@ -420,9 +420,6 @@ export async function loadActiveSessionDetail(api, options = {}) {
|
|
|
420
420
|
if (res.sourceLabel) {
|
|
421
421
|
this.activeSession.sourceLabel = res.sourceLabel;
|
|
422
422
|
}
|
|
423
|
-
if (typeof res.derived === 'boolean') {
|
|
424
|
-
this.activeSession.derived = res.derived;
|
|
425
|
-
}
|
|
426
423
|
if (res.sessionId) {
|
|
427
424
|
this.activeSession.sessionId = res.sessionId;
|
|
428
425
|
if (!this.activeSession.title) {
|