chatluna-plugin-livingmemory 0.0.9 → 0.0.11

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 CHANGED
@@ -14,6 +14,8 @@ LivingMemory 不建议与原生 memory 同时启用,两者各自提取、保
14
14
  yarn build
15
15
  ```
16
16
 
17
+ 开发 WebUI 时,在插件目录运行 `yarn dev` 并保持运行,另开终端在模板项目根目录运行 `yarn start`。保存 `client/` 下的改动后,已打开的 LivingMemory 页面会自动更新。首次使用前先执行一次 `yarn build`;修改服务端或 Worker 后仍需重新构建并重启实例。
18
+
17
19
  ## 配套服务
18
20
 
19
21
  必需服务:
@@ -24,14 +26,14 @@ yarn build
24
26
 
25
27
  ## 对话规则
26
28
 
27
- 在 **对话规则 → 能力 → LivingMemory** 设置全局默认值,或为指定群、频道单独配置。私聊可按频道或路由 ID 配置。
29
+ 在 **对话规则 → 能力 → LivingMemory** 设置全局默认值,或为指定群、频道、用户私聊单独配置。私聊也支持按频道或路由 ID 匹配。
28
30
 
29
- 如果只想在指定群自动提取记忆,把全局的「从聊天中提取记忆的间隔」设为 `0`,再为这些群设置需要的消息条数。
31
+ 如果只想在某位用户的私聊中使用自动记忆,把全局的提取和召回间隔设为 `0`,关闭快照和画像注入;然后新建该用户的私聊规则,设置所需间隔并开启注入。该用户在群里发言时仍按群规则处理。
30
32
 
31
33
  | 配置项 | 配置键 | 默认值 | 说明 |
32
34
  | --- | --- | --- | --- |
33
35
  | 从聊天中提取记忆的间隔 | `extractionWindowMessages` | `60` | 按未提取的聊天消息条数计算(0—360);`0` 关闭自动提取。 |
34
- | 允许群友闲聊触发记忆提取 | `extractionIncludeOverheard` | `false` | 开启后,群友闲聊达到设定条数就能触发提取;关闭时,等 bot 回复后再检查。 |
36
+ | 允许群友闲聊触发记忆提取 | `extractionIncludeOverheard` | `false` | 仅用于群聊。开启后,群友闲聊达到设定条数就能触发提取;关闭时等 bot 回复后再检查。私聊始终在 bot 回复后检查。 |
35
37
  | 是否在提取新记忆后进行 Dream 整理 | `enableAutoDream` | `true` | 自动提取保存新记忆后,由 Dream 检查是否需要整理。 |
36
38
  | 记忆自动召回的间隔 | `recallIntervalMessages` | `20` | bot 发完一轮回复后,按新增聊天条数判断是否在后台召回;`0` 关闭自动召回。 |
37
39
  | 用于召回记忆的聊天消息数 | `recallHistoryMessages` | `20` | 召回从本轮 bot 的最后一条回复向前读取,包含该回复。画像注入使用相同条数,以本轮唤醒为截止点。 |
package/client/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Context } from 'cordis'
2
+ import './page.css'
2
3
  import zh from './locales/zh.yml'
3
4
  import en from './locales/en.yml'
4
5
  import type {} from '../src/contracts/webui_live.ts'
@@ -79,10 +79,14 @@ jobs.dreamRunning: 'Dream is already running for “{preset}”'
79
79
  jobs.dreamInsufficient: 'Not enough memories in “{preset}” to run Dream'
80
80
  jobs.rebuildIndex: Rebuild vector index
81
81
  jobs.empty: No jobs recorded yet
82
- job.kind.extract: Extract
82
+ jobs.startedAt: Started
83
+ jobs.finishedAt: Finished
84
+ jobs.id: Job ID
85
+ jobs.detail: View original record
86
+ job.kind.extract: Memory extraction
83
87
  job.kind.dream: Dream
84
- job.kind.recall: Recall
85
- job.kind.index: Index
88
+ job.kind.recall: Memory recall
89
+ job.kind.index: Index maintenance
86
90
  job.status.pending: Pending
87
91
  job.status.running: Running
88
92
  job.status.completed: Completed
@@ -106,6 +110,13 @@ tab.profiles: Profiles
106
110
  tab.snapshots: Snapshots
107
111
 
108
112
  profiles.empty: No user profile has been generated for this preset
113
+ profiles.directory: User directory
114
+ profiles.linkedMemories: Linked memories
115
+ profiles.search: Search by name or user ID
116
+ profiles.clearSearch: Clear search
117
+ profiles.noMatch: No matching users
118
+ profiles.noMemories: This profile has no linked memories.
119
+ profiles.unavailableMemories: 'Linked memories no longer available: {count}.'
109
120
  profiles.hint: The profile is distilled from linked memories; once saved it is no longer overwritten automatically.
110
121
  profiles.sourceCount: '{count} linked memories'
111
122
  profiles.regenerate: Regenerate
@@ -140,7 +151,7 @@ guide.models.title: Choose your models
140
151
  guide.models.text: Under Plugin configuration → Model configuration, choose a main model that supports tool calls. It extracts and organizes memories and updates user profiles and persona cards. The recall model decides whether to look up memories. The embedding model converts memories and queries into vectors so the plugin can compare their meanings. An optional reranker reorders the candidate memories by their relevance to the query. Select Save settings to apply these choices to all presets in this plugin instance.
141
152
  guide.openSettings: Open plugin configuration
142
153
  guide.rules.title: Choose which conversations use automatic extraction
143
- guide.rules.text: Open Conversation rules → Capabilities → LivingMemory and set the extraction interval. The default is 60 chat messages. To enable automatic extraction in just one group, set the global interval to 0 and that group’s interval to 60.
154
+ guide.rules.text: Open Conversation rules → Capabilities → LivingMemory and set the extraction interval. The default is 60 chat messages. To enable automatic extraction in just one group or one user’s private chat, set the global interval to 0 and the interval for that group or private chat to 60.
144
155
  guide.check.title: Try a search with one memory
145
156
  guide.check.text: Under Memories, select New memory, choose a preset, and save “I drink my coffee without sugar.” Under Recall test for the same preset, search for “How do I like my coffee?” to see the matches. The test leaves snapshots unchanged. Under Snapshots you can read the snapshot from an actual chat. Expand Recall details to see the search terms and matching memories.
146
157
  guide.timing: When extraction and recall run
@@ -150,7 +161,7 @@ guide.context: Snapshots and user profiles
150
161
  guide.interval.title: How does the recall interval differ from the history length?
151
162
  guide.interval.text: The bot checks after it finishes sending a reply. It recalls after the first reply, then waits until enough new messages have accumulated. Set the interval to 0 to disable automatic recall. The history length sets how many messages to read, up to and including the final part of the reply, to prepare a snapshot for future turns. Both default to 20 messages.
152
163
  guide.overheard.title: When can chat between group members trigger extraction?
153
- guide.overheard.text: Overheard extraction is off by default. Group chatter alone will not trigger extraction. Once the bot replies, the plugin counts unprocessed messages up to that reply, including earlier chatter, and starts extraction if the interval has been reached. With overheard extraction on, group members can reach the threshold on their own without calling the bot or waiting for a reply.
164
+ guide.overheard.text: Overheard extraction applies only to groups and is off by default. When off, the plugin checks the threshold after the bot replies, counting earlier chatter too. When on, group chatter can trigger extraction as soon as it reaches the threshold. Private chats always check after the bot replies.
154
165
  guide.sharing.title: Can two groups using the same preset share a snapshot?
155
166
  guide.sharing.text: Each conversation has its own snapshot by default. To share one between two groups using the same preset, select preset sharing in both groups’ conversation rules. The groups share recall results; each still reads its own chat history and tracks its own recall interval. A group with conversation isolation enabled always uses its own snapshot and searches only its own and global memories within the preset.
156
167
  guide.profiles.title: How do I use existing user profiles in a chat?
@@ -26,7 +26,7 @@ guide.models.title: 配置模型
26
26
  guide.models.text: 在「插件配置 → 模型配置」选择模型。主模型需要支持工具调用,用于提取和整理记忆、更新人物画像和人设卡。召回模型判断当前聊天是否需要查找记忆。嵌入模型将记忆和查询文本转换为向量,供插件比较语义相似度。重排序模型是可选的:它根据查询与每条候选记忆的相关性,重新排列检索结果。点「保存设置」后,这些选择对当前插件实例的所有预设生效。
27
27
  guide.openSettings: 打开插件配置
28
28
  guide.rules.title: 选择在哪些对话中自动提取记忆
29
- guide.rules.text: 在「对话规则 → 能力 → LivingMemory」设置「从聊天中提取记忆的间隔」,默认是 60 条聊天消息。要只在某个群自动提取,把全局间隔设为 0,再把该群规则的间隔设为 60。
29
+ guide.rules.text: 在「对话规则 → 能力 → LivingMemory」设置「从聊天中提取记忆的间隔」,默认是 60 条聊天消息。要只在某个群或某位用户的私聊中自动提取,把全局间隔设为 0,再把对应群或用户私聊规则的间隔设为 60。
30
30
  guide.check.title: 用一条记忆试试检索
31
31
  guide.check.text: 在「记忆」页点「新建记忆」,选好预设,写下“我喝咖啡不加糖”并保存。到同一预设的「召回测试」搜索“我喜欢喝什么咖啡”,查看检索结果。测试不会更新快照。实际聊天的快照正文在「快照」页查看,展开「召回详情」可以看到搜索词和命中的记忆。
32
32
  guide.timing: 提取与召回的时机
@@ -36,7 +36,7 @@ guide.context: 快照与用户画像
36
36
  guide.interval.title: 「记忆自动召回的间隔」和「用于召回记忆的聊天消息数」有什么区别?
37
37
  guide.interval.text: bot 发完一轮回复后检查召回间隔。首次直接召回,之后累计够指定条数的新消息才再次召回;设为 0 会关闭自动召回。后者决定从 bot 最后一条回复(含)向前读多少条聊天,为后续对话准备快照。两项默认都是 20 条。
38
38
  guide.overheard.title: 群友之间的闲聊什么时候会触发提取?
39
- guide.overheard.text: 「允许群友闲聊触发记忆提取」默认关闭。等 bot 回复后,插件才检查未提取的消息是否达到设定条数,先前的闲聊也计入条数。开启后,即使 bot 没有参与,群友闲聊达到设定条数也会触发提取。
39
+ guide.overheard.text: 「允许群友闲聊触发记忆提取」仅用于群聊,默认关闭。关闭时,插件在 bot 回复后检查未提取的消息,先前的闲聊也计入条数。开启后,群友闲聊达到设定条数就会触发提取。私聊始终在 bot 回复后检查。
40
40
  guide.sharing.title: 同一预设下的两个群能共用快照吗?
41
41
  guide.sharing.text: 默认每个会话各用一份快照。要让同一预设下的两个群共用一份,在适用于这两个群的对话规则中,将「记忆快照的使用范围」设为「所有会话共享一个记忆快照」。两个群共享召回结果,仍各自读取聊天记录、计算召回间隔。开启「会话记忆隔离」后,这份规则涉及的会话各用独立快照。
42
42
  guide.profiles.title: 已经生成了用户画像,怎样在聊天中使用?
@@ -119,10 +119,14 @@ jobs.dreamRunning: 「{preset}」已有 Dream 在运行
119
119
  jobs.dreamInsufficient: 「{preset}」可整理的记忆不足
120
120
  jobs.rebuildIndex: 重建向量索引
121
121
  jobs.empty: 还没有任务记录
122
- job.kind.extract: 提取
123
- job.kind.dream: Dream
124
- job.kind.recall: 召回
125
- job.kind.index: 索引
122
+ jobs.startedAt: 开始
123
+ jobs.finishedAt: 结束
124
+ jobs.id: 任务 ID
125
+ jobs.detail: 查看原始记录
126
+ job.kind.extract: 记忆提取
127
+ job.kind.dream: Dream 整理
128
+ job.kind.recall: 记忆召回
129
+ job.kind.index: 索引维护
126
130
  job.status.pending: 排队中
127
131
  job.status.running: 运行中
128
132
  job.status.completed: 已完成
@@ -146,6 +150,13 @@ tab.profiles: 用户画像
146
150
  tab.snapshots: 快照
147
151
 
148
152
  profiles.empty: 还没有为这个预设生成过用户画像
153
+ profiles.directory: 用户目录
154
+ profiles.linkedMemories: 关联记忆
155
+ profiles.search: 搜索昵称或用户 ID
156
+ profiles.clearSearch: 清除搜索
157
+ profiles.noMatch: 没有找到匹配的用户
158
+ profiles.noMemories: 这份画像没有关联记忆。
159
+ profiles.unavailableMemories: '有 {count} 条关联记忆已无法查看。'
149
160
  profiles.hint: 画像由模型从关联记忆提炼;保存后不再被自动生成覆盖。
150
161
  profiles.sourceCount: '关联 {count} 条记忆'
151
162
  profiles.regenerate: 重新生成
@@ -0,0 +1,65 @@
1
+ main:has(.livingmemory-page),
2
+ .livingmemory-page,
3
+ .livingmemory-page .overflow-y-auto {
4
+ scrollbar-width: none;
5
+ }
6
+
7
+ .livingmemory-profile {
8
+ --disclosure-duration: 280ms;
9
+ --group-inset: clamp(1rem, 2.5cqi, 2rem);
10
+ max-width: 64rem;
11
+ margin-inline: auto;
12
+ padding-inline: clamp(1rem, 3%, 2.5rem);
13
+ padding-block-start: clamp(1rem, 3cqi, 3rem);
14
+ }
15
+
16
+ .livingmemory-profile-group {
17
+ border-radius: 1.125rem;
18
+ background: color-mix(in srgb, var(--card) 85%, var(--muted));
19
+ color: var(--card-foreground);
20
+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 60%, transparent),
21
+ 0 2px 8px rgb(0 0 0 / 4%);
22
+ }
23
+
24
+ .livingmemory-profile-reading {
25
+ padding: var(--group-inset);
26
+ }
27
+
28
+ .livingmemory-profile-trigger {
29
+ border-radius: inherit;
30
+ padding: 1rem var(--group-inset);
31
+ }
32
+
33
+ .livingmemory-profile-list {
34
+ padding: 0 var(--group-inset) .5rem;
35
+ }
36
+
37
+ .livingmemory-profile-sources {
38
+ height: var(--collapsible-panel-height);
39
+ overflow: hidden;
40
+ transition: height var(--disclosure-duration) linear, opacity var(--disclosure-duration) linear;
41
+ }
42
+
43
+ .livingmemory-profile-sources:is([data-starting-style], [data-ending-style]) {
44
+ height: 0;
45
+ opacity: 0;
46
+ }
47
+
48
+ .livingmemory-profile-chevron {
49
+ width: .5rem;
50
+ height: .5rem;
51
+ border: solid currentColor;
52
+ border-width: 1.5px 1.5px 0 0;
53
+ transform: rotate(45deg);
54
+ transition: transform var(--disclosure-duration) linear;
55
+ }
56
+
57
+ [aria-expanded="true"] > .livingmemory-profile-chevron {
58
+ transform: rotate(135deg);
59
+ }
60
+
61
+ @media (prefers-reduced-motion: reduce) {
62
+ .livingmemory-profile {
63
+ --disclosure-duration: 0s;
64
+ }
65
+ }