chattercatcher 0.1.8 → 0.1.10
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 +12 -25
- package/dist/cli.js +321 -281
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +3 -16
- package/dist/index.js +222 -251
- package/dist/index.js.map +1 -1
- package/docs/DEVELOPMENT_PLAN.md +1 -1
- package/docs/TECHNICAL_ARCHITECTURE.md +10 -10
- package/package.json +1 -2
package/docs/DEVELOPMENT_PLAN.md
CHANGED
|
@@ -62,12 +62,12 @@ flowchart TD
|
|
|
62
62
|
|
|
63
63
|
### 存储
|
|
64
64
|
|
|
65
|
-
- SQLite
|
|
65
|
+
- SQLite:元数据、原始消息、任务、配置、事实、embedding 向量。
|
|
66
66
|
- Drizzle ORM:schema 和 migration。
|
|
67
67
|
- SQLite FTS5:关键词检索。
|
|
68
|
-
-
|
|
68
|
+
- SQLite embedding 向量索引:语义检索,向量存入 `message_chunk_embeddings`,运行时在 Node.js 侧计算余弦相似度。
|
|
69
69
|
|
|
70
|
-
SQLite
|
|
70
|
+
SQLite 同时负责结构化元数据、关键词召回和本地 embedding 向量存储。MVP 不引入需要平台 native optional dependency 的外部向量库,以保证 npm 全局安装后可直接运行。
|
|
71
71
|
|
|
72
72
|
### LLM 和 Embedding
|
|
73
73
|
|
|
@@ -179,8 +179,8 @@ chunk_id
|
|
|
179
179
|
provider
|
|
180
180
|
model
|
|
181
181
|
dimension
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
embedding_json
|
|
183
|
+
updated_at
|
|
184
184
|
```
|
|
185
185
|
|
|
186
186
|
### facts
|
|
@@ -231,7 +231,7 @@ RAG 是强制架构路径,不能被 prompt 堆叠替代。
|
|
|
231
231
|
检索流程:
|
|
232
232
|
|
|
233
233
|
1. 问题改写和意图识别。
|
|
234
|
-
2. 对 chunk
|
|
234
|
+
2. 对 chunk 做 SQLite embedding 向量检索。
|
|
235
235
|
3. 通过 SQLite FTS5 做关键词检索。
|
|
236
236
|
4. 按群、时间、发送人、来源类型做元数据过滤。
|
|
237
237
|
5. 引入时间权重和来源权重重排。
|
|
@@ -278,7 +278,7 @@ MVP 采用本地 Gateway 模式:
|
|
|
278
278
|
实现上使用 `@larksuiteoapi/node-sdk` 的 `WSClient` 和 `EventDispatcher`:
|
|
279
279
|
|
|
280
280
|
```text
|
|
281
|
-
WSClient 长连接 -> EventDispatcher im.message.receive_v1 -> GatewayIngestor -> SQLite
|
|
281
|
+
WSClient 长连接 -> EventDispatcher im.message.receive_v1 -> GatewayIngestor -> SQLite RAG
|
|
282
282
|
```
|
|
283
283
|
|
|
284
284
|
Gateway 层只负责接收和归一化事件,不直接参与 RAG 答案生成,避免平台细节污染知识库和检索层。
|
|
@@ -364,11 +364,11 @@ chattercatcher web start
|
|
|
364
364
|
|
|
365
365
|
`gateway start` 以前台进程运行,并在 `~/.chattercatcher/gateway.pid` 写入运行记录。`gateway stop` 读取该 PID 文件发送停止信号;如果 PID 已过期,会清理陈旧记录。后台服务安装仍属于 M3 的 service 能力。
|
|
366
366
|
|
|
367
|
-
`restore` 默认合并导入导出文件中的 chats、messages、message_chunks 和 file_jobs,并重建 SQLite FTS。只有显式传入 `--replace`
|
|
367
|
+
`restore` 默认合并导入导出文件中的 chats、messages、message_chunks、message_chunk_embeddings 和 file_jobs,并重建 SQLite FTS。只有显式传入 `--replace` 时才会先清空当前本地知识库;恢复后如果使用语义检索,可以运行 `index rebuild` 重新生成 SQLite embedding 向量。
|
|
368
368
|
|
|
369
|
-
`data delete` 删除 SQLite 知识库记录、关联 chunks、SQLite FTS
|
|
369
|
+
`data delete` 删除 SQLite 知识库记录、关联 chunks、SQLite FTS 条目、SQLite embedding 向量和文件解析任务。删除文件知识源时,只会清理位于 `storage.dataDir` 内的本地保存文件,不会删除外部源文件。
|
|
370
370
|
|
|
371
|
-
`process messages` 立即运行消息索引处理。SQLite FTS 在消息入库时已经即时更新;该命令主要用于立刻把消息 chunks 写入
|
|
371
|
+
`process messages` 立即运行消息索引处理。SQLite FTS 在消息入库时已经即时更新;该命令主要用于立刻把消息 chunks 写入 SQLite embedding 向量索引,等价于手动触发原本可由定时任务承担的处理动作。Web UI 首页的“立即处理”按钮调用同一条 API。
|
|
372
372
|
|
|
373
373
|
## 测试策略
|
|
374
374
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chattercatcher",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "本地优先的飞书/Lark 家庭群知识库机器人",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@inquirer/prompts": "^8.4.2",
|
|
47
|
-
"@lancedb/lancedb": "0.23.0",
|
|
48
47
|
"@larksuiteoapi/node-sdk": "^1.62.0",
|
|
49
48
|
"better-sqlite3": "^12.9.0",
|
|
50
49
|
"commander": "^14.0.3",
|