tavern-harness 0.1.32 → 0.2.0
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/CHANGELOG.md +77 -0
- package/package.json +4 -1
- package/src/App.tsx +1 -1
- package/src/components/CharactersView.tsx +1 -1
- package/src/components/ChatView.tsx +1 -1
- package/src/components/SettingsView.tsx +82 -21
- package/src/components/Sidebar.tsx +26 -27
- package/src/core/autoHideScrollbars.ts +191 -0
- package/src/core/browserPreferences.ts +6 -1
- package/src/core/i18n.ts +27 -3
- package/src/db/database.ts +17 -8
- package/src/generated/changelog.json +110 -1
- package/src/main.tsx +3 -0
- package/src/store/store.ts +13 -12
- package/src/theme/chat.css +70 -53
- package/src/theme/global.css +122 -57
- package/src/theme/theme.ts +96 -43
- package/src/theme/views.css +84 -24
- package/src/types/models.ts +2 -0
- package/vite.config.ts +46 -11
- package/voice-server.mjs +21 -0
package/src/core/i18n.ts
CHANGED
|
@@ -203,6 +203,9 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
|
|
|
203
203
|
// ---- 设置 ----
|
|
204
204
|
'settings.title': '设置',
|
|
205
205
|
'settings.sub': '模型 API 配置、超参数与主题',
|
|
206
|
+
'settings.tabApi': 'API 配置',
|
|
207
|
+
'settings.tabModel': '模型参数',
|
|
208
|
+
'settings.tabGeneral': '通用设置',
|
|
206
209
|
'settings.toolExecution': '🛠️ 工具执行',
|
|
207
210
|
'settings.pureMode': '纯净模式',
|
|
208
211
|
'settings.pureModeDesc': '仅影响前端展示:隐藏对话中的思考和工具调用;没有正文的消息会一并隐藏,不影响实际思考和工具调用。',
|
|
@@ -226,10 +229,15 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
|
|
|
226
229
|
'settings.off': '关闭',
|
|
227
230
|
'settings.theme': '🎨 主题',
|
|
228
231
|
'settings.appearance': '外观模式',
|
|
232
|
+
'settings.colorPalette': '配色方案',
|
|
233
|
+
'settings.palette.amber': '烛光琥珀',
|
|
234
|
+
'settings.palette.jade': '森野翡翠',
|
|
235
|
+
'settings.palette.rose': '暮色蔷薇',
|
|
236
|
+
'settings.palette.indigo': '星夜靛蓝',
|
|
229
237
|
'settings.system': '跟随系统',
|
|
230
238
|
'settings.light': '浅色',
|
|
231
239
|
'settings.dark': '深色',
|
|
232
|
-
'settings.themeTip': '
|
|
240
|
+
'settings.themeTip': '选择喜欢的配色方案与外观模式',
|
|
233
241
|
'settings.language': '🌐 界面语言/Language',
|
|
234
242
|
'settings.languageLabel': '界面语言/Language',
|
|
235
243
|
'settings.followBrowser': '跟随系统语言',
|
|
@@ -774,6 +782,9 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
|
|
|
774
782
|
|
|
775
783
|
'settings.title': '設定',
|
|
776
784
|
'settings.sub': '模型 API 設定、超參數與主題',
|
|
785
|
+
'settings.tabApi': 'API 設定',
|
|
786
|
+
'settings.tabModel': '模型參數',
|
|
787
|
+
'settings.tabGeneral': '通用設定',
|
|
777
788
|
'settings.toolExecution': '🛠️ 工具執行',
|
|
778
789
|
'settings.pureMode': '純淨模式',
|
|
779
790
|
'settings.pureModeDesc': '僅影響前端顯示:隱藏對話中的思考和工具呼叫;沒有正文的訊息會一併隱藏,不影響實際思考和工具呼叫。',
|
|
@@ -797,10 +808,15 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
|
|
|
797
808
|
'settings.off': '關閉',
|
|
798
809
|
'settings.theme': '🎨 主題',
|
|
799
810
|
'settings.appearance': '外觀模式',
|
|
811
|
+
'settings.colorPalette': '配色方案',
|
|
812
|
+
'settings.palette.amber': '燭光琥珀',
|
|
813
|
+
'settings.palette.jade': '森野翡翠',
|
|
814
|
+
'settings.palette.rose': '暮色薔薇',
|
|
815
|
+
'settings.palette.indigo': '星夜靛藍',
|
|
800
816
|
'settings.system': '跟隨系統',
|
|
801
817
|
'settings.light': '淺色',
|
|
802
818
|
'settings.dark': '深色',
|
|
803
|
-
'settings.themeTip': '
|
|
819
|
+
'settings.themeTip': '選擇喜歡的配色方案與外觀模式',
|
|
804
820
|
'settings.language': '🌐 介面語言/Language',
|
|
805
821
|
'settings.languageLabel': '介面語言/Language',
|
|
806
822
|
'settings.followBrowser': '跟隨系統語言',
|
|
@@ -1336,6 +1352,9 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
|
|
|
1336
1352
|
|
|
1337
1353
|
'settings.title': 'Settings',
|
|
1338
1354
|
'settings.sub': 'Model API config, hyperparameters and theme',
|
|
1355
|
+
'settings.tabApi': 'API Configuration',
|
|
1356
|
+
'settings.tabModel': 'Model parameters',
|
|
1357
|
+
'settings.tabGeneral': 'General',
|
|
1339
1358
|
'settings.toolExecution': '🛠️ Tool execution',
|
|
1340
1359
|
'settings.pureMode': 'Pure mode',
|
|
1341
1360
|
'settings.pureModeDesc': 'Front-end display only: hide reasoning and tool calls in chats; messages without body content are hidden too. Actual reasoning and tool calls still run.',
|
|
@@ -1359,10 +1378,15 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
|
|
|
1359
1378
|
'settings.off': 'Off',
|
|
1360
1379
|
'settings.theme': '🎨 Theme',
|
|
1361
1380
|
'settings.appearance': 'Appearance mode',
|
|
1381
|
+
'settings.colorPalette': 'Color palette',
|
|
1382
|
+
'settings.palette.amber': 'Candle Amber',
|
|
1383
|
+
'settings.palette.jade': 'Forest Jade',
|
|
1384
|
+
'settings.palette.rose': 'Twilight Rose',
|
|
1385
|
+
'settings.palette.indigo': 'Starlight Indigo',
|
|
1362
1386
|
'settings.system': 'Follow system',
|
|
1363
1387
|
'settings.light': 'Light',
|
|
1364
1388
|
'settings.dark': 'Dark',
|
|
1365
|
-
'settings.themeTip': '
|
|
1389
|
+
'settings.themeTip': 'Choose a color palette and appearance mode.',
|
|
1366
1390
|
'settings.language': '🌐 Interface Language',
|
|
1367
1391
|
'settings.languageLabel': 'Interface Language',
|
|
1368
1392
|
'settings.followBrowser': 'Follow system language',
|
package/src/db/database.ts
CHANGED
|
@@ -284,10 +284,16 @@ let hasWriteLock = false;
|
|
|
284
284
|
let lockHeartbeat: number | null = null;
|
|
285
285
|
|
|
286
286
|
const PERSISTENCE_REQUEST_TIMEOUT_MS = 8_000;
|
|
287
|
-
const
|
|
287
|
+
const PERSISTENCE_RETRY_DELAY_MS = 250;
|
|
288
|
+
const DEFAULT_PERSISTENCE_ATTEMPTS = 2;
|
|
289
|
+
const STARTUP_PERSISTENCE_ATTEMPTS = 4;
|
|
288
290
|
|
|
289
|
-
async function persistenceRequest<T>(
|
|
290
|
-
|
|
291
|
+
async function persistenceRequest<T>(
|
|
292
|
+
path: string,
|
|
293
|
+
body: Record<string, unknown> = {},
|
|
294
|
+
maxAttempts = DEFAULT_PERSISTENCE_ATTEMPTS,
|
|
295
|
+
): Promise<T> {
|
|
296
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
291
297
|
const controller = new AbortController();
|
|
292
298
|
const timeout = globalThis.setTimeout(() => controller.abort(), PERSISTENCE_REQUEST_TIMEOUT_MS);
|
|
293
299
|
let response: Response;
|
|
@@ -299,8 +305,8 @@ async function persistenceRequest<T>(path: string, body: Record<string, unknown>
|
|
|
299
305
|
signal: controller.signal,
|
|
300
306
|
});
|
|
301
307
|
} catch (error) {
|
|
302
|
-
if (attempt
|
|
303
|
-
await new Promise((resolve) => globalThis.setTimeout(resolve,
|
|
308
|
+
if (attempt + 1 < maxAttempts) {
|
|
309
|
+
await new Promise((resolve) => globalThis.setTimeout(resolve, PERSISTENCE_RETRY_DELAY_MS));
|
|
304
310
|
continue;
|
|
305
311
|
}
|
|
306
312
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
@@ -316,8 +322,10 @@ async function persistenceRequest<T>(path: string, body: Record<string, unknown>
|
|
|
316
322
|
} catch {
|
|
317
323
|
throw new Error(`Persistence service returned an invalid response (${response.status})`);
|
|
318
324
|
}
|
|
319
|
-
|
|
320
|
-
|
|
325
|
+
const serviceRecovering = response.status === 502
|
|
326
|
+
|| (response.status === 503 && payload.message === 'Persistence server not running');
|
|
327
|
+
if (serviceRecovering && attempt + 1 < maxAttempts) {
|
|
328
|
+
await new Promise((resolve) => globalThis.setTimeout(resolve, PERSISTENCE_RETRY_DELAY_MS));
|
|
321
329
|
continue;
|
|
322
330
|
}
|
|
323
331
|
if (!response.ok || payload.ok === false) {
|
|
@@ -366,7 +374,7 @@ type StartupSnapshot = {
|
|
|
366
374
|
export async function loadStartupSnapshot(): Promise<StartupSnapshot> {
|
|
367
375
|
let snapshot: StartupSnapshot;
|
|
368
376
|
try {
|
|
369
|
-
snapshot = await persistenceRequest<StartupSnapshot>('/startup/snapshot');
|
|
377
|
+
snapshot = await persistenceRequest<StartupSnapshot>('/startup/snapshot', {}, STARTUP_PERSISTENCE_ATTEMPTS);
|
|
370
378
|
} catch (error) {
|
|
371
379
|
// 热更新期间旧服务进程可能还未注册快照路由。临时降级到旧的逐表读取,
|
|
372
380
|
// 让页面可用;Vite 会在 persistence-server.mjs 变更后重启该进程。
|
|
@@ -680,6 +688,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
|
|
680
688
|
defaultModel: '',
|
|
681
689
|
defaultProviderId: null,
|
|
682
690
|
themeMode: 'system',
|
|
691
|
+
themePalette: 'amber',
|
|
683
692
|
language: null,
|
|
684
693
|
...DEFAULT_GENERATION_SETTINGS,
|
|
685
694
|
seed: -1,
|
|
@@ -1,7 +1,116 @@
|
|
|
1
1
|
{
|
|
2
|
-
"latest": "0.
|
|
2
|
+
"latest": "0.2.0",
|
|
3
3
|
"repo": "https://github.com/Rannichan/Tavern-Harness",
|
|
4
4
|
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"date": "2026-11-20",
|
|
8
|
+
"breaking": false,
|
|
9
|
+
"compare": "v0.1.33...v0.2.0",
|
|
10
|
+
"groups": {
|
|
11
|
+
"zh-CN": [
|
|
12
|
+
{
|
|
13
|
+
"kind": "added",
|
|
14
|
+
"items": [
|
|
15
|
+
"设置页拆分为「API 配置 / 模型参数 / 通用设置」三个标签页,服务商、超参数和主题不再挤在同一个长页面里",
|
|
16
|
+
"新增「烛光琥珀 / 森野翡翠 / 暮色蔷薇 / 星夜靛蓝」四套配色方案,可在设置中随时切换,浅色与深色模式分别适配",
|
|
17
|
+
"对话标题栏和输入框改为悬浮玻璃卡片:内容从卡片背后滚动,输入框固定在底部;群聊时两者都会避开右侧成员栏"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "changed",
|
|
22
|
+
"items": [
|
|
23
|
+
"侧边栏与主区域改为各自独立的悬浮卡片,去掉渐变光晕、虚线纹理和多余投影,层级更干净",
|
|
24
|
+
"工具调用与思考卡片改用无边框色块表达状态,减少卡片套卡片的感觉",
|
|
25
|
+
"原生滚动条替换为滚动时出现、静止后淡出的悬浮细条,不再占用内容宽度",
|
|
26
|
+
"Markdown 的标题、列表标记、代码块和表格跟随所选配色,并随浅色/深色模式自动调整",
|
|
27
|
+
"侧边栏宽度拖拽手柄更易识别,并支持触屏拖动"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"kind": "fixed",
|
|
32
|
+
"items": [
|
|
33
|
+
"修复电脑休眠唤醒后持久化服务尚未就绪时,启动快照只重试一次就放弃、页面可能读不到数据的问题;启动阶段现在最多重试四次",
|
|
34
|
+
"修复设置页服务商名称过长时溢出卡片、挤压「文本服务 / 语音服务」标签的问题,名称过长时改为自动滚动显示"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"en": [
|
|
39
|
+
{
|
|
40
|
+
"kind": "added",
|
|
41
|
+
"items": [
|
|
42
|
+
"Settings is split into API Configuration, Model Parameters, and General tabs, so providers, hyperparameters, and theme no longer share one long page",
|
|
43
|
+
"Four color palettes — Candle Amber, Forest Jade, Twilight Rose, and Starlight Indigo — switchable at any time, each tuned for light and dark modes",
|
|
44
|
+
"The conversation header and composer are now floating glass cards: content scrolls behind them, the composer stays pinned to the bottom, and both make room for the member panel in group chats"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"kind": "changed",
|
|
49
|
+
"items": [
|
|
50
|
+
"The sidebar and main area are now separate floating cards; gradient glows, dashed textures, and excess shadows are gone for a cleaner hierarchy",
|
|
51
|
+
"Tool call and reasoning cards use borderless color blocks to show state instead of nested outlines",
|
|
52
|
+
"Native scrollbars are replaced by floating thin thumbs that appear while scrolling and fade when idle, without taking content width",
|
|
53
|
+
"Markdown headings, list markers, code blocks, and tables follow the selected palette and adapt to light and dark modes",
|
|
54
|
+
"The sidebar resize handle is easier to spot and now supports touch dragging"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"kind": "fixed",
|
|
59
|
+
"items": [
|
|
60
|
+
"Fixed the startup snapshot giving up after one retry when the persistence service was still starting after sleep; startup now retries up to four times",
|
|
61
|
+
"Fixed long provider names overflowing their cards and squeezing the text/voice service label; overflowing names now scroll automatically"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"kind": "internal",
|
|
66
|
+
"items": [
|
|
67
|
+
"Added a global auto-hiding scrollbar module shared by all scroll containers",
|
|
68
|
+
"Added test coverage for persistence startup retries"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"version": "0.1.33",
|
|
76
|
+
"date": "2026-11-18",
|
|
77
|
+
"breaking": false,
|
|
78
|
+
"compare": "v0.1.32...v0.1.33",
|
|
79
|
+
"groups": {
|
|
80
|
+
"zh-CN": [
|
|
81
|
+
{
|
|
82
|
+
"kind": "fixed",
|
|
83
|
+
"items": [
|
|
84
|
+
"修复 0.1.32 的 npm 包遗漏 `voice-server.mjs`、导致本地持久化服务无法启动、对话数据无法加载与保存的问题",
|
|
85
|
+
"持久化与沙箱子进程反复拉起时不再重复注册进程退出监听,消除启动时的 `MaxListenersExceededWarning`",
|
|
86
|
+
"子进程的错误输出会显示在终端,本地服务启动失败时不再静默"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"kind": "internal",
|
|
91
|
+
"items": [
|
|
92
|
+
"新增发布内容校验:`npm pack` / `npm publish` 前会检查 `files` 白名单是否覆盖所有运行时相对导入"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"en": [
|
|
97
|
+
{
|
|
98
|
+
"kind": "fixed",
|
|
99
|
+
"items": [
|
|
100
|
+
"Fixed the 0.1.32 npm package missing `voice-server.mjs`, which prevented the local persistence service from starting and blocked loading or saving conversations",
|
|
101
|
+
"Stopped re-registering process exit listeners whenever the persistence or sandbox child process is relaunched, removing the startup `MaxListenersExceededWarning`",
|
|
102
|
+
"Child-process errors now appear in the terminal instead of failing silently"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"kind": "internal",
|
|
107
|
+
"items": [
|
|
108
|
+
"Added a publish-content check that verifies the `files` allowlist covers every runtime relative import before `npm pack` / `npm publish`"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
5
114
|
{
|
|
6
115
|
"version": "0.1.32",
|
|
7
116
|
"date": "2026-11-18",
|
package/src/main.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
3
3
|
import App from './App';
|
|
4
4
|
import { applyThemeFromCache } from './theme/theme';
|
|
5
5
|
import { enableHorizontalWheel } from './core/horizontalWheel';
|
|
6
|
+
import { installAutoHideScrollbars } from './core/autoHideScrollbars';
|
|
6
7
|
import { initMobileViewport } from './core/mobileViewport';
|
|
7
8
|
import { installWeChatTouchSelectionGuard } from './core/wechatTouch';
|
|
8
9
|
import './theme/global.css';
|
|
@@ -16,6 +17,8 @@ try {
|
|
|
16
17
|
installWeChatTouchSelectionGuard();
|
|
17
18
|
// 全局:支持 .side-nav 等横向滚动容器响应鼠标滚轮(垂直 → 水平)
|
|
18
19
|
enableHorizontalWheel();
|
|
20
|
+
// 全局:原生滚动条隐藏,改为滚动时出现的悬浮细条
|
|
21
|
+
installAutoHideScrollbars();
|
|
19
22
|
} catch (error) {
|
|
20
23
|
// 非核心的浏览器增强失败不能阻止应用及其初始化错误界面出现。
|
|
21
24
|
console.error('Failed to configure Tavern Harness browser enhancements', error);
|
package/src/store/store.ts
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
import { getEnabledToolsForSession, executeToolCall, parseDisplayRef, applySessionWorkspace } from '../core/tools/toolExecutor';
|
|
51
51
|
import { CHARACTER_BOOK_TOOL, hasUsableCharacterBook, injectCharacterBookToolContext, mergeCharacterBooks } from '../core/characterBook';
|
|
52
52
|
import { createSessionWorkspaceDir, ensureSessionWorkspaceDir, deleteSessionWorkspace, isCurrentInstanceWorkspaceDir } from '../core/tools/generatedSkillExecutor';
|
|
53
|
-
import { applyTheme as applyThemeManual,
|
|
53
|
+
import { applyTheme as applyThemeManual, cacheTheme, watchSystemTheme } from '../theme/theme';
|
|
54
54
|
import { setLanguage, translate } from '../core/i18n';
|
|
55
55
|
import { hasBrowserUiPreferences, readBrowserUiPreferences, saveBrowserUiPreferences } from '../core/browserPreferences';
|
|
56
56
|
import { trimEdgeNewlines } from '../core/strings';
|
|
@@ -356,8 +356,8 @@ export const useStore = create<AppState>((set, get) => ({
|
|
|
356
356
|
const browserPreferences = hasBrowserUiPreferences()
|
|
357
357
|
? readBrowserUiPreferences()
|
|
358
358
|
: readOnly
|
|
359
|
-
? { language: serverSettings.language, themeMode: serverSettings.themeMode }
|
|
360
|
-
: saveBrowserUiPreferences({ language: serverSettings.language, themeMode: serverSettings.themeMode });
|
|
359
|
+
? { language: serverSettings.language, themeMode: serverSettings.themeMode, themePalette: serverSettings.themePalette ?? 'amber' }
|
|
360
|
+
: saveBrowserUiPreferences({ language: serverSettings.language, themeMode: serverSettings.themeMode, themePalette: serverSettings.themePalette ?? 'amber' });
|
|
361
361
|
const settings = { ...serverSettings, ...browserPreferences };
|
|
362
362
|
setLanguage(settings.language);
|
|
363
363
|
const providers = snapshot.collections.providers.map((record) => record.value);
|
|
@@ -389,12 +389,12 @@ export const useStore = create<AppState>((set, get) => ({
|
|
|
389
389
|
activeView: 'chat',
|
|
390
390
|
});
|
|
391
391
|
coreLoaded = true;
|
|
392
|
-
|
|
393
|
-
applyThemeManual(settings.themeMode);
|
|
392
|
+
cacheTheme(settings.themeMode, settings.themePalette);
|
|
393
|
+
applyThemeManual(settings.themeMode, settings.themePalette);
|
|
394
394
|
// 跟随系统模式下,系统切换深浅色时自动重新应用主题
|
|
395
395
|
watchSystemTheme(() => {
|
|
396
396
|
const s = useStore.getState().settings;
|
|
397
|
-
if (s) applyThemeManual(s.themeMode);
|
|
397
|
+
if (s) applyThemeManual(s.themeMode, s.themePalette);
|
|
398
398
|
});
|
|
399
399
|
// 非首屏工作不得阻塞可用界面;完成后再用数据库中的最新值刷新。
|
|
400
400
|
void initializeDeferredData(readOnly);
|
|
@@ -433,15 +433,16 @@ export const useStore = create<AppState>((set, get) => ({
|
|
|
433
433
|
const current = get().settings;
|
|
434
434
|
if (!current) return;
|
|
435
435
|
const next = { ...current, ...partial };
|
|
436
|
-
const { language, themeMode, ...sharedChanges } = partial;
|
|
437
|
-
if (language !== undefined || themeMode !== undefined) {
|
|
436
|
+
const { language, themeMode, themePalette, ...sharedChanges } = partial;
|
|
437
|
+
if (language !== undefined || themeMode !== undefined || themePalette !== undefined) {
|
|
438
438
|
saveBrowserUiPreferences({
|
|
439
439
|
language: language !== undefined ? language : current.language,
|
|
440
440
|
themeMode: themeMode ?? current.themeMode,
|
|
441
|
+
themePalette: themePalette ?? current.themePalette,
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
444
|
if (Object.keys(sharedChanges).length > 0) {
|
|
444
|
-
await db.settings.put({ ...next, language: null, themeMode: 'system' });
|
|
445
|
+
await db.settings.put({ ...next, language: null, themeMode: 'system', themePalette: 'amber' });
|
|
445
446
|
}
|
|
446
447
|
set({ settings: next });
|
|
447
448
|
const pending = get().pendingConfirmation;
|
|
@@ -458,8 +459,8 @@ export const useStore = create<AppState>((set, get) => ({
|
|
|
458
459
|
await get().refreshSessions();
|
|
459
460
|
await get().refreshParticipants();
|
|
460
461
|
}
|
|
461
|
-
|
|
462
|
-
applyThemeManual(next.themeMode);
|
|
462
|
+
cacheTheme(next.themeMode, next.themePalette);
|
|
463
|
+
applyThemeManual(next.themeMode, next.themePalette);
|
|
463
464
|
},
|
|
464
465
|
|
|
465
466
|
resetTavern: async () => {
|
|
@@ -608,7 +609,7 @@ export const useStore = create<AppState>((set, get) => ({
|
|
|
608
609
|
const provider = await db.providers.get(option.providerId);
|
|
609
610
|
if (!provider || !isEnabledProviderModel(provider, option.modelId)) return;
|
|
610
611
|
const next = { ...current, defaultModel: option.modelId, defaultProviderId: option.providerId };
|
|
611
|
-
await db.settings.put({ ...next, language: null, themeMode: 'system' });
|
|
612
|
+
await db.settings.put({ ...next, language: null, themeMode: 'system', themePalette: 'amber' });
|
|
612
613
|
set({ settings: next });
|
|
613
614
|
},
|
|
614
615
|
|
package/src/theme/chat.css
CHANGED
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
border-top-left-radius: 4px;
|
|
67
67
|
padding: 11px 15px;
|
|
68
68
|
font-size: var(--font-size-body);
|
|
69
|
-
box-shadow: var(--shadow);
|
|
70
69
|
min-width: 0;
|
|
71
70
|
max-width: 100%;
|
|
72
71
|
word-break: break-word;
|
|
@@ -104,10 +103,7 @@
|
|
|
104
103
|
border-color: color-mix(in srgb, var(--primary) 44%, transparent);
|
|
105
104
|
box-shadow:
|
|
106
105
|
inset 0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent),
|
|
107
|
-
inset 0 0 8px color-mix(in srgb, var(--glow) 16%, transparent)
|
|
108
|
-
0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent),
|
|
109
|
-
0 0 8px color-mix(in srgb, var(--glow) 34%, transparent),
|
|
110
|
-
0 0 16px color-mix(in srgb, var(--glow) 12%, transparent);
|
|
106
|
+
inset 0 0 8px color-mix(in srgb, var(--glow) 16%, transparent);
|
|
111
107
|
}
|
|
112
108
|
.stream-cursor {
|
|
113
109
|
display: inline-block;
|
|
@@ -229,21 +225,20 @@
|
|
|
229
225
|
margin: 2px 0;
|
|
230
226
|
}
|
|
231
227
|
.tool-card {
|
|
232
|
-
border:
|
|
228
|
+
border: none;
|
|
233
229
|
border-radius: 8px;
|
|
234
|
-
/*
|
|
235
|
-
覆盖在实色主区域上,视觉上就是一块很浅的暖灰,不是透视 */
|
|
230
|
+
/* 工具调用只用无边框色块表达状态,避免与消息气泡形成嵌套描边。 */
|
|
236
231
|
background: color-mix(in srgb, var(--text) 6%, transparent);
|
|
237
232
|
overflow: hidden;
|
|
238
233
|
}
|
|
239
234
|
.tool-card.executing {
|
|
240
|
-
|
|
235
|
+
background: color-mix(in srgb, var(--primary) 8%, transparent);
|
|
241
236
|
}
|
|
242
237
|
.tool-card.has-result {
|
|
243
|
-
|
|
238
|
+
background: color-mix(in srgb, var(--success) 8%, transparent);
|
|
244
239
|
}
|
|
245
240
|
.tool-card.has-error {
|
|
246
|
-
|
|
241
|
+
background: color-mix(in srgb, var(--danger) 8%, transparent);
|
|
247
242
|
}
|
|
248
243
|
.tool-card-head {
|
|
249
244
|
display: flex;
|
|
@@ -315,7 +310,7 @@
|
|
|
315
310
|
align-items: flex-start;
|
|
316
311
|
gap: 6px;
|
|
317
312
|
padding: 6px 12px 7px;
|
|
318
|
-
border-top:
|
|
313
|
+
border-top: none;
|
|
319
314
|
font-family: var(--font-family-mono);
|
|
320
315
|
font-size: var(--font-size-md);
|
|
321
316
|
font-weight: var(--font-weight-semibold);
|
|
@@ -374,10 +369,10 @@
|
|
|
374
369
|
|
|
375
370
|
/* ---------- 折叠面板(thinking / 工具结果) ---------- */
|
|
376
371
|
.collp {
|
|
377
|
-
border:
|
|
372
|
+
border: none;
|
|
378
373
|
border-radius: 8px;
|
|
379
|
-
/*
|
|
380
|
-
background: color-mix(in srgb, var(--think)
|
|
374
|
+
/* 思考卡与工具卡统一为无边框色块,只靠语义色区分。 */
|
|
375
|
+
background: color-mix(in srgb, var(--think) 7%, transparent);
|
|
381
376
|
overflow: hidden;
|
|
382
377
|
margin: 2px 0;
|
|
383
378
|
}
|
|
@@ -434,9 +429,9 @@
|
|
|
434
429
|
line-height: 1.6;
|
|
435
430
|
color: var(--text-secondary);
|
|
436
431
|
}
|
|
437
|
-
/*
|
|
432
|
+
/* 思考展开前后保持同一背景色。 */
|
|
438
433
|
.collp-think .collp-content {
|
|
439
|
-
background:
|
|
434
|
+
background: transparent;
|
|
440
435
|
}
|
|
441
436
|
.collp-preview {
|
|
442
437
|
padding: 5px 12px 8px;
|
|
@@ -464,9 +459,21 @@
|
|
|
464
459
|
/* ---------- 输入区 ---------- */
|
|
465
460
|
.composer {
|
|
466
461
|
--attachment-preview-gap: 8px;
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
462
|
+
position: absolute;
|
|
463
|
+
right: 12px;
|
|
464
|
+
bottom: 12px;
|
|
465
|
+
left: 12px;
|
|
466
|
+
z-index: 5;
|
|
467
|
+
padding: var(--attachment-preview-gap) 10px 8px;
|
|
468
|
+
border: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
|
|
469
|
+
border-radius: var(--radius);
|
|
470
|
+
background: color-mix(in srgb, var(--surface) 38%, transparent);
|
|
471
|
+
-webkit-backdrop-filter: blur(22px) saturate(160%);
|
|
472
|
+
backdrop-filter: blur(22px) saturate(160%);
|
|
473
|
+
box-shadow: 0 -6px 20px rgb(0 0 0 / 18%);
|
|
474
|
+
}
|
|
475
|
+
.composer-group {
|
|
476
|
+
right: calc(210px + 12px);
|
|
470
477
|
}
|
|
471
478
|
.composer-box {
|
|
472
479
|
position: relative;
|
|
@@ -474,23 +481,17 @@
|
|
|
474
481
|
display: flex;
|
|
475
482
|
align-items: flex-end;
|
|
476
483
|
gap: 4px;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
border:
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
box-shadow: 0 0 0 1px transparent, var(--shadow);
|
|
484
|
+
width: 100%;
|
|
485
|
+
background: transparent;
|
|
486
|
+
border: 1px solid transparent;
|
|
487
|
+
border-radius: var(--radius);
|
|
488
|
+
padding: 4px;
|
|
489
|
+
box-shadow: none;
|
|
484
490
|
transition: border-color 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1);
|
|
485
491
|
}
|
|
486
492
|
.composer-box:focus-within {
|
|
487
493
|
border-color: color-mix(in srgb, var(--primary) 48%, transparent);
|
|
488
|
-
box-shadow:
|
|
489
|
-
inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent),
|
|
490
|
-
inset 0 0 10px color-mix(in srgb, var(--glow) 22%, transparent),
|
|
491
|
-
0 0 0 1px color-mix(in srgb, var(--primary) 26%, transparent),
|
|
492
|
-
0 0 10px color-mix(in srgb, var(--glow) 42%, transparent),
|
|
493
|
-
0 0 20px color-mix(in srgb, var(--glow) 18%, transparent);
|
|
494
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent);
|
|
494
495
|
}
|
|
495
496
|
.composer-box textarea {
|
|
496
497
|
flex: 1;
|
|
@@ -659,8 +660,8 @@
|
|
|
659
660
|
.composer-hint {
|
|
660
661
|
display: flex;
|
|
661
662
|
justify-content: space-between;
|
|
662
|
-
|
|
663
|
-
margin: 6px
|
|
663
|
+
width: 100%;
|
|
664
|
+
margin: 6px 0 0;
|
|
664
665
|
font-size: var(--font-size-xs);
|
|
665
666
|
color: var(--text-muted);
|
|
666
667
|
}
|
|
@@ -671,8 +672,8 @@
|
|
|
671
672
|
display: flex;
|
|
672
673
|
flex-wrap: wrap;
|
|
673
674
|
gap: 8px;
|
|
674
|
-
|
|
675
|
-
margin: 0
|
|
675
|
+
width: 100%;
|
|
676
|
+
margin: 0 0 var(--attachment-preview-gap);
|
|
676
677
|
}
|
|
677
678
|
.attach-preview .attach-card,
|
|
678
679
|
.message-editor-attachments .attach-card {
|
|
@@ -714,8 +715,8 @@
|
|
|
714
715
|
margin-left: 0;
|
|
715
716
|
}
|
|
716
717
|
.cmd-menu {
|
|
717
|
-
|
|
718
|
-
margin: 0
|
|
718
|
+
width: 100%;
|
|
719
|
+
margin: 0 0 6px;
|
|
719
720
|
background: var(--surface);
|
|
720
721
|
border: 1px solid var(--border);
|
|
721
722
|
border-radius: 12px;
|
|
@@ -785,10 +786,15 @@
|
|
|
785
786
|
font-weight: var(--font-weight-extrabold);
|
|
786
787
|
line-height: 1.3;
|
|
787
788
|
}
|
|
788
|
-
.md h1 { font-size: 1.45em; border-bottom: 1px solid var(--border-soft); padding-bottom: 0.25em; }
|
|
789
|
-
.md h2 { font-size: 1.28em; border-bottom: 1px solid var(--border-soft); padding-bottom: 0.2em; }
|
|
789
|
+
.md h1 { font-size: 1.45em; border-bottom: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border-soft)); padding-bottom: 0.25em; }
|
|
790
|
+
.md h2 { font-size: 1.28em; border-bottom: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border-soft)); padding-bottom: 0.2em; }
|
|
790
791
|
.md h3 { font-size: 1.15em; }
|
|
791
792
|
.md h4 { font-size: 1.05em; }
|
|
793
|
+
.md h1,
|
|
794
|
+
.md h2,
|
|
795
|
+
.md h3 {
|
|
796
|
+
color: color-mix(in srgb, var(--primary) 24%, var(--text-primary));
|
|
797
|
+
}
|
|
792
798
|
.md ul,
|
|
793
799
|
.md ol {
|
|
794
800
|
padding-left: 1.4em;
|
|
@@ -819,9 +825,12 @@
|
|
|
819
825
|
}
|
|
820
826
|
.md hr {
|
|
821
827
|
border: none;
|
|
822
|
-
border-top: 1px solid var(--border);
|
|
828
|
+
border-top: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
|
|
823
829
|
margin: 1em 0;
|
|
824
830
|
}
|
|
831
|
+
.md li::marker {
|
|
832
|
+
color: var(--primary);
|
|
833
|
+
}
|
|
825
834
|
.md code {
|
|
826
835
|
font-family: var(--font-family-mono);
|
|
827
836
|
font-size: 0.86em;
|
|
@@ -832,7 +841,7 @@
|
|
|
832
841
|
}
|
|
833
842
|
.md pre.code-block {
|
|
834
843
|
background: var(--code-bg);
|
|
835
|
-
border: 1px solid var(--border);
|
|
844
|
+
border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
|
|
836
845
|
border-radius: 11px;
|
|
837
846
|
padding: 12px 14px;
|
|
838
847
|
overflow-x: auto;
|
|
@@ -846,15 +855,11 @@
|
|
|
846
855
|
font-size: var(--font-size-body-sm);
|
|
847
856
|
line-height: 1.55;
|
|
848
857
|
}
|
|
849
|
-
.md .tok-kw { color:
|
|
850
|
-
.md .tok-str { color:
|
|
851
|
-
.md .tok-num { color:
|
|
852
|
-
.md .tok-type { color:
|
|
858
|
+
.md .tok-kw { color: var(--code-keyword); font-weight: var(--font-weight-semibold); }
|
|
859
|
+
.md .tok-str { color: var(--code-string); }
|
|
860
|
+
.md .tok-num { color: var(--code-number); }
|
|
861
|
+
.md .tok-type { color: var(--code-type); font-weight: var(--font-weight-semibold); }
|
|
853
862
|
.md .tok-comment { color: var(--text-muted); font-style: italic; }
|
|
854
|
-
[data-theme='light'] .md .tok-kw { color: #7b3f00; }
|
|
855
|
-
[data-theme='light'] .md .tok-str { color: #2e7d32; }
|
|
856
|
-
[data-theme='light'] .md .tok-num { color: #1565c0; }
|
|
857
|
-
[data-theme='light'] .md .tok-type { color: #546e7a; }
|
|
858
863
|
.md table {
|
|
859
864
|
border-collapse: collapse;
|
|
860
865
|
margin: 0.6em 0;
|
|
@@ -863,7 +868,7 @@
|
|
|
863
868
|
}
|
|
864
869
|
.md th,
|
|
865
870
|
.md td {
|
|
866
|
-
border: 1px solid var(--border);
|
|
871
|
+
border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--border));
|
|
867
872
|
padding: 6px 11px;
|
|
868
873
|
text-align: left;
|
|
869
874
|
}
|
|
@@ -1069,6 +1074,7 @@
|
|
|
1069
1074
|
}
|
|
1070
1075
|
.chat-main-col .chat-scroll {
|
|
1071
1076
|
flex: 1;
|
|
1077
|
+
padding-bottom: 118px;
|
|
1072
1078
|
}
|
|
1073
1079
|
|
|
1074
1080
|
/* ---------- 输入区 @ 自动补全 ---------- */
|
|
@@ -1294,7 +1300,18 @@
|
|
|
1294
1300
|
|
|
1295
1301
|
.composer {
|
|
1296
1302
|
--attachment-preview-gap: 10px;
|
|
1297
|
-
|
|
1303
|
+
right: 8px;
|
|
1304
|
+
bottom: max(8px, env(safe-area-inset-bottom));
|
|
1305
|
+
left: 8px;
|
|
1306
|
+
padding: var(--attachment-preview-gap) 6px 6px;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
.composer-group {
|
|
1310
|
+
right: 8px;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
.chat-main-col .chat-scroll {
|
|
1314
|
+
padding-bottom: calc(94px + env(safe-area-inset-bottom));
|
|
1298
1315
|
}
|
|
1299
1316
|
|
|
1300
1317
|
.composer-box {
|