tavern-harness 0.2.3 → 0.2.5

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.
@@ -121,7 +121,7 @@ export const SettingsView = memo(function SettingsView() {
121
121
  </div>
122
122
 
123
123
  <div className="side-nav view-tabs" data-hscroll role="tablist" aria-label={t('settings.title')}>
124
- <button type="button" role="tab" aria-selected={tab === 'api'} className={`nav-chip ${tab === 'api' ? 'active' : ''}`} onClick={() => setTab('api')}>
124
+ <button data-opening-target="api" type="button" role="tab" aria-selected={tab === 'api'} className={`nav-chip ${tab === 'api' ? 'active' : ''}`} onClick={() => setTab('api')}>
125
125
  {t('settings.tabApi')}
126
126
  </button>
127
127
  <button type="button" role="tab" aria-selected={tab === 'model'} className={`nav-chip ${tab === 'model' ? 'active' : ''}`} onClick={() => setTab('model')}>
@@ -475,7 +475,7 @@ async function fetchModelsSmart(baseUrl: string, apiKey: string): Promise<Models
475
475
  throw lastErr ?? new Error('unknown-error');
476
476
  }
477
477
 
478
- function ApiKeyField({ value, onChange, required = false }: { value: string; onChange: (value: string) => void; required?: boolean }) {
478
+ function ApiKeyField({ value, onChange, required = false, openingTarget }: { value: string; onChange: (value: string) => void; required?: boolean; openingTarget?: string }) {
479
479
  const t = useT();
480
480
  const [visible, setVisible] = useState(false);
481
481
 
@@ -484,11 +484,18 @@ function ApiKeyField({ value, onChange, required = false }: { value: string; onC
484
484
  <label>{t('settings.apiKey')}</label>
485
485
  <div className="password-input-wrap">
486
486
  <input
487
+ data-opening-target={openingTarget}
487
488
  className="input mono"
488
489
  type={visible ? 'text' : 'password'}
489
490
  required={required}
490
491
  value={value}
491
492
  onChange={(event) => onChange(event.target.value)}
493
+ onBlur={() => {
494
+ if (openingTarget && value.trim()) window.dispatchEvent(new CustomEvent('th-opening-field-completed', { detail: openingTarget }));
495
+ }}
496
+ onKeyDown={(event) => {
497
+ if (event.key === 'Enter' && openingTarget && value.trim()) window.dispatchEvent(new CustomEvent('th-opening-field-completed', { detail: openingTarget }));
498
+ }}
492
499
  placeholder={t('settings.apiKeyPh')}
493
500
  autoComplete="new-password"
494
501
  spellCheck={false}
@@ -761,7 +768,7 @@ function VoiceProviderForm({ initial, onSave }: { initial: VoiceProvider; onSave
761
768
  </>;
762
769
  }
763
770
 
764
- function ProviderManager({ providers, onChanged }: { providers: ApiProvider[]; onChanged: () => void }) {
771
+ function ProviderManager({ providers, onChanged }: { providers: ApiProvider[]; onChanged: () => void | Promise<void> }) {
765
772
  const addToast = useStore((s) => s.addToast);
766
773
  const t = useT();
767
774
  const [editing, setEditing] = useState<ApiProvider | null>(null);
@@ -785,6 +792,7 @@ function ProviderManager({ providers, onChanged }: { providers: ApiProvider[]; o
785
792
  <div className="settings-section-head">
786
793
  <h3>{t('settings.providerTitle')}</h3>
787
794
  <button
795
+ data-opening-target="add-provider"
788
796
  className="btn btn-sm settings-gen-reset"
789
797
  onClick={() => setEditing({ name: '', baseUrl: '', apiKey: '', isEnabled: true, cachedModelsCsv: '', modelAliasesJson: '{}', createdAt: Date.now() })}
790
798
  >
@@ -835,15 +843,17 @@ function ProviderManager({ providers, onChanged }: { providers: ApiProvider[]; o
835
843
  <ProviderForm
836
844
  initial={editing}
837
845
  onSave={async (data) => {
846
+ let savedProviderId = editing.id;
838
847
  if (editing.id != null) {
839
848
  await db.providers.update(editing.id, data);
840
849
  addToast(t('toast.providerUpdated'));
841
850
  } else {
842
- await db.providers.add(data);
851
+ savedProviderId = await db.providers.add(data);
843
852
  addToast(t('toast.providerAdded'));
844
853
  }
845
854
  setEditing(null);
846
- onChanged();
855
+ await onChanged();
856
+ window.dispatchEvent(new CustomEvent('th-opening-provider-saved', { detail: savedProviderId }));
847
857
  }}
848
858
  />
849
859
  </Modal>
@@ -884,6 +894,7 @@ function ProviderForm({ initial, onSave }: { initial: ApiProvider; onSave: (p: A
884
894
  setAliases(updatedAliases);
885
895
  setEnabledModels(updatedEnabledModels);
886
896
  addToast(t('toast.providerOk', { n: fetchedModels.length, via: viaProxy ? t('toast.providerViaProxy') : '' }));
897
+ window.dispatchEvent(new CustomEvent('th-opening-provider-tested'));
887
898
  } catch (e) {
888
899
  const msg = (e as Error).message;
889
900
  addToast(t('toast.providerFail', { msg, hint: isNetworkLikeError(e) ? t('toast.providerFailCors') : '' }), 'error');
@@ -897,13 +908,29 @@ function ProviderForm({ initial, onSave }: { initial: ApiProvider; onSave: (p: A
897
908
  <div className="modal-body" style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
898
909
  <div className="field">
899
910
  <label>{t('settings.providerName')}</label>
900
- <input className="input" value={name} onChange={(e) => setName(e.target.value)} placeholder={t('settings.providerNamePh')} />
911
+ <input
912
+ data-opening-target="provider-name"
913
+ className="input"
914
+ value={name}
915
+ onChange={(e) => setName(e.target.value)}
916
+ onBlur={() => { if (name.trim()) window.dispatchEvent(new CustomEvent('th-opening-field-completed', { detail: 'provider-name' })); }}
917
+ onKeyDown={(e) => { if (e.key === 'Enter' && name.trim()) window.dispatchEvent(new CustomEvent('th-opening-field-completed', { detail: 'provider-name' })); }}
918
+ placeholder={t('settings.providerNamePh')}
919
+ />
901
920
  </div>
902
921
  <div className="field">
903
922
  <label>{t('settings.baseUrl')}</label>
904
- <input className="input mono" value={baseUrl} onChange={(e) => setBaseUrl(e.target.value)} placeholder={t('settings.baseUrlPh')} />
923
+ <input
924
+ data-opening-target="provider-base-url"
925
+ className="input mono"
926
+ value={baseUrl}
927
+ onChange={(e) => setBaseUrl(e.target.value)}
928
+ onBlur={() => { if (baseUrl.trim()) window.dispatchEvent(new CustomEvent('th-opening-field-completed', { detail: 'provider-base-url' })); }}
929
+ onKeyDown={(e) => { if (e.key === 'Enter' && baseUrl.trim()) window.dispatchEvent(new CustomEvent('th-opening-field-completed', { detail: 'provider-base-url' })); }}
930
+ placeholder={t('settings.baseUrlPh')}
931
+ />
905
932
  </div>
906
- <ApiKeyField value={apiKey} onChange={setApiKey} />
933
+ <ApiKeyField value={apiKey} onChange={setApiKey} openingTarget="provider-api-key" />
907
934
  {models.length > 0 && (
908
935
  <div className="field">
909
936
  <label>{t('settings.models')}</label>
@@ -939,11 +966,12 @@ function ProviderForm({ initial, onSave }: { initial: ApiProvider; onSave: (p: A
939
966
  </div>
940
967
  <div className="modal-foot">
941
968
  <button className="btn" onClick={() => {}} style={{ visibility: 'hidden' }}>{t('common.cancel')}</button>
942
- <button className="btn" disabled={!baseUrl.trim() || testing} onClick={testConnection}>
969
+ <button data-opening-target="provider-test" className="btn" disabled={!baseUrl.trim() || testing} onClick={testConnection}>
943
970
  {testing && <span className="spinner" style={{ width: 11, height: 11 }} />}
944
971
  {testing ? t('settings.testing') : t('settings.test')}
945
972
  </button>
946
973
  <button
974
+ data-opening-target="provider-save"
947
975
  className="btn btn-primary"
948
976
  disabled={!name.trim() || !baseUrl.trim()}
949
977
  onClick={() => {
@@ -74,6 +74,16 @@ export function Sidebar() {
74
74
  const [groupMembers, setGroupMembers] = useState<Record<number, NpcCharacter[]>>({});
75
75
  const sessionLongPressTarget = useRef<ChatSession | null>(null);
76
76
  const homeClickTimes = useRef<number[]>([]);
77
+
78
+ useEffect(() => {
79
+ const openForGuide = () => {
80
+ setActiveView('chat');
81
+ setMobileOpen(true);
82
+ };
83
+ window.addEventListener('th-opening-show-new-chat', openForGuide);
84
+ return () => window.removeEventListener('th-opening-show-new-chat', openForGuide);
85
+ }, [setActiveView]);
86
+
77
87
  const sessionLongPressProps = useTouchLongPress(
78
88
  (point) => {
79
89
  const session = sessionLongPressTarget.current;
@@ -314,7 +324,7 @@ export function Sidebar() {
314
324
  <button className={`nav-chip ${activeView === 'characters' ? 'active' : ''}`} onClick={() => { setActiveView('characters'); setMobileOpen(false); }}>
315
325
  <Icon name="users" size={15} /> <span>{t('nav.characters')}</span>
316
326
  </button>
317
- <button className={`nav-chip ${activeView === 'settings' ? 'active' : ''}`} onClick={() => { setActiveView('settings'); setMobileOpen(false); }}>
327
+ <button data-opening-target="settings" className={`nav-chip ${activeView === 'settings' ? 'active' : ''}`} onClick={() => { setActiveView('settings'); setMobileOpen(false); }}>
318
328
  <Icon name="settings" size={15} /> <span>{t('nav.settings')}</span>
319
329
  {hasUnseenVersion && <span className="unseen-dot" title={t('changelog.unseen')} />}
320
330
  </button>
@@ -358,7 +368,7 @@ export function Sidebar() {
358
368
  <button className={`nav-chip ${activeView === 'characters' ? 'active' : ''}`} onClick={() => setActiveView('characters')}>
359
369
  <Icon name="users" size={13} /> {t('nav.characters')}
360
370
  </button>
361
- <button className={`nav-chip ${activeView === 'settings' ? 'active' : ''}`} onClick={() => setActiveView('settings')}>
371
+ <button data-opening-target="settings" className={`nav-chip ${activeView === 'settings' ? 'active' : ''}`} onClick={() => setActiveView('settings')}>
362
372
  <Icon name="settings" size={13} /> {t('nav.settings')}
363
373
  {hasUnseenVersion && <span className="unseen-dot" title={t('changelog.unseen')} />}
364
374
  </button>
@@ -380,7 +390,7 @@ export function Sidebar() {
380
390
  >
381
391
  <Icon name="import" size={13} /> {t('nav.importGameplay')}
382
392
  </button>
383
- <button className="session-new-btn" onClick={() => setShowNew(true)} title={t('nav.newChatTitle')}>
393
+ <button data-opening-target="new-chat" className="session-new-btn" onClick={() => setShowNew(true)} title={t('nav.newChatTitle')}>
384
394
  <Icon name="plus" size={13} /> {t('nav.newChat')}
385
395
  </button>
386
396
  </div>
@@ -458,7 +468,7 @@ export function Sidebar() {
458
468
  )}
459
469
  </div>
460
470
 
461
- {showNew && <NewSessionMenu onClose={() => setShowNew(false)} />}
471
+ {showNew && <NewSessionMenu onClose={() => setShowNew(false)} onCreated={() => setMobileOpen(false)} />}
462
472
  {editTarget && <NewSessionMenu editingSession={editTarget} onClose={() => setEditTarget(null)} />}
463
473
 
464
474
  {sessionMenu &&
@@ -37,6 +37,9 @@ const dirty = new Set<Element>();
37
37
  const active = new Set<Element>();
38
38
  let layer: HTMLDivElement | null = null;
39
39
  let frame = 0;
40
+ let reconcileFrame = 0;
41
+ let installed = false;
42
+ let resizeObserver: ResizeObserver | null = null;
40
43
 
41
44
  function getLayer(): HTMLDivElement {
42
45
  if (layer?.isConnected) return layer;
@@ -130,28 +133,81 @@ function positionHorizontal(node: HTMLDivElement, m: ScrollMetrics): boolean {
130
133
  return true;
131
134
  }
132
135
 
133
- function hidePair(pair: ThumbPair): void {
134
- pair.vertical?.classList.remove('is-visible');
135
- pair.horizontal?.classList.remove('is-visible');
136
+ function hidePair(pair: ThumbPair, immediate = false): void {
137
+ for (const thumb of [pair.vertical, pair.horizontal]) {
138
+ thumb?.classList.toggle('is-suppressed', immediate);
139
+ thumb?.classList.remove('is-visible');
140
+ }
141
+ }
142
+
143
+ function deactivate(el: Element, remove = false): void {
144
+ dirty.delete(el);
145
+ active.delete(el);
146
+ resizeObserver?.unobserve(el);
147
+
148
+ const pair = pairs.get(el);
149
+ if (!pair) return;
150
+ window.clearTimeout(pair.timer);
151
+ hidePair(pair, true);
152
+ if (remove) {
153
+ pair.vertical?.remove();
154
+ pair.horizontal?.remove();
155
+ pairs.delete(el);
156
+ }
157
+ }
158
+
159
+ function isRenderable(el: Element): boolean {
160
+ if (el === document.documentElement) return true;
161
+ if (!(el instanceof HTMLElement) || !el.isConnected) return false;
162
+ const style = window.getComputedStyle(el);
163
+ return style.display !== 'none' && style.visibility !== 'hidden' && style.visibility !== 'collapse';
164
+ }
165
+
166
+ function reconcileActive(): void {
167
+ reconcileFrame = 0;
168
+ for (const el of [...active]) {
169
+ if (!isRenderable(el)) deactivate(el, !el.isConnected);
170
+ else dirty.add(el);
171
+ }
172
+ if (dirty.size > 0 && frame === 0) frame = window.requestAnimationFrame(flush);
173
+ }
174
+
175
+ function scheduleReconcile(): void {
176
+ if (reconcileFrame === 0) reconcileFrame = window.requestAnimationFrame(reconcileActive);
177
+ }
178
+
179
+ function hideForTransition(event: Event): void {
180
+ const target = event.target;
181
+ if (!(target instanceof Element)) return;
182
+ for (const el of [...active]) {
183
+ if (el === target || target.contains(el)) deactivate(el);
184
+ }
136
185
  }
137
186
 
138
187
  function update(el: Element): void {
139
188
  const metrics = measure(el);
140
- if (!metrics) return;
189
+ if (!metrics || !isRenderable(el)) {
190
+ deactivate(el, !el.isConnected);
191
+ return;
192
+ }
141
193
  const pair = getPair(el);
142
194
  const vertical = getThumb(pair, 'vertical');
143
195
  const horizontal = getThumb(pair, 'horizontal');
144
196
  const hasVertical = positionVertical(vertical, metrics);
145
197
  const hasHorizontal = positionHorizontal(horizontal, metrics);
146
198
 
199
+ vertical.classList.remove('is-suppressed');
200
+ horizontal.classList.remove('is-suppressed');
147
201
  vertical.classList.toggle('is-visible', hasVertical);
148
202
  horizontal.classList.toggle('is-visible', hasHorizontal);
149
203
  active.add(el);
204
+ resizeObserver?.observe(el);
150
205
 
151
206
  window.clearTimeout(pair.timer);
152
207
  pair.timer = window.setTimeout(() => {
153
208
  hidePair(pair);
154
209
  active.delete(el);
210
+ resizeObserver?.unobserve(el);
155
211
  // 容器已被移除时顺手回收浮层节点(WeakMap 无法清理 DOM 引用)。
156
212
  if (!el.isConnected) {
157
213
  pair.vertical?.remove();
@@ -178,14 +234,37 @@ function onScroll(event: Event): void {
178
234
  }
179
235
 
180
236
  export function installAutoHideScrollbars(): void {
181
- if (typeof document === 'undefined') return;
237
+ if (typeof document === 'undefined' || installed) return;
238
+ installed = true;
239
+
182
240
  document.addEventListener('scroll', onScroll, { capture: true, passive: true });
183
- // 视口尺寸变化后旧坐标会失效,先收起,等下一次滚动重新定位。
184
- window.addEventListener('resize', () => {
185
- for (const el of active) {
186
- const pair = pairs.get(el);
187
- if (pair) hidePair(pair);
241
+ document.addEventListener('transitionrun', hideForTransition, { capture: true, passive: true });
242
+ document.addEventListener('animationstart', hideForTransition, { capture: true, passive: true });
243
+
244
+ resizeObserver = new ResizeObserver(scheduleReconcile);
245
+ const mutationObserver = new MutationObserver((records) => {
246
+ const relevant = records.filter((record) => !layer?.contains(record.target));
247
+ if (relevant.length === 0) return;
248
+
249
+ for (const el of [...active]) {
250
+ if (!el.isConnected) {
251
+ deactivate(el, true);
252
+ continue;
253
+ }
254
+ if (relevant.some((record) => record.type === 'attributes' && record.target instanceof Element && record.target.contains(el))) {
255
+ deactivate(el);
256
+ }
188
257
  }
189
- active.clear();
258
+ scheduleReconcile();
259
+ });
260
+ mutationObserver.observe(document.documentElement, {
261
+ subtree: true,
262
+ childList: true,
263
+ attributes: true,
264
+ attributeFilter: ['class', 'style', 'hidden', 'open'],
265
+ });
266
+
267
+ window.addEventListener('resize', () => {
268
+ for (const el of [...active]) deactivate(el);
190
269
  });
191
270
  }
package/src/core/i18n.ts CHANGED
@@ -9,6 +9,7 @@ import type { AppLanguage } from '../types/models';
9
9
  // - setLanguage(): 由 store 在初始化与切换语言时调用(设置 <html lang> + 通知订阅者)
10
10
  // - 键前缀约定:common. nav. chat. settings. workshop. stats. dash. header. newSession.
11
11
  // gameplay. confirm. deleteConfirm. toast. tool. ach. achModal. display. prompt. builtinNpc. changelog.
12
+ // opening.
12
13
  // ============================================================
13
14
 
14
15
  type LangKey = Exclude<AppLanguage, null>;
@@ -186,18 +187,13 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
186
187
  'dash.welcome': '欢迎回到酒馆 🫖',
187
188
  'dash.hero': 'Tavern Harness — 更自由、更好玩、更易上手的酒馆!\n支持任意 OpenAI 兼容 API,支持本地模型,全部数据都存储在你的本地;\n支持受控本地技能,接入更多系统权限,解锁更多文本对话无法实现的游戏;\n酒馆已经完成智能体原生装修,有什么想要的,',
188
189
  'dash.heroAccent': '为什么不问问酒馆老板呢~',
189
- 'dash.newChat': '新建对话',
190
- 'dash.goCharacters': '前往角色工坊',
191
- 'dash.openWiki': '打开 Wiki 页面',
190
+ 'dash.openWiki': '打开WIKI',
192
191
  'dash.openGitHub': '打开 GitHub 项目',
193
- 'dash.continue': '与角色继续对话',
194
- 'dash.noCharConv': '还没有角色对话,从下面的角色卡片开始',
195
- 'dash.groupSession': '群聊',
196
- 'dash.newSession': '新对话',
197
- 'dash.timeJustNow': '刚刚',
198
- 'dash.timeMinAgo': '{n} 分钟前',
199
- 'dash.timeHourAgo': '{n} 小时前',
200
- 'dash.timeDayAgo': '{n} 天前',
192
+ 'dash.openIntro': '打开介绍页',
193
+ 'dash.manual': '酒馆说明书',
194
+ 'dash.manualChapterOne': '第一章:配置 API 并开启一个对话',
195
+ 'dash.manualChapterOneDesc': '依次配置模型服务、创建酒馆老板对话、选择模型并发送第一条消息。',
196
+ 'dash.manualStart': '开始',
201
197
  'dash.regulars': '酒馆常客',
202
198
  'dash.startChat': '开始对话',
203
199
 
@@ -610,6 +606,41 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
610
606
  'display.openHtmlInNewPage': '在新页面打开 HTML',
611
607
 
612
608
  // ---- 系统提示词 ----
609
+ // ---- 新手引导 ----
610
+ 'opening.progress': '{current} / {total}',
611
+ 'opening.skip': '跳过引导',
612
+ 'opening.question': '酒馆要怎么玩?你能帮我干什么?',
613
+ 'opening.settings.title': '欢迎来到酒馆',
614
+ 'opening.settings.body': '先进入「设置」,完成真实的模型服务配置。',
615
+ 'opening.api.title': '配置 API',
616
+ 'opening.api.body': '进入「API 配置」。',
617
+ 'opening.add-provider.title': '添加模型服务',
618
+ 'opening.add-provider.body': '添加一个 OpenAI 兼容的模型服务供应商。',
619
+ 'opening.provider-name.title': '填写供应商名称',
620
+ 'opening.provider-name.body': '输入一个方便识别的名称,然后按 Enter 或离开输入框继续。',
621
+ 'opening.provider-base-url.title': '填写 Base URL',
622
+ 'opening.provider-base-url.body': '输入模型服务的 OpenAI 兼容接口地址,然后按 Enter 或离开输入框继续。',
623
+ 'opening.provider-api-key.title': '填写 API Key',
624
+ 'opening.provider-api-key.body': '输入模型服务的 API Key,然后按 Enter 或离开输入框继续。',
625
+ 'opening.provider-test.title': '测试连接',
626
+ 'opening.provider-test.body': '信息填写完成。现在测试连接,成功后才能继续。',
627
+ 'opening.provider-save.title': '保存供应商',
628
+ 'opening.provider-save.body': '连接已通过。保存这份真实配置。',
629
+ 'opening.new-chat.title': '开始游戏',
630
+ 'opening.new-chat.body': '回到侧边栏,新建一个对话。',
631
+ 'opening.add-owner.title': '邀请酒馆老板',
632
+ 'opening.add-owner.body': '添加一位对话参与者。',
633
+ 'opening.owner-option.title': '选择酒馆老板',
634
+ 'opening.owner-option.body': '选择内置的酒馆老板作为对话对象。',
635
+ 'opening.create-chat.title': '进入对话',
636
+ 'opening.create-chat.body': '创建对话并进入酒馆老板的会话。',
637
+ 'opening.model-button.title': '选择模型',
638
+ 'opening.model-button.body': '打开模型列表。',
639
+ 'opening.model-option.title': '选择可用模型',
640
+ 'opening.model-option.body': '选择刚才配置的任意模型。',
641
+ 'opening.message-send.title': '问问酒馆老板',
642
+ 'opening.message-send.body': '问题已填好:“{question}” 点击发送,正式开启游戏。',
643
+
613
644
  'prompt.worldBook': '=== 世界书 ===',
614
645
  'prompt.userInfo': '=== USER INFO (用户扮演的角色) ===',
615
646
  'prompt.roleTag': '角色名',
@@ -780,18 +811,13 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
780
811
  'dash.welcome': '歡迎回到酒館 🫖',
781
812
  'dash.hero': 'Tavern Harness — 更自由、更好玩、更易上手的酒館!\n支援任意 OpenAI 相容 API,支援本地模型,全部資料都儲存在你的本地;\n支援受控本地技能,接入更多系統權限,解鎖更多文字對話無法實現的遊戲;\n酒館已經完成智慧體原生裝修,有什麼想要的,',
782
813
  'dash.heroAccent': '為什麼不問問酒館老闆呢~',
783
- 'dash.newChat': '新建對話',
784
- 'dash.goCharacters': '前往角色工坊',
785
- 'dash.openWiki': '開啟 Wiki 頁面',
814
+ 'dash.openWiki': '開啟WIKI',
786
815
  'dash.openGitHub': '開啟 GitHub 專案',
787
- 'dash.continue': '與角色繼續對話',
788
- 'dash.noCharConv': '還沒有角色對話,從下面的角色卡片開始',
789
- 'dash.groupSession': '群聊',
790
- 'dash.newSession': '新對話',
791
- 'dash.timeJustNow': '剛剛',
792
- 'dash.timeMinAgo': '{n} 分鐘前',
793
- 'dash.timeHourAgo': '{n} 小時前',
794
- 'dash.timeDayAgo': '{n} 天前',
816
+ 'dash.openIntro': '開啟介紹頁',
817
+ 'dash.manual': '酒館說明書',
818
+ 'dash.manualChapterOne': '第一章:設定 API 並開啟一個對話',
819
+ 'dash.manualChapterOneDesc': '依序設定模型服務、建立酒館老闆對話、選擇模型並傳送第一則訊息。',
820
+ 'dash.manualStart': '開始',
795
821
  'dash.regulars': '酒館常客',
796
822
  'dash.startChat': '開始對話',
797
823
 
@@ -1194,6 +1220,41 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
1194
1220
  'display.htmlSandboxNote': 'HTML 應用程式在受限沙箱中執行,並可載入同目錄資源',
1195
1221
  'display.openHtmlInNewPage': '在新頁面開啟 HTML',
1196
1222
 
1223
+ // ---- 新手引導 ----
1224
+ 'opening.progress': '{current} / {total}',
1225
+ 'opening.skip': '跳過引導',
1226
+ 'opening.question': '酒館要怎麼玩?你能幫我做什麼?',
1227
+ 'opening.settings.title': '歡迎來到酒館',
1228
+ 'opening.settings.body': '先進入「設定」,完成真實的模型服務設定。',
1229
+ 'opening.api.title': '設定 API',
1230
+ 'opening.api.body': '進入「API 設定」。',
1231
+ 'opening.add-provider.title': '新增模型服務',
1232
+ 'opening.add-provider.body': '新增一個 OpenAI 相容的模型服務供應商。',
1233
+ 'opening.provider-name.title': '填寫供應商名稱',
1234
+ 'opening.provider-name.body': '輸入一個方便辨識的名稱,然後按 Enter 或離開輸入框繼續。',
1235
+ 'opening.provider-base-url.title': '填寫 Base URL',
1236
+ 'opening.provider-base-url.body': '輸入模型服務的 OpenAI 相容介面位址,然後按 Enter 或離開輸入框繼續。',
1237
+ 'opening.provider-api-key.title': '填寫 API Key',
1238
+ 'opening.provider-api-key.body': '輸入模型服務的 API Key,然後按 Enter 或離開輸入框繼續。',
1239
+ 'opening.provider-test.title': '測試連線',
1240
+ 'opening.provider-test.body': '資訊填寫完成。現在測試連線,成功後才能繼續。',
1241
+ 'opening.provider-save.title': '儲存供應商',
1242
+ 'opening.provider-save.body': '連線已通過。儲存這份真實設定。',
1243
+ 'opening.new-chat.title': '開始遊戲',
1244
+ 'opening.new-chat.body': '回到側邊欄,新增一個對話。',
1245
+ 'opening.add-owner.title': '邀請酒館老闆',
1246
+ 'opening.add-owner.body': '新增一位對話參與者。',
1247
+ 'opening.owner-option.title': '選擇酒館老闆',
1248
+ 'opening.owner-option.body': '選擇內建的酒館老闆作為對話對象。',
1249
+ 'opening.create-chat.title': '進入對話',
1250
+ 'opening.create-chat.body': '建立對話並進入酒館老闆的會話。',
1251
+ 'opening.model-button.title': '選擇模型',
1252
+ 'opening.model-button.body': '開啟模型清單。',
1253
+ 'opening.model-option.title': '選擇可用模型',
1254
+ 'opening.model-option.body': '選擇剛才設定的任意模型。',
1255
+ 'opening.message-send.title': '問問酒館老闆',
1256
+ 'opening.message-send.body': '問題已填好:「{question}」 點擊傳送,正式開啟遊戲。',
1257
+
1197
1258
  'prompt.worldBook': '=== 世界書 ===',
1198
1259
  'prompt.userInfo': '=== USER INFO (用戶扮演的角色) ===',
1199
1260
  'prompt.roleTag': '角色名',
@@ -1364,18 +1425,13 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
1364
1425
  'dash.welcome': 'Welcome back to the Tavern 🫖',
1365
1426
  'dash.hero': 'Tavern Harness — a freer, more fun, easier-to-use tavern!\nSupports any OpenAI-compatible API and local models, with all data staying on your device;\nControlled local skills unlock more system capabilities and gameplay that plain text chat can\'t achieve;\nThe tavern comes agent-native furnished — want something,',
1366
1427
  'dash.heroAccent': 'why not ask the tavern keeper~',
1367
- 'dash.newChat': 'New conversation',
1368
- 'dash.goCharacters': 'Go to Characters',
1369
- 'dash.openWiki': 'Open wiki page',
1428
+ 'dash.openWiki': 'Open WIKI',
1370
1429
  'dash.openGitHub': 'Open GitHub project',
1371
- 'dash.continue': 'Continue character conversations',
1372
- 'dash.noCharConv': 'No character conversations yet — start from the cards below',
1373
- 'dash.groupSession': 'Group chat',
1374
- 'dash.newSession': 'New conversation',
1375
- 'dash.timeJustNow': 'Just now',
1376
- 'dash.timeMinAgo': '{n} min ago',
1377
- 'dash.timeHourAgo': '{n} hr ago',
1378
- 'dash.timeDayAgo': '{n} days ago',
1430
+ 'dash.openIntro': 'Open introduction page',
1431
+ 'dash.manual': 'Tavern Manual',
1432
+ 'dash.manualChapterOne': 'Chapter 1: Configure an API and start a conversation',
1433
+ 'dash.manualChapterOneDesc': 'Configure a model provider, create a Tavern Keeper chat, select the model, and send the first message.',
1434
+ 'dash.manualStart': 'Start',
1379
1435
  'dash.regulars': 'Tavern regulars',
1380
1436
  'dash.startChat': 'Start chat',
1381
1437
 
@@ -1778,6 +1834,41 @@ const MESSAGES: Record<LangKey, Record<string, string>> = {
1778
1834
  'display.htmlSandboxNote': 'HTML application runs in a restricted sandbox with same-directory resources available',
1779
1835
  'display.openHtmlInNewPage': 'Open HTML in a new page',
1780
1836
 
1837
+ // ---- Opening guide ----
1838
+ 'opening.progress': '{current} / {total}',
1839
+ 'opening.skip': 'Skip guide',
1840
+ 'opening.question': 'How do I play the tavern? What can you help me with?',
1841
+ 'opening.settings.title': 'Welcome to the Tavern',
1842
+ 'opening.settings.body': 'Open Settings first and set up a real model provider.',
1843
+ 'opening.api.title': 'Configure the API',
1844
+ 'opening.api.body': 'Open "API Configuration".',
1845
+ 'opening.add-provider.title': 'Add a model provider',
1846
+ 'opening.add-provider.body': 'Add an OpenAI-compatible model provider.',
1847
+ 'opening.provider-name.title': 'Name the provider',
1848
+ 'opening.provider-name.body': 'Enter a recognizable name, then press Enter or leave the field to continue.',
1849
+ 'opening.provider-base-url.title': 'Enter the Base URL',
1850
+ 'opening.provider-base-url.body': "Enter the model service's OpenAI-compatible endpoint, then press Enter or leave the field to continue.",
1851
+ 'opening.provider-api-key.title': 'Enter the API key',
1852
+ 'opening.provider-api-key.body': "Enter the model service's API key, then press Enter or leave the field to continue.",
1853
+ 'opening.provider-test.title': 'Test the connection',
1854
+ 'opening.provider-test.body': 'Everything is filled in. Test the connection now; you can continue once it succeeds.',
1855
+ 'opening.provider-save.title': 'Save the provider',
1856
+ 'opening.provider-save.body': 'The connection works. Save this real configuration.',
1857
+ 'opening.new-chat.title': 'Start the game',
1858
+ 'opening.new-chat.body': 'Go back to the sidebar and create a new conversation.',
1859
+ 'opening.add-owner.title': 'Invite the Tavern Keeper',
1860
+ 'opening.add-owner.body': 'Add a conversation participant.',
1861
+ 'opening.owner-option.title': 'Pick the Tavern Keeper',
1862
+ 'opening.owner-option.body': 'Choose the built-in Tavern Keeper as your conversation partner.',
1863
+ 'opening.create-chat.title': 'Enter the chat',
1864
+ 'opening.create-chat.body': 'Create the conversation and enter the Tavern Keeper chat.',
1865
+ 'opening.model-button.title': 'Choose a model',
1866
+ 'opening.model-button.body': 'Open the model list.',
1867
+ 'opening.model-option.title': 'Select an available model',
1868
+ 'opening.model-option.body': 'Pick any model from the provider you just configured.',
1869
+ 'opening.message-send.title': 'Ask the Tavern Keeper',
1870
+ 'opening.message-send.body': 'The question is filled in: “{question}” Click send to start the game.',
1871
+
1781
1872
  'prompt.worldBook': '=== LOREBOOK ===',
1782
1873
  'prompt.userInfo': '=== USER INFO (role played by the user) ===',
1783
1874
  'prompt.roleTag': 'character name',
@@ -1,7 +1,103 @@
1
1
  {
2
- "latest": "0.2.3",
2
+ "latest": "0.2.5",
3
3
  "repo": "https://github.com/Rannichan/Tavern-Harness",
4
4
  "entries": [
5
+ {
6
+ "version": "0.2.5",
7
+ "date": "2026-11-23",
8
+ "breaking": false,
9
+ "compare": "v0.2.4...v0.2.5",
10
+ "groups": {
11
+ "zh-CN": [
12
+ {
13
+ "kind": "added",
14
+ "items": [
15
+ "新增首次进入的交互式新手引导:聚光灯依次指向「设置 → API 配置 → 添加供应商 → 填写名称 / Base URL / API Key → 测试连接 → 保存 → 新建对话 → 选择酒馆老板 → 选择模型 → 发送第一条消息」,并在最后自动填入一句开场提问;支持简体中文、繁体中文和英文,可随时跳过,跳过后不再自动出现",
16
+ "仪表盘新增「酒馆说明书」区域,第一章可随时重新开始新手引导",
17
+ "仪表盘顶部新增「打开介绍页」入口"
18
+ ]
19
+ },
20
+ {
21
+ "kind": "changed",
22
+ "items": [
23
+ "仪表盘移除「与角色继续对话」列表,顶部操作精简为 GitHub、介绍页和 WIKI,页面更聚焦于角色卡片与新手引导",
24
+ "WIKI 入口文案缩短为「打开 WIKI」"
25
+ ]
26
+ },
27
+ {
28
+ "kind": "fixed",
29
+ "items": [
30
+ "修复窄屏下从侧边栏新建对话成功后,抽屉和遮罩仍盖在主区域上方、挡住后续操作的问题;现在创建成功会自动收起侧边栏,编辑已有会话不触发",
31
+ "修复侧边栏、弹窗等滚动容器在收起、隐藏或播放切换动画后残留悬浮滚动条的问题;容器不可见时会立即清理滚动条浮层"
32
+ ]
33
+ },
34
+ {
35
+ "kind": "internal",
36
+ "items": [
37
+ "滚动条模块新增 ResizeObserver、MutationObserver 以及过渡和动画监听,统一回收不可见容器的浮层",
38
+ "新手引导通过事件与 `data-opening-target` 标记驱动,完成状态写入 localStorage",
39
+ "移除仪表盘不再使用的会话预览、相对时间格式化代码及对应 i18n 文案"
40
+ ]
41
+ }
42
+ ],
43
+ "en": [
44
+ {
45
+ "kind": "added",
46
+ "items": [
47
+ "Added an interactive first-run guide: a spotlight walks through Settings → API Configuration → add a provider → enter name / Base URL / API key → test the connection → save → create a chat → pick the Tavern Keeper → choose a model → send the first message, with a starter question pre-filled at the end. Available in Simplified Chinese, Traditional Chinese, and English, skippable at any time, and it won't reappear once skipped",
48
+ "Added a Tavern Manual section on the dashboard; Chapter 1 restarts the guide at any time",
49
+ "Added an \"Open introduction page\" action to the dashboard hero"
50
+ ]
51
+ },
52
+ {
53
+ "kind": "changed",
54
+ "items": [
55
+ "Removed the \"Continue character conversations\" list from the dashboard and trimmed the hero actions to GitHub, the introduction page, and the WIKI, focusing the page on character cards and onboarding",
56
+ "Shortened the WIKI action label to \"Open WIKI\""
57
+ ]
58
+ },
59
+ {
60
+ "kind": "fixed",
61
+ "items": [
62
+ "Fixed the sidebar drawer and overlay staying over the main area after creating a chat on narrow screens and blocking the next step; the drawer now closes after a successful create and stays open when editing an existing chat",
63
+ "Fixed stale floating scrollbars left behind when scroll containers collapse, hide, or run transition animations; overlay thumbs are now removed as soon as the container is not visible"
64
+ ]
65
+ },
66
+ {
67
+ "kind": "internal",
68
+ "items": [
69
+ "The scrollbar module now uses ResizeObserver, MutationObserver, and transition/animation listeners to reclaim overlays for hidden containers",
70
+ "The opening guide is driven by events and `data-opening-target` markers, with completion persisted in localStorage",
71
+ "Removed unused dashboard session-preview and relative-time formatting code and their i18n strings"
72
+ ]
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ {
78
+ "version": "0.2.4",
79
+ "date": "2026-11-22",
80
+ "breaking": false,
81
+ "compare": "v0.2.3...v0.2.4",
82
+ "groups": {
83
+ "zh-CN": [
84
+ {
85
+ "kind": "fixed",
86
+ "items": [
87
+ "修复通过 `/nsfw` 或长按发送键注入破甲指令后,重新生成该回复时不再注入破甲指令的问题;现在重新生成会读取当前会话最新的破甲指令并临时注入"
88
+ ]
89
+ }
90
+ ],
91
+ "en": [
92
+ {
93
+ "kind": "fixed",
94
+ "items": [
95
+ "Fixed regenerating a reply that was sent with `/nsfw` or hold-to-charge losing the armor-breaking injection; regeneration now applies the latest armor-breaking instruction configured for the conversation"
96
+ ]
97
+ }
98
+ ]
99
+ }
100
+ },
5
101
  {
6
102
  "version": "0.2.3",
7
103
  "date": "2026-11-21",