@cmach_socket/opencode-qq-bot 0.8.0 → 0.9.2

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.
Files changed (39) hide show
  1. package/NOTICE +48 -15
  2. package/README.md +130 -398
  3. package/config.example.json +12 -0
  4. package/package.json +11 -1
  5. package/src/cleanup.ts +1 -0
  6. package/src/config/fields.ts +780 -0
  7. package/src/config/live.ts +189 -0
  8. package/src/config/registry.ts +654 -0
  9. package/src/config/store.ts +175 -0
  10. package/src/config/types.ts +253 -0
  11. package/src/config.ts +77 -1023
  12. package/src/diary/scheduler.ts +39 -1
  13. package/src/emoji/collection.ts +289 -0
  14. package/src/emoji/favorite-index.ts +40 -3
  15. package/src/emoji/favorites.ts +7 -1
  16. package/src/home.ts +11 -16
  17. package/src/index.ts +117 -25
  18. package/src/logger.ts +104 -1
  19. package/src/naplink/client.ts +16 -0
  20. package/src/panel/api.ts +345 -0
  21. package/src/panel/auth.ts +65 -0
  22. package/src/panel/models.ts +56 -0
  23. package/src/panel/runtime.ts +51 -0
  24. package/src/panel/server.ts +220 -0
  25. package/src/panel/status.ts +201 -0
  26. package/src/rate-limit.ts +46 -0
  27. package/src/sensitive.ts +6 -1
  28. package/src/session/manager.ts +4 -3
  29. package/src/tools/qq.ts +83 -10
  30. package/web/dist/assets/index-7eMQEM7-.css +1 -0
  31. package/web/dist/assets/index-DCkgUY7y.js +15 -0
  32. package/web/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  33. package/web/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  34. package/web/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  35. package/web/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  36. package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  37. package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  38. package/web/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  39. package/web/dist/index.html +13 -0
@@ -0,0 +1,780 @@
1
+ /**
2
+ * 配置项注册表:全局配置的唯一事实源。
3
+ *
4
+ * 每个配置项在这里声明一次,别的模块(默认值、zod 校验、配置文件键集合、
5
+ * JSON Schema、面板表单)都由它生成,不再各写一份。
6
+ */
7
+
8
+ /** 配置项的值类型,决定前端渲染成哪种控件。 */
9
+ export type FieldType =
10
+ | "boolean"
11
+ | "number"
12
+ | "text"
13
+ | "secret"
14
+ | "enum"
15
+ | "numberList"
16
+ | "stringList"
17
+ | "clock"
18
+ | "modelRef"
19
+ | "path"
20
+
21
+ /** 单个配置项的元数据。 */
22
+ export interface ConfigField {
23
+ /** 配置路径,例如 `rateLimit.maxPerMinute`。 */
24
+ path: string
25
+ /** 所属分组,用于表单导航。 */
26
+ group: string
27
+ /** 值的类型,决定前端渲染成哪种控件。 */
28
+ type: FieldType
29
+ /** 中文标签。 */
30
+ label: string
31
+ /** 补充说明。 */
32
+ description?: string
33
+ /** 默认值;`undefined` 表示可以不配置。 */
34
+ default: unknown
35
+ /** 数值下限。 */
36
+ min?: number
37
+ /** 数值上限。 */
38
+ max?: number
39
+ /** 数值步长;`1` 表示只接受整数。 */
40
+ step?: number
41
+ /** 枚举候选值。 */
42
+ options?: readonly string[]
43
+ /** 是否属于敏感字段:不回显、掩码显示。 */
44
+ secret?: boolean
45
+ /** 是否必填:必填项不能删掉,删了配置就装不起来。 */
46
+ required?: boolean
47
+ /** 保存后是否可以立即生效,不必重启。 */
48
+ hot?: boolean
49
+ /** 下限是否取不到:`min` 变成排他下界。 */
50
+ exclusiveMin?: boolean
51
+ }
52
+
53
+ /** 配置分组:表单左侧导航。 */
54
+ export interface ConfigGroup {
55
+ /** 分组 id,与 `ConfigField.group` 对应。 */
56
+ id: string
57
+ /** 分组名称。 */
58
+ label: string
59
+ }
60
+
61
+ /** 分组顺序与名称。 */
62
+ export const CONFIG_GROUPS: readonly ConfigGroup[] = [
63
+ { id: "general", label: "基础" },
64
+ { id: "napcat", label: "NapCat 连接" },
65
+ { id: "access", label: "准入" },
66
+ { id: "proactive", label: "主动说话" },
67
+ { id: "wake", label: "唤醒" },
68
+ { id: "reply", label: "回复" },
69
+ { id: "rateLimit", label: "出站限流" },
70
+ { id: "sensitive", label: "敏感拦截" },
71
+ { id: "events", label: "事件订阅" },
72
+ { id: "reminder", label: "补发提醒" },
73
+ { id: "history", label: "历史补齐" },
74
+ { id: "keepAlive", label: "保活" },
75
+ { id: "trace", label: "调用链追踪" },
76
+ { id: "log", label: "日志" },
77
+ { id: "media", label: "出站媒体" },
78
+ { id: "diary", label: "日记" },
79
+ { id: "panel", label: "状态面板" },
80
+ ]
81
+
82
+ /** 全部配置项。 */
83
+ export const CONFIG_FIELDS: readonly ConfigField[] = [
84
+ // 基础
85
+ {
86
+ path: "ownerQQ",
87
+ group: "general",
88
+ type: "number",
89
+ label: "所有者 QQ 号",
90
+ description: "管理命令只在它的私聊生效;该私聊始终放行",
91
+ default: undefined,
92
+ min: 1,
93
+ step: 1,
94
+ hot: true,
95
+ },
96
+ {
97
+ path: "admins",
98
+ group: "general",
99
+ type: "numberList",
100
+ label: "管理员 QQ 号",
101
+ description: "拥有全部工具权限;私聊还需在放行名单里",
102
+ default: [],
103
+ hot: true,
104
+ },
105
+ {
106
+ path: "model",
107
+ group: "general",
108
+ type: "modelRef",
109
+ label: "会话使用的模型",
110
+ description: "格式 provider/model[/variant];留空跟随 OpenCode 的默认模型",
111
+ default: undefined,
112
+ },
113
+ {
114
+ path: "sendDelayMs",
115
+ group: "general",
116
+ type: "number",
117
+ label: "分段发送间隔(毫秒)",
118
+ description: "超长消息拆成多段时每段之间的固定间隔",
119
+ default: 1000,
120
+ min: 0,
121
+ },
122
+ {
123
+ path: "warnLength",
124
+ group: "general",
125
+ type: "number",
126
+ label: "长度告警阈值",
127
+ description: "单次发送的内容超过该字数时告警,不截断",
128
+ default: 500,
129
+ min: 1,
130
+ step: 1,
131
+ hot: true,
132
+ },
133
+ {
134
+ path: "reuseSession",
135
+ group: "general",
136
+ type: "boolean",
137
+ label: "复用上一次的会话",
138
+ description: "完全没有绑定时,按会话标记找回上一次的会话",
139
+ default: false,
140
+ hot: true,
141
+ },
142
+ {
143
+ path: "toolProfilesPath",
144
+ group: "general",
145
+ type: "path",
146
+ label: "工具配置文件路径",
147
+ description: "空表示工作目录里的 tool-profiles.json;相对路径按工作目录解析",
148
+ default: "",
149
+ },
150
+ {
151
+ path: "chatOverridesPath",
152
+ group: "general",
153
+ type: "path",
154
+ label: "会话覆盖文件路径",
155
+ description: "空表示工作目录里的 chat-overrides.json;相对路径按工作目录解析",
156
+ default: "",
157
+ },
158
+ {
159
+ path: "soulPath",
160
+ group: "general",
161
+ type: "path",
162
+ label: "角色设定路径",
163
+ description: "留空表示工作目录里的 souls/",
164
+ default: undefined,
165
+ },
166
+ {
167
+ path: "soulName",
168
+ group: "general",
169
+ type: "text",
170
+ label: "角色设定文件名",
171
+ description: "工作目录 souls 里的角色设定文件名",
172
+ default: undefined,
173
+ },
174
+
175
+ // NapCat
176
+ {
177
+ path: "napcat.url",
178
+ group: "napcat",
179
+ type: "text",
180
+ label: "NapCat WebSocket 地址",
181
+ description: "正向 WebSocket 地址,必填",
182
+ default: undefined,
183
+ required: true,
184
+ },
185
+ {
186
+ path: "napcat.token",
187
+ group: "napcat",
188
+ type: "secret",
189
+ label: "NapCat 访问令牌",
190
+ description: "NapCat 的访问令牌,留空表示不校验",
191
+ default: undefined,
192
+ secret: true,
193
+ },
194
+
195
+ // 准入
196
+ {
197
+ path: "access.allow.groups",
198
+ group: "access",
199
+ type: "numberList",
200
+ label: "放行的群号",
201
+ description: "为空时不响应任何群消息(除非打开 allowAllWhenEmpty)",
202
+ default: [],
203
+ hot: true,
204
+ },
205
+ {
206
+ path: "access.allow.users",
207
+ group: "access",
208
+ type: "numberList",
209
+ label: "放行的私聊 QQ 号",
210
+ description: "为空时不响应任何私聊(除非打开 allowAllWhenEmpty)",
211
+ default: [],
212
+ hot: true,
213
+ },
214
+ {
215
+ path: "access.deny.groups",
216
+ group: "access",
217
+ type: "numberList",
218
+ label: "拒绝的群号",
219
+ description: "优先于放行名单",
220
+ default: [],
221
+ hot: true,
222
+ },
223
+ {
224
+ path: "access.deny.users",
225
+ group: "access",
226
+ type: "numberList",
227
+ label: "拒绝的私聊 QQ 号",
228
+ description: "优先于放行名单;owner 的私聊会被豁免",
229
+ default: [],
230
+ hot: true,
231
+ },
232
+ {
233
+ path: "access.allowAllWhenEmpty",
234
+ group: "access",
235
+ type: "boolean",
236
+ label: "放行名单为空时放行全部",
237
+ description: "打开后任何群聊与私聊都能触发机器人",
238
+ default: false,
239
+ hot: true,
240
+ },
241
+
242
+ // 主动说话
243
+ {
244
+ path: "proactive.enabled",
245
+ group: "proactive",
246
+ type: "boolean",
247
+ label: "启用主动说话",
248
+ description: "沉默达到阈值后由机器人主动发起话题",
249
+ default: true,
250
+ },
251
+ {
252
+ path: "proactive.silenceThresholdSeconds",
253
+ group: "proactive",
254
+ type: "number",
255
+ label: "沉默阈值(秒)",
256
+ description: "群沉默多久后才开始计算主动说话概率",
257
+ default: 10800,
258
+ min: 0,
259
+ },
260
+ {
261
+ path: "proactive.startProbability",
262
+ group: "proactive",
263
+ type: "number",
264
+ label: "起始概率",
265
+ description: "刚跨过阈值时的单次触发概率",
266
+ default: 0.01,
267
+ min: 0,
268
+ max: 1,
269
+ },
270
+ {
271
+ path: "proactive.probabilityPerHour",
272
+ group: "proactive",
273
+ type: "number",
274
+ label: "每小时概率增量",
275
+ description: "每多沉默一小时概率增加多少",
276
+ default: 0.05,
277
+ min: 0,
278
+ max: 1,
279
+ },
280
+ {
281
+ path: "proactive.tickSeconds",
282
+ group: "proactive",
283
+ type: "number",
284
+ label: "心跳间隔(秒)",
285
+ description: "主动说话心跳的轮询间隔,必须大于 0",
286
+ default: 3600,
287
+ min: 0,
288
+ exclusiveMin: true,
289
+ },
290
+ {
291
+ path: "proactive.allowGroups",
292
+ group: "proactive",
293
+ type: "numberList",
294
+ label: "主动说话的群号",
295
+ description: "留空表示一个都不主动说话",
296
+ default: [],
297
+ },
298
+ {
299
+ path: "proactive.allowUsers",
300
+ group: "proactive",
301
+ type: "numberList",
302
+ label: "主动说话的私聊 QQ 号",
303
+ description: "留空表示一个都不主动说话",
304
+ default: [],
305
+ },
306
+
307
+ // 唤醒
308
+ {
309
+ path: "wake.prefixes",
310
+ group: "wake",
311
+ type: "stringList",
312
+ label: "全局唤醒前缀",
313
+ description: "消息以这些前缀开头就必须回复",
314
+ default: ["/"],
315
+ hot: true,
316
+ },
317
+ {
318
+ path: "wake.ignoreAtAll",
319
+ group: "wake",
320
+ type: "boolean",
321
+ label: "忽略 @全体成员",
322
+ description: "群里 @ 全体成员时不唤醒机器人",
323
+ default: true,
324
+ hot: true,
325
+ },
326
+ {
327
+ path: "wake.replyToSelf",
328
+ group: "wake",
329
+ type: "boolean",
330
+ label: "回复机器人自己也要回",
331
+ description: "回复了机器人自己的消息时必须回复",
332
+ default: true,
333
+ hot: true,
334
+ },
335
+ {
336
+ path: "wake.ignoreAtOthers",
337
+ group: "wake",
338
+ type: "boolean",
339
+ label: "忽略 @他人",
340
+ description: "群里第一个 @ 指向别人时不唤醒机器人",
341
+ default: true,
342
+ hot: true,
343
+ },
344
+
345
+ // 回复
346
+ {
347
+ path: "reply.minDelayMs",
348
+ group: "reply",
349
+ type: "number",
350
+ label: "分段延迟下限(毫秒)",
351
+ description: "分段之间随机等待的下限",
352
+ default: 0,
353
+ min: 0,
354
+ hot: true,
355
+ },
356
+ {
357
+ path: "reply.maxDelayMs",
358
+ group: "reply",
359
+ type: "number",
360
+ label: "分段延迟上限(毫秒)",
361
+ description: "分段之间随机等待的上限,0 表示用固定间隔",
362
+ default: 0,
363
+ min: 0,
364
+ hot: true,
365
+ },
366
+ {
367
+ path: "reply.segmentChars",
368
+ group: "reply",
369
+ type: "number",
370
+ label: "单段字数上限",
371
+ description: "单条消息超过该字数就拆成多段发送",
372
+ default: 150,
373
+ min: 1,
374
+ step: 1,
375
+ hot: true,
376
+ },
377
+ {
378
+ path: "reply.forwardThresholdChars",
379
+ group: "reply",
380
+ type: "number",
381
+ label: "合并转发阈值",
382
+ description: "单条回复超过该字数就改用合并转发,0 表示关闭",
383
+ default: 1500,
384
+ min: 0,
385
+ hot: true,
386
+ },
387
+ {
388
+ path: "reply.requirePermission",
389
+ group: "reply",
390
+ type: "boolean",
391
+ label: "回复前先说明理由",
392
+ description: "群里发消息前模型要先说明为什么要回复",
393
+ default: true,
394
+ hot: true,
395
+ },
396
+
397
+ // 出站限流
398
+ {
399
+ path: "rateLimit.maxPerMinute",
400
+ group: "rateLimit",
401
+ type: "number",
402
+ label: "每分钟最多发多少条",
403
+ description: "0 表示不限制",
404
+ default: 8,
405
+ min: 0,
406
+ hot: true,
407
+ },
408
+ {
409
+ path: "rateLimit.maxPerHour",
410
+ group: "rateLimit",
411
+ type: "number",
412
+ label: "每小时最多发多少条",
413
+ description: "0 表示不限制",
414
+ default: 60,
415
+ min: 0,
416
+ hot: true,
417
+ },
418
+ {
419
+ path: "rateLimit.minGapMs",
420
+ group: "rateLimit",
421
+ type: "number",
422
+ label: "发送最小间隔(毫秒)",
423
+ description: "相邻两次发送之间的最小间隔,0 表示不限制",
424
+ default: 1500,
425
+ min: 0,
426
+ hot: true,
427
+ },
428
+ {
429
+ path: "rateLimit.stall",
430
+ group: "rateLimit",
431
+ type: "boolean",
432
+ label: "触顶后等窗口结束",
433
+ description: "打开后等窗口结束再发,而不是直接拒绝",
434
+ default: false,
435
+ hot: true,
436
+ },
437
+ {
438
+ path: "rateLimit.stallMaxWaitMs",
439
+ group: "rateLimit",
440
+ type: "number",
441
+ label: "最多等多久(毫秒)",
442
+ description: "等待窗口结束的上限,超过就直接拒绝",
443
+ default: 60000,
444
+ min: 0,
445
+ hot: true,
446
+ },
447
+
448
+ // 敏感拦截
449
+ {
450
+ path: "sensitive.enabled",
451
+ group: "sensitive",
452
+ type: "boolean",
453
+ label: "拦截敏感出站消息",
454
+ description: "命中凭证的出站消息整条拦下,不发送",
455
+ default: true,
456
+ hot: true,
457
+ },
458
+
459
+ // 事件订阅
460
+ {
461
+ path: "events.subscribe",
462
+ group: "events",
463
+ type: "stringList",
464
+ label: "订阅的事件类别",
465
+ description: "message / notice,写错的类别会被忽略并告警",
466
+ default: ["message"],
467
+ hot: true,
468
+ },
469
+ {
470
+ path: "events.notices",
471
+ group: "events",
472
+ type: "stringList",
473
+ label: "关心的通知",
474
+ description: "留空表示这类通知全收",
475
+ default: [],
476
+ hot: true,
477
+ },
478
+ {
479
+ path: "events.inject",
480
+ group: "events",
481
+ type: "boolean",
482
+ label: "通知注入会话上下文",
483
+ description: "通知以附带信息出现在下一轮上下文里",
484
+ default: true,
485
+ hot: true,
486
+ },
487
+
488
+ // 补发提醒
489
+ {
490
+ path: "reminder.enabled",
491
+ group: "reminder",
492
+ type: "boolean",
493
+ label: "提醒模型补发",
494
+ description: "模型一轮没调用发送工具时提醒它补一次",
495
+ default: true,
496
+ hot: true,
497
+ },
498
+ {
499
+ path: "reminder.max",
500
+ group: "reminder",
501
+ type: "number",
502
+ label: "连续提醒次数上限",
503
+ description: "避免模型陷入补发循环",
504
+ default: 2,
505
+ min: 0,
506
+ step: 1,
507
+ hot: true,
508
+ },
509
+
510
+ // 历史补齐
511
+ {
512
+ path: "history.count",
513
+ group: "history",
514
+ type: "number",
515
+ label: "补齐多少条历史",
516
+ description: "新建会话时补齐的历史消息条数,0 表示关闭",
517
+ default: 20,
518
+ min: 0,
519
+ hot: true,
520
+ },
521
+
522
+ // 保活
523
+ {
524
+ path: "keepAlive.enabled",
525
+ group: "keepAlive",
526
+ type: "boolean",
527
+ label: "启用保活心跳",
528
+ description: "周期性写回会话元数据,避免被 OpenCode 空闲卸载",
529
+ default: true,
530
+ },
531
+ {
532
+ path: "keepAlive.seconds",
533
+ group: "keepAlive",
534
+ type: "number",
535
+ label: "保活间隔(秒)",
536
+ description: "必须小于 OpenCode 的 location 空闲超时",
537
+ default: 1200,
538
+ min: 0,
539
+ exclusiveMin: true,
540
+ },
541
+
542
+ // 调用链追踪
543
+ {
544
+ path: "trace.enabled",
545
+ group: "trace",
546
+ type: "boolean",
547
+ label: "记录调用链追踪",
548
+ description: "一条入站消息的完整处理链",
549
+ default: true,
550
+ },
551
+ {
552
+ path: "trace.dir",
553
+ group: "trace",
554
+ type: "path",
555
+ label: "追踪文件目录",
556
+ description: "留空表示与日志同目录",
557
+ default: "",
558
+ },
559
+ {
560
+ path: "trace.maxSizeMb",
561
+ group: "trace",
562
+ type: "number",
563
+ label: "追踪容量上限(MB)",
564
+ description: "追踪文件总容量上限",
565
+ default: 80,
566
+ min: 0,
567
+ exclusiveMin: true,
568
+ },
569
+ {
570
+ path: "trace.retentionDays",
571
+ group: "trace",
572
+ type: "number",
573
+ label: "追踪保留天数",
574
+ description: "超过保留天数的追踪文件会被删除",
575
+ default: 7,
576
+ min: 1,
577
+ step: 1,
578
+ },
579
+
580
+ // 日志
581
+ {
582
+ path: "log.level",
583
+ group: "log",
584
+ type: "enum",
585
+ label: "日志级别",
586
+ description: "debug / info / warn / error",
587
+ default: "info",
588
+ options: ["debug", "info", "warn", "error"],
589
+ hot: true,
590
+ },
591
+ {
592
+ path: "log.dir",
593
+ group: "log",
594
+ type: "path",
595
+ label: "日志目录",
596
+ description: "留空表示用 XDG 状态目录",
597
+ default: "",
598
+ },
599
+ {
600
+ path: "log.maxSize",
601
+ group: "log",
602
+ type: "text",
603
+ label: "单个日志文件大小上限",
604
+ description: "winston 的文件大小写法,例如 5m",
605
+ default: "5m",
606
+ },
607
+ {
608
+ path: "log.maxFiles",
609
+ group: "log",
610
+ type: "number",
611
+ label: "保留历史日志份数",
612
+ description: "按天轮转后最多保留多少份",
613
+ default: 5,
614
+ min: 1,
615
+ step: 1,
616
+ },
617
+
618
+ // 出站媒体
619
+ {
620
+ path: "media.allowedDirs",
621
+ group: "media",
622
+ type: "stringList",
623
+ label: "额外允许的媒体目录",
624
+ description: "除工作目录与媒体目录外,额外放开可发送媒体的目录",
625
+ default: [],
626
+ },
627
+
628
+ // 日记
629
+ {
630
+ path: "diary.path",
631
+ group: "diary",
632
+ type: "path",
633
+ label: "日记目录",
634
+ description: "留空表示工作目录下的 diary/;相对路径按工作目录解析",
635
+ default: "",
636
+ },
637
+ {
638
+ path: "diary.enabled",
639
+ group: "diary",
640
+ type: "boolean",
641
+ label: "启用日记",
642
+ description: "把聊天流水记成 Markdown 文件",
643
+ default: true,
644
+ },
645
+ {
646
+ path: "diary.retentionDays",
647
+ group: "diary",
648
+ type: "number",
649
+ label: "素材保留天数",
650
+ description: "只清素材,不清日记成品",
651
+ default: 30,
652
+ min: 1,
653
+ step: 1,
654
+ },
655
+ {
656
+ path: "diary.summaryTime",
657
+ group: "diary",
658
+ type: "clock",
659
+ label: "每天几点生成总结",
660
+ description: "本地时间 HH:mm",
661
+ default: "23:30",
662
+ },
663
+ {
664
+ path: "diary.tickSeconds",
665
+ group: "diary",
666
+ type: "number",
667
+ label: "调度间隔(秒)",
668
+ description: "日记调度的轮询间隔",
669
+ default: 3600,
670
+ min: 0,
671
+ exclusiveMin: true,
672
+ },
673
+ {
674
+ path: "diary.summaryTargets",
675
+ group: "diary",
676
+ type: "stringList",
677
+ label: "生成总结的聊天",
678
+ description: "group:123 / private:456;留空表示按准入名单推导",
679
+ default: [],
680
+ },
681
+ {
682
+ path: "diary.push",
683
+ group: "diary",
684
+ type: "enum",
685
+ label: "日记推送给谁",
686
+ description: "owner 推给所有者,group 推回聊天,none 不推",
687
+ default: "owner",
688
+ options: ["owner", "group", "none"],
689
+ },
690
+ {
691
+ path: "diary.backfill",
692
+ group: "diary",
693
+ type: "boolean",
694
+ label: "回补历史聊天",
695
+ description: "用 NapCat 的历史消息回补素材",
696
+ default: false,
697
+ },
698
+ {
699
+ path: "diary.backfillMax",
700
+ group: "diary",
701
+ type: "number",
702
+ label: "回补最多取多少条",
703
+ description: "回补时最多取多少条历史消息",
704
+ default: 1000,
705
+ min: 0,
706
+ exclusiveMin: true,
707
+ },
708
+ {
709
+ path: "diary.maxLineChars",
710
+ group: "diary",
711
+ type: "number",
712
+ label: "单条素材字数上限",
713
+ description: "单条素材的最大字符数",
714
+ default: 200,
715
+ min: 0,
716
+ exclusiveMin: true,
717
+ },
718
+ {
719
+ path: "diary.maxLinesPerDay",
720
+ group: "diary",
721
+ type: "number",
722
+ label: "每天最多保留多少条素材",
723
+ description: "单个聊天单天的素材条数上限",
724
+ default: 2000,
725
+ min: 0,
726
+ exclusiveMin: true,
727
+ },
728
+ {
729
+ path: "diary.timeoutMs",
730
+ group: "diary",
731
+ type: "number",
732
+ label: "总结超时(毫秒)",
733
+ description: "等待模型生成总结的超时时间",
734
+ default: 120000,
735
+ min: 0,
736
+ exclusiveMin: true,
737
+ },
738
+
739
+ // 状态面板
740
+ {
741
+ path: "panel.enabled",
742
+ group: "panel",
743
+ type: "boolean",
744
+ label: "启用状态面板",
745
+ description: "面板自带 HTTP 服务,默认开启",
746
+ default: true,
747
+ hot: true,
748
+ },
749
+ {
750
+ path: "panel.host",
751
+ group: "panel",
752
+ type: "text",
753
+ label: "监听地址",
754
+ description: "默认只监听本机",
755
+ default: "127.0.0.1",
756
+ hot: true,
757
+ },
758
+ {
759
+ path: "panel.port",
760
+ group: "panel",
761
+ type: "number",
762
+ label: "监听端口",
763
+ description: "面板 HTTP 服务的端口",
764
+ default: 7391,
765
+ min: 1,
766
+ max: 65535,
767
+ step: 1,
768
+ hot: true,
769
+ },
770
+ {
771
+ path: "panel.token",
772
+ group: "panel",
773
+ type: "secret",
774
+ label: "访问令牌",
775
+ description: "留空时自动生成并写回配置文件",
776
+ default: "",
777
+ secret: true,
778
+ hot: true,
779
+ },
780
+ ]