dsh-session-title-stamp 0.7.1 → 0.8.1
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 +16 -6
- package/README.zh.md +14 -4
- package/client.js +37 -4
- package/docs/0.7.0-settings-mock.png +0 -0
- package/docs/screenshots/01-session-list.png +0 -0
- package/docs/screenshots/02-settings.png +0 -0
- package/docs/screenshots/03-hover-stats.png +0 -0
- package/lib/format.js +7 -1
- package/lib/index.js +6 -1
- package/market/index.json +5 -5
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -14,12 +14,13 @@ title. Beyond automatic naming:
|
|
|
14
14
|
- **Generate title** — the conversation-header ↻ button, the session row's
|
|
15
15
|
**Generate title** menu item, or `/retitle`.
|
|
16
16
|
- **Copy title** — an extra item in the session `···` menu copies the full title.
|
|
17
|
-
- **Settings page** — preview and change format, emoji, and refresh cadence without editing YAML.
|
|
17
|
+
- **Settings page** — preview and change format, emoji, title language, and refresh cadence without editing YAML.
|
|
18
18
|
- **Optional category emoji** — `categoryEmoji: true` renders titles such as
|
|
19
19
|
`1027 | ⚡ 优化 | ...`.
|
|
20
20
|
- **Hover stats** — see duration, estimated CNY cost, and token count at a glance,
|
|
21
21
|
without opening a dashboard.
|
|
22
22
|
- **Category language** — `categoryPreset: zh | en`, or your own `categories`.
|
|
23
|
+
- **Title language** — names can follow the conversation, or be forced to Chinese/English.
|
|
23
24
|
- **Failure-safe** — a failed retitle keeps the current title.
|
|
24
25
|
- **Zero build** — pure Host logic plus a small hand-written browser half.
|
|
25
26
|
|
|
@@ -47,6 +48,12 @@ locally. The model only proposes the category and the name; the provider owns
|
|
|
47
48
|
the final format. The default taxonomy is Chinese; set `categoryPreset: en` for
|
|
48
49
|
the English labels above.
|
|
49
50
|
|
|
51
|
+
## Screenshots
|
|
52
|
+
|
|
53
|
+
| Titles at a glance | Settings | Hover stats |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| <img src="docs/screenshots/01-session-list.png" width="320" alt="Date, category and name titles in the session list"> | <img src="docs/screenshots/02-settings.png" width="320" alt="Session title settings page"> | <img src="docs/screenshots/03-hover-stats.png" width="320" alt="Hover card with duration, estimated cost and tokens"> |
|
|
56
|
+
|
|
50
57
|
## Why
|
|
51
58
|
|
|
52
59
|
Long-lived workspaces collect dozens of sessions whose titles are either the
|
|
@@ -67,7 +74,7 @@ and mirrors conventions used by other coding agents.
|
|
|
67
74
|
Add this market index source in **Plugins → Discover → Index sources**:
|
|
68
75
|
|
|
69
76
|
```text
|
|
70
|
-
https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.
|
|
77
|
+
https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.8.1/market/index.json
|
|
71
78
|
```
|
|
72
79
|
|
|
73
80
|
Then install **Session title stamp** from the list. The plugin installs as a
|
|
@@ -179,12 +186,14 @@ route; the refresh button and automatic titles are unaffected.
|
|
|
179
186
|
0.7.0 adds **Settings → Plugins → Session titles**:
|
|
180
187
|
|
|
181
188
|
- a live preview of the exact title the current template will produce;
|
|
182
|
-
- category language (Chinese/English), optional category emoji,
|
|
183
|
-
and the title template;
|
|
189
|
+
- category language (Chinese/English), title language, optional category emoji,
|
|
190
|
+
date format, and the title template;
|
|
184
191
|
- the auto-refresh switch, minimum interval, message freeze, and opt-in startup
|
|
185
192
|
backfill, with the cost trade-off stated in place;
|
|
186
|
-
- advanced name-length
|
|
187
|
-
model routing stay in the profile configuration.
|
|
193
|
+
- advanced name-length, recent-message, and title-byte controls; timeouts,
|
|
194
|
+
budgets, and model routing stay in the profile configuration.
|
|
195
|
+
|
|
196
|
+
0.8.0 adds the title-language choice and the advanced byte limit.
|
|
188
197
|
|
|
189
198
|
Saving writes the current profile's plugin config, so it applies to the next
|
|
190
199
|
generated title without a restart. Existing titles are never rewritten.
|
|
@@ -227,6 +236,7 @@ Override the row in the profile's `cordis.patch.yml`:
|
|
|
227
236
|
| `dateFormat` | `MMDD` | Used by `{date}`: `MMDD` (`1028`), `YYMM` (`2610`), or `YYYYMMDD` |
|
|
228
237
|
| `timeZone` | host local | IANA zone used for date/time placeholders |
|
|
229
238
|
| `categoryPreset` | `zh` | Built-in category language: `zh` or `en` |
|
|
239
|
+
| `titleLanguage` | `auto` | Name language: `auto`, `zh`, or `en` |
|
|
230
240
|
| `categories` | preset | Explicit category list; overrides `categoryPreset` |
|
|
231
241
|
| `categoryEmoji` | `false` | Prefix the category with its emoji (⚡ 优化, 🐛 修复, ...) |
|
|
232
242
|
| `maxNameChars` | `20` | Character cap before the byte cap applies |
|
package/README.zh.md
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
- **自动重算**:回答完成后更新,2 分钟冷却,超过 100 条消息后冻结;fork、子代理和手动固定的标题跳过。
|
|
8
8
|
- **生成标题**:会话头 ↻ 按钮、会话行 `···` 菜单「自动生成标题」、或 `/retitle`。
|
|
9
9
|
- **复制标题**:会话行 `···` 菜单多一项复制完整标题。
|
|
10
|
-
- **设置页**:可视化调整格式、emoji
|
|
10
|
+
- **设置页**:可视化调整格式、emoji、标题语言和重算节奏,带实时预览,不用改 YAML。
|
|
11
11
|
- **可选 emoji 分类**:`categoryEmoji: true` 后标题形如 `1027 | ⚡ 优化 | ...`。
|
|
12
12
|
- **悬停统计**:不打开面板,一眼看到耗时、估算 CNY 成本、token 数。
|
|
13
13
|
- **分类语言**:`categoryPreset: zh | en`,也可以用 `categories` 自定义。
|
|
14
|
+
- **标题语言**:名称可跟随对话,也可强制中文/English。
|
|
14
15
|
- **失败保护**:重算失败保留当前标题,不被兜底标题覆盖。
|
|
15
16
|
- **零构建**:纯 Host 逻辑 + 小型手写浏览器半边。
|
|
16
17
|
|
|
@@ -34,6 +35,12 @@
|
|
|
34
35
|
|
|
35
36
|
日期由插件从**会话创建时间**计算,不交给模型;分类只能从可配置词表中选择,并在本地校验;模型只负责提出分类和名称,最终格式由模板决定。
|
|
36
37
|
|
|
38
|
+
## 截图
|
|
39
|
+
|
|
40
|
+
| 标题一眼看懂 | 设置页 | 悬停统计 |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| <img src="docs/screenshots/01-session-list.png" width="320" alt="侧栏里的日期、分类、名称标题"> | <img src="docs/screenshots/02-settings.png" width="320" alt="会话标题设置页"> | <img src="docs/screenshots/03-hover-stats.png" width="320" alt="悬停卡片显示耗时、估算成本和 token"> |
|
|
43
|
+
|
|
37
44
|
## 为什么
|
|
38
45
|
|
|
39
46
|
工作区里的会话一多,侧栏标题要么是首条消息的前几个字,要么是容易漂移的自动摘要。固定成 `日期 | 分类 | 名称` 后,跨项目扫侧栏会快很多,也和其它 coding agent 的命名习惯一致。
|
|
@@ -50,7 +57,7 @@
|
|
|
50
57
|
在 **插件 → 发现(Discover)→ 索引源** 添加:
|
|
51
58
|
|
|
52
59
|
```text
|
|
53
|
-
https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.
|
|
60
|
+
https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.8.1/market/index.json
|
|
54
61
|
```
|
|
55
62
|
|
|
56
63
|
然后在列表里安装 **Session title stamp / 会话标题印章**。插件以 profile bundle 的形式安装,之后可在插件页启停。
|
|
@@ -133,9 +140,11 @@ fork 子会话、子代理会话,以及用户手动改名固定的标题都会
|
|
|
133
140
|
0.7.0 增加 **设置 → 插件设置 → 会话标题**:
|
|
134
141
|
|
|
135
142
|
- 顶部实时预览当前模板会生成的标题;
|
|
136
|
-
- 分类语言(中文/English
|
|
143
|
+
- 分类语言(中文/English)、标题语言、可选分类 emoji、日期格式、标题模板;
|
|
137
144
|
- 自动重算开关、最小间隔、消息数冻结、启动补刷,并把额外模型成本写在说明里;
|
|
138
|
-
-
|
|
145
|
+
- 高级项放名称长度、最近消息数和标题字节上限;超时、预算、模型路由仍在配置文件里。
|
|
146
|
+
|
|
147
|
+
0.8.0 增加标题语言选择与高级字节上限。
|
|
139
148
|
|
|
140
149
|
保存会写入当前 profile 的插件配置,对下一次生成的标题生效,不需要重启;已有标题不会被改写。
|
|
141
150
|
|
|
@@ -174,6 +183,7 @@ fork 子会话、子代理会话,以及用户手动改名固定的标题都会
|
|
|
174
183
|
| `dateFormat` | `MMDD` | `{date}` 使用:`MMDD`(`1028`)/ `YYMM`(`2610`)/ `YYYYMMDD` |
|
|
175
184
|
| `timeZone` | 本机时区 | 日期/时间占位符使用的 IANA 时区 |
|
|
176
185
|
| `categoryPreset` | `zh` | 内置分类语言:`zh` 或 `en` |
|
|
186
|
+
| `titleLanguage` | `auto` | 名称语言:`auto`、`zh` 或 `en` |
|
|
177
187
|
| `categories` | 预设 | 显式分类词表,优先级高于 `categoryPreset` |
|
|
178
188
|
| `categoryEmoji` | `false` | 给分类加 emoji 前缀(⚡ 优化、🐛 修复……) |
|
|
179
189
|
| `maxNameChars` | `20` | 名称字符上限(最终还受字节上限约束) |
|
package/client.js
CHANGED
|
@@ -38,6 +38,14 @@ window.__ModuleLoader__.load({
|
|
|
38
38
|
'settings.format': '标题格式',
|
|
39
39
|
'settings.categoryLanguage': '分类语言',
|
|
40
40
|
'settings.categoryLanguageHint': '中文使用「分析 / 实现 / 修复 / 优化…」,英文使用 Analysis / Build / Fix / Optimize…',
|
|
41
|
+
'settings.titleLanguage': '标题语言',
|
|
42
|
+
'settings.titleLanguageHint': '名称使用哪种语言;分类标签仍由上面的分类语言决定。',
|
|
43
|
+
'settings.langAuto': '跟随对话',
|
|
44
|
+
'settings.langZh': '中文',
|
|
45
|
+
'settings.langEn': 'English',
|
|
46
|
+
'settings.maxBytes': '标题最大字节数',
|
|
47
|
+
'settings.maxBytesHint': '1–80,最终还受标题服务上限约束。',
|
|
48
|
+
'settings.bytes': '字节',
|
|
41
49
|
'settings.categoryEmoji': '分类 emoji 前缀',
|
|
42
50
|
'settings.categoryEmojiHint': '为分类增加视觉标记;默认关闭,开启后会占用少量标题字节。',
|
|
43
51
|
'settings.dateFormat': '日期格式',
|
|
@@ -89,6 +97,14 @@ window.__ModuleLoader__.load({
|
|
|
89
97
|
'settings.format': 'Title format',
|
|
90
98
|
'settings.categoryLanguage': 'Category language',
|
|
91
99
|
'settings.categoryLanguageHint': 'Chinese uses 分析 / 实现 / 修复 / 优化…; English uses Analysis / Build / Fix / Optimize…',
|
|
100
|
+
'settings.titleLanguage': 'Title language',
|
|
101
|
+
'settings.titleLanguageHint': 'Language for the name; category labels still follow the category language above.',
|
|
102
|
+
'settings.langAuto': 'Follow chat',
|
|
103
|
+
'settings.langZh': 'Chinese',
|
|
104
|
+
'settings.langEn': 'English',
|
|
105
|
+
'settings.maxBytes': 'Maximum title bytes',
|
|
106
|
+
'settings.maxBytesHint': '1–80, still capped by the title service limit.',
|
|
107
|
+
'settings.bytes': 'bytes',
|
|
92
108
|
'settings.categoryEmoji': 'Category emoji prefix',
|
|
93
109
|
'settings.categoryEmojiHint': 'Adds a visual marker and a few title bytes. Off by default.',
|
|
94
110
|
'settings.dateFormat': 'Date format',
|
|
@@ -388,10 +404,11 @@ window.__ModuleLoader__.load({
|
|
|
388
404
|
const h = React.createElement
|
|
389
405
|
const DEFAULT_TEMPLATE = '{date} | {type} | {topic}'
|
|
390
406
|
const readText = (key) => t(`settings.${key}`)
|
|
391
|
-
const sample = (preset, emoji, dateFormat, template) => {
|
|
407
|
+
const sample = (preset, emoji, dateFormat, template, titleLanguage) => {
|
|
392
408
|
const base = preset === 'en' ? 'Optimize' : '优化'
|
|
393
409
|
const type = emoji ? `⚡ ${base}` : base
|
|
394
|
-
const
|
|
410
|
+
const topicLanguage = titleLanguage === 'auto' ? (preset === 'en' ? 'en' : 'zh') : titleLanguage
|
|
411
|
+
const topic = topicLanguage === 'en' ? 'Reduce renderer memory usage' : '降低渲染器内存占用'
|
|
395
412
|
const date = dateFormat === 'YYMM' ? '2610' : dateFormat === 'YYYYMMDD' ? '20261027' : '1027'
|
|
396
413
|
const values = { date, type, topic, MMDD: '1027', YYMM: '2610', YYYYMMDD: '20261027', HHmm: '1230', YYYY: '2026', YY: '26', MM: '10', DD: '27', HH: '12', mm: '30', ss: '00' }
|
|
397
414
|
return (template || DEFAULT_TEMPLATE).replace(/\{([A-Za-z]+)\}/g, (match, key) => values[key] ?? match)
|
|
@@ -406,6 +423,7 @@ window.__ModuleLoader__.load({
|
|
|
406
423
|
const stored = snapshot.value ?? {}
|
|
407
424
|
const storedPreset = stored.categoryPreset === 'en' ? 'en' : 'zh'
|
|
408
425
|
const storedEmoji = stored.categoryEmoji === true
|
|
426
|
+
const storedTitleLanguage = ['zh', 'en'].includes(stored.titleLanguage) ? stored.titleLanguage : 'auto'
|
|
409
427
|
const storedDateFormat = ['MMDD', 'YYMM', 'YYYYMMDD'].includes(stored.dateFormat) ? stored.dateFormat : 'MMDD'
|
|
410
428
|
const storedTemplate = typeof stored.template === 'string' && stored.template.trim() !== '' ? stored.template.trim() : DEFAULT_TEMPLATE
|
|
411
429
|
const storedAuto = stored.refreshOnTurnEnd !== false
|
|
@@ -414,9 +432,11 @@ window.__ModuleLoader__.load({
|
|
|
414
432
|
const storedBackfill = stored.backfillOnStart === true
|
|
415
433
|
const storedNameChars = String(Number.isFinite(stored.maxNameChars) ? stored.maxNameChars : 20)
|
|
416
434
|
const storedRecent = String(Number.isFinite(stored.recentMessages) ? stored.recentMessages : 8)
|
|
435
|
+
const storedMaxTitleBytes = String(Number.isFinite(stored.maxTitleBytes) ? stored.maxTitleBytes : 80)
|
|
417
436
|
|
|
418
437
|
const [categoryPreset, setCategoryPreset] = React.useState(storedPreset)
|
|
419
438
|
const [categoryEmoji, setCategoryEmoji] = React.useState(storedEmoji)
|
|
439
|
+
const [titleLanguage, setTitleLanguage] = React.useState(storedTitleLanguage)
|
|
420
440
|
const [dateFormat, setDateFormat] = React.useState(storedDateFormat)
|
|
421
441
|
const [template, setTemplate] = React.useState(storedTemplate)
|
|
422
442
|
const [autoRefresh, setAutoRefresh] = React.useState(storedAuto)
|
|
@@ -425,12 +445,14 @@ window.__ModuleLoader__.load({
|
|
|
425
445
|
const [backfill, setBackfill] = React.useState(storedBackfill)
|
|
426
446
|
const [nameChars, setNameChars] = React.useState(storedNameChars)
|
|
427
447
|
const [recentMessages, setRecentMessages] = React.useState(storedRecent)
|
|
448
|
+
const [maxTitleBytes, setMaxTitleBytes] = React.useState(storedMaxTitleBytes)
|
|
428
449
|
const [advancedOpen, setAdvancedOpen] = React.useState(false)
|
|
429
450
|
const [saveState, setSaveState] = React.useState('idle')
|
|
430
451
|
|
|
431
452
|
React.useEffect(() => {
|
|
432
453
|
setCategoryPreset(storedPreset)
|
|
433
454
|
setCategoryEmoji(storedEmoji)
|
|
455
|
+
setTitleLanguage(storedTitleLanguage)
|
|
434
456
|
setDateFormat(storedDateFormat)
|
|
435
457
|
setTemplate(storedTemplate)
|
|
436
458
|
setAutoRefresh(storedAuto)
|
|
@@ -439,6 +461,7 @@ window.__ModuleLoader__.load({
|
|
|
439
461
|
setBackfill(storedBackfill)
|
|
440
462
|
setNameChars(storedNameChars)
|
|
441
463
|
setRecentMessages(storedRecent)
|
|
464
|
+
setMaxTitleBytes(storedMaxTitleBytes)
|
|
442
465
|
}, [snapshot.revision])
|
|
443
466
|
|
|
444
467
|
const busy = saveState === 'saving'
|
|
@@ -446,6 +469,7 @@ window.__ModuleLoader__.load({
|
|
|
446
469
|
const dirty =
|
|
447
470
|
categoryPreset !== storedPreset ||
|
|
448
471
|
categoryEmoji !== storedEmoji ||
|
|
472
|
+
titleLanguage !== storedTitleLanguage ||
|
|
449
473
|
dateFormat !== storedDateFormat ||
|
|
450
474
|
template !== storedTemplate ||
|
|
451
475
|
autoRefresh !== storedAuto ||
|
|
@@ -453,7 +477,8 @@ window.__ModuleLoader__.load({
|
|
|
453
477
|
freeze !== storedFreeze ||
|
|
454
478
|
backfill !== storedBackfill ||
|
|
455
479
|
nameChars !== storedNameChars ||
|
|
456
|
-
recentMessages !== storedRecent
|
|
480
|
+
recentMessages !== storedRecent ||
|
|
481
|
+
maxTitleBytes !== storedMaxTitleBytes
|
|
457
482
|
|
|
458
483
|
const row = (key, title, desc, control, column = false) =>
|
|
459
484
|
h(
|
|
@@ -506,12 +531,14 @@ window.__ModuleLoader__.load({
|
|
|
506
531
|
const parsedFreeze = Math.max(0, Math.min(100000, Number.parseInt(freeze, 10) || 0))
|
|
507
532
|
const parsedName = Math.max(4, Math.min(40, Number.parseInt(nameChars, 10) || 20))
|
|
508
533
|
const parsedRecent = Math.max(2, Math.min(20, Number.parseInt(recentMessages, 10) || 8))
|
|
534
|
+
const parsedMaxTitleBytes = Math.max(1, Math.min(80, Number.parseInt(maxTitleBytes, 10) || 80))
|
|
509
535
|
const nextTemplate = template.trim() === '' ? DEFAULT_TEMPLATE : template.trim()
|
|
510
536
|
try {
|
|
511
537
|
const ok = await form.mutate(
|
|
512
538
|
[
|
|
513
539
|
{ op: 'set', path: ['categoryPreset'], value: categoryPreset },
|
|
514
540
|
{ op: 'set', path: ['categoryEmoji'], value: categoryEmoji },
|
|
541
|
+
{ op: 'set', path: ['titleLanguage'], value: titleLanguage },
|
|
515
542
|
{ op: 'set', path: ['dateFormat'], value: dateFormat },
|
|
516
543
|
{ op: 'set', path: ['template'], value: nextTemplate },
|
|
517
544
|
{ op: 'set', path: ['refreshOnTurnEnd'], value: autoRefresh },
|
|
@@ -520,6 +547,7 @@ window.__ModuleLoader__.load({
|
|
|
520
547
|
{ op: 'set', path: ['backfillOnStart'], value: backfill },
|
|
521
548
|
{ op: 'set', path: ['maxNameChars'], value: parsedName },
|
|
522
549
|
{ op: 'set', path: ['recentMessages'], value: parsedRecent },
|
|
550
|
+
{ op: 'set', path: ['maxTitleBytes'], value: parsedMaxTitleBytes },
|
|
523
551
|
],
|
|
524
552
|
snapshot.revision,
|
|
525
553
|
)
|
|
@@ -532,6 +560,7 @@ window.__ModuleLoader__.load({
|
|
|
532
560
|
const restore = () => {
|
|
533
561
|
setCategoryPreset('zh')
|
|
534
562
|
setCategoryEmoji(false)
|
|
563
|
+
setTitleLanguage('auto')
|
|
535
564
|
setDateFormat('MMDD')
|
|
536
565
|
setTemplate(DEFAULT_TEMPLATE)
|
|
537
566
|
setAutoRefresh(true)
|
|
@@ -540,13 +569,14 @@ window.__ModuleLoader__.load({
|
|
|
540
569
|
setBackfill(false)
|
|
541
570
|
setNameChars('20')
|
|
542
571
|
setRecentMessages('8')
|
|
572
|
+
setMaxTitleBytes('80')
|
|
543
573
|
setSaveState('idle')
|
|
544
574
|
}
|
|
545
575
|
|
|
546
576
|
if (snapshot.status === 'loading') return h('div', { style: SETTINGS_STYLE.desc }, readText('loading'))
|
|
547
577
|
if (snapshot.status === 'unavailable') return h('div', { style: SETTINGS_STYLE.desc }, readText('unavailable'))
|
|
548
578
|
|
|
549
|
-
const preview = sample(categoryPreset, categoryEmoji, dateFormat, template)
|
|
579
|
+
const preview = sample(categoryPreset, categoryEmoji, dateFormat, template, titleLanguage)
|
|
550
580
|
return h(
|
|
551
581
|
'div',
|
|
552
582
|
{ style: SETTINGS_STYLE.page },
|
|
@@ -568,6 +598,8 @@ window.__ModuleLoader__.load({
|
|
|
568
598
|
h('div', { style: SETTINGS_STYLE.sectionTitle }, readText('format')),
|
|
569
599
|
row('preset', readText('categoryLanguage'), readText('categoryLanguageHint'),
|
|
570
600
|
segment([{ value: 'zh', label: '中文' }, { value: 'en', label: 'English' }], categoryPreset, setCategoryPreset)),
|
|
601
|
+
row('language', readText('titleLanguage'), readText('titleLanguageHint'),
|
|
602
|
+
segment([{ value: 'auto', label: readText('langAuto') }, { value: 'zh', label: readText('langZh') }, { value: 'en', label: readText('langEn') }], titleLanguage, setTitleLanguage)),
|
|
571
603
|
row('emoji', readText('categoryEmoji'), readText('categoryEmojiHint'), toggle(categoryEmoji, setCategoryEmoji, readText('categoryEmoji'))),
|
|
572
604
|
row('date', readText('dateFormat'), readText('dateFormatHint'),
|
|
573
605
|
segment([{ value: 'MMDD', label: 'MMDD' }, { value: 'YYMM', label: 'YYMM' }, { value: 'YYYYMMDD', label: 'YYYYMMDD' }], dateFormat, setDateFormat)),
|
|
@@ -588,6 +620,7 @@ window.__ModuleLoader__.load({
|
|
|
588
620
|
? h('div', null,
|
|
589
621
|
row('nameChars', readText('nameLimit'), readText('nameLimitHint'), number(nameChars, setNameChars, 4, 40, readText('chars'))),
|
|
590
622
|
row('recent', readText('recentMessages'), readText('recentMessagesHint'), number(recentMessages, setRecentMessages, 2, 20, readText('messages'))),
|
|
623
|
+
row('bytes', readText('maxBytes'), readText('maxBytesHint'), number(maxTitleBytes, setMaxTitleBytes, 1, 80, readText('bytes'))),
|
|
591
624
|
h('div', { style: { ...SETTINGS_STYLE.desc, marginTop: '8px' } }, readText('advancedHint')),
|
|
592
625
|
)
|
|
593
626
|
: null,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/format.js
CHANGED
|
@@ -177,6 +177,7 @@ export function resolveSettings(raw, serviceMaxBytes) {
|
|
|
177
177
|
? [...new Set(config.categories.map((item) => String(item).trim()).filter(Boolean))]
|
|
178
178
|
: []
|
|
179
179
|
const categoryPreset = config.categoryPreset === 'en' ? 'en' : 'zh'
|
|
180
|
+
const titleLanguage = config.titleLanguage === 'zh' || config.titleLanguage === 'en' ? config.titleLanguage : 'auto'
|
|
180
181
|
const categories =
|
|
181
182
|
configured.length > 0
|
|
182
183
|
? configured.slice(0, 24)
|
|
@@ -205,6 +206,7 @@ export function resolveSettings(raw, serviceMaxBytes) {
|
|
|
205
206
|
|
|
206
207
|
return Object.freeze({
|
|
207
208
|
categoryPreset,
|
|
209
|
+
titleLanguage,
|
|
208
210
|
// Legacy message-count cadence. The turn/end listener uses it only when
|
|
209
211
|
// refreshOnTurnEnd is explicitly false.
|
|
210
212
|
retitleEvery,
|
|
@@ -601,7 +603,11 @@ export function buildSystemPrompt(settings, hasPreviousTitle) {
|
|
|
601
603
|
hints,
|
|
602
604
|
'',
|
|
603
605
|
'名称规则:',
|
|
604
|
-
|
|
606
|
+
settings.titleLanguage === 'zh'
|
|
607
|
+
? '- 名称必须使用中文(必要的英文技术名词可以保留);6-18 个汉字;'
|
|
608
|
+
: settings.titleLanguage === 'en'
|
|
609
|
+
? '- 名称必须使用英文(必要的专有名词可以保留);不超过 10 个词;'
|
|
610
|
+
: '- 与对话主要语言一致;中文 6-18 个汉字,非中文不超过 10 个词;',
|
|
605
611
|
'- 概括会话的主要主题或任务,不要只复述问候、客套或「继续」;',
|
|
606
612
|
'- 不要包含日期、分类名、竖线 |、引号、换行、Markdown、文件路径或命令;',
|
|
607
613
|
'- 信息不足时,按用户输入的主题起一个简短名称,不要解释。',
|
package/lib/index.js
CHANGED
|
@@ -38,6 +38,9 @@ const PrefsSchema = Schema.object({
|
|
|
38
38
|
categoryEmoji: Schema.boolean()
|
|
39
39
|
.default(false)
|
|
40
40
|
.description('给分类加 emoji 前缀,例如 ⚡ 优化'),
|
|
41
|
+
titleLanguage: Schema.union([Schema.const('auto'), Schema.const('zh'), Schema.const('en')])
|
|
42
|
+
.default('auto')
|
|
43
|
+
.description('标题名称语言:auto 跟随对话 / zh 中文 / en English'),
|
|
41
44
|
dateFormat: Schema.union([Schema.const('MMDD'), Schema.const('YYMM'), Schema.const('YYYYMMDD')])
|
|
42
45
|
.default('MMDD')
|
|
43
46
|
.description('{date} 使用日期格式'),
|
|
@@ -59,6 +62,9 @@ const PrefsSchema = Schema.object({
|
|
|
59
62
|
maxNameChars: Schema.natural()
|
|
60
63
|
.default(20)
|
|
61
64
|
.description('名称最大字符数'),
|
|
65
|
+
maxTitleBytes: Schema.natural()
|
|
66
|
+
.default(80)
|
|
67
|
+
.description('标题最大字节数'),
|
|
62
68
|
recentMessages: Schema.natural()
|
|
63
69
|
.default(8)
|
|
64
70
|
.description('标题请求包含的最近消息数'),
|
|
@@ -69,7 +75,6 @@ const LimitsSchema = Schema.object({
|
|
|
69
75
|
.default([])
|
|
70
76
|
.hidden(true)
|
|
71
77
|
.description('自定义分类词表,覆盖 categoryPreset'),
|
|
72
|
-
maxTitleBytes: Schema.natural().default(80).hidden(true),
|
|
73
78
|
maxInputBytes: Schema.natural().default(4096).hidden(true),
|
|
74
79
|
maxOutputTokens: Schema.natural().default(4096).hidden(true),
|
|
75
80
|
timeoutMs: Schema.natural().default(90000).hidden(true),
|
package/market/index.json
CHANGED
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"zh": "会话标题印章"
|
|
35
35
|
},
|
|
36
36
|
"description": {
|
|
37
|
-
"en": "Keeps DSH session titles in DATE | CATEGORY | NAME with turn-aware auto-retitle, a settings page, and hover duration/cost/token stats.",
|
|
38
|
-
"zh": "把 DSH 会话标题固定为「日期 | 分类 |
|
|
37
|
+
"en": "Keeps DSH session titles in DATE | CATEGORY | NAME with turn-aware auto-retitle, a settings page, title-language control, and hover duration/cost/token stats.",
|
|
38
|
+
"zh": "把 DSH 会话标题固定为「日期 | 分类 | 名称」,支持自动重算、设置页、标题语言,以及悬停查看耗时/估算成本/token。"
|
|
39
39
|
},
|
|
40
40
|
"author": "xuedipiaofei",
|
|
41
41
|
"icon": "../icon.svg",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
},
|
|
58
58
|
"versions": [
|
|
59
59
|
{
|
|
60
|
-
"version": "0.
|
|
61
|
-
"publishTimestamp":
|
|
60
|
+
"version": "0.8.1",
|
|
61
|
+
"publishTimestamp": 1794290201,
|
|
62
62
|
"source": {
|
|
63
63
|
"type": "git",
|
|
64
64
|
"url": "https://github.com/xuedipiaofei/dsh-session-title-stamp",
|
|
65
|
-
"commit": "
|
|
65
|
+
"commit": "36c98fdbd0233ed12fbc0e7e6868f8bdf8457726"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"dsh": ">=0.2.1-rc.3 <0.3.0"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-title-stamp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DSH session titles in a DATE | CATEGORY | NAME template, with turn-aware auto-generation, a settings page, and hover duration/cost/token stats.",
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "DSH session titles in a DATE | CATEGORY | NAME template, with turn-aware auto-generation, a settings page, title-language control, and hover duration/cost/token stats.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"dsh-plugin",
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
"README.md",
|
|
37
37
|
"README.zh.md",
|
|
38
38
|
"docs/0.7.0-settings-mock.png",
|
|
39
|
-
"docs/0.7.0-hover-card-mock.png"
|
|
39
|
+
"docs/0.7.0-hover-card-mock.png",
|
|
40
|
+
"docs/screenshots/01-session-list.png",
|
|
41
|
+
"docs/screenshots/02-settings.png",
|
|
42
|
+
"docs/screenshots/03-hover-stats.png"
|
|
40
43
|
],
|
|
41
44
|
"engines": {
|
|
42
45
|
"dsh": ">=0.2.1-rc.3 <0.3.0"
|