dsh-memory-tiers 0.5.1 → 0.8.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.
- package/ARCHITECTURE.md +2460 -1679
- package/README.md +268 -206
- package/client.mjs +608 -425
- package/compaction.mjs +184 -177
- package/dshllm.mjs +141 -0
- package/index.mjs +826 -670
- package/memory5.mjs +259 -42
- package/memory6.mjs +1553 -0
- package/package.json +63 -58
- package/reindex.mjs +3 -3
- package/settings.mjs +327 -241
- package/silicon.mjs +56 -8
package/package.json
CHANGED
|
@@ -1,58 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-memory-tiers",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "index.mjs",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"dsh",
|
|
10
|
-
"dsh-plugin",
|
|
11
|
-
"memory",
|
|
12
|
-
"compaction",
|
|
13
|
-
"context"
|
|
14
|
-
],
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/1129742588/dsh-memory-tiers.git"
|
|
18
|
-
},
|
|
19
|
-
"homepage": "https://github.com/1129742588/dsh-memory-tiers#readme",
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/1129742588/dsh-memory-tiers/issues"
|
|
22
|
-
},
|
|
23
|
-
"dsh": {
|
|
24
|
-
"bundle": {
|
|
25
|
-
"patch": "./cordis.patch.yml"
|
|
26
|
-
},
|
|
27
|
-
"client": {
|
|
28
|
-
"inject": [],
|
|
29
|
-
"platform": "web"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"exports": {
|
|
33
|
-
".": "./index.mjs",
|
|
34
|
-
"./client": "./client.mjs",
|
|
35
|
-
"./compaction.mjs": "./compaction.mjs",
|
|
36
|
-
"./memory5.mjs": "./memory5.mjs",
|
|
37
|
-
"./
|
|
38
|
-
"./
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-memory-tiers",
|
|
3
|
+
"version": "0.8.2",
|
|
4
|
+
"description": "让 dsh 记住你说过的话,忘掉无关的,聊再久也不多花钱。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.mjs",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"dsh",
|
|
10
|
+
"dsh-plugin",
|
|
11
|
+
"memory",
|
|
12
|
+
"compaction",
|
|
13
|
+
"context"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/1129742588/dsh-memory-tiers.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/1129742588/dsh-memory-tiers#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/1129742588/dsh-memory-tiers/issues"
|
|
22
|
+
},
|
|
23
|
+
"dsh": {
|
|
24
|
+
"bundle": {
|
|
25
|
+
"patch": "./cordis.patch.yml"
|
|
26
|
+
},
|
|
27
|
+
"client": {
|
|
28
|
+
"inject": [],
|
|
29
|
+
"platform": "web"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": "./index.mjs",
|
|
34
|
+
"./client": "./client.mjs",
|
|
35
|
+
"./compaction.mjs": "./compaction.mjs",
|
|
36
|
+
"./memory5.mjs": "./memory5.mjs",
|
|
37
|
+
"./memory6.mjs": "./memory6.mjs",
|
|
38
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
"./dshllm.mjs": "./dshllm.mjs"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"index.mjs",
|
|
44
|
+
"client.mjs",
|
|
45
|
+
"settings.mjs",
|
|
46
|
+
"compaction.mjs",
|
|
47
|
+
"memory5.mjs",
|
|
48
|
+
"memory6.mjs",
|
|
49
|
+
"silicon.mjs",
|
|
50
|
+
"cordis.patch.yml",
|
|
51
|
+
"README.md",
|
|
52
|
+
"ARCHITECTURE.md",
|
|
53
|
+
"reindex.mjs",
|
|
54
|
+
"dshllm.mjs"
|
|
55
|
+
],
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"reindex": "node reindex.mjs",
|
|
61
|
+
"test:m6": "node test-memory6.mjs"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/reindex.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* 为什么需要它:
|
|
6
6
|
* 向量是模型输出的坐标,换模型 = 换坐标系。旧坐标在新坐标系里没有任何意义。
|
|
7
|
-
*
|
|
7
|
+
* 更麻烦的是常用的几个模型(Qwen3-Embedding-0.6B / bge-m3)**都是 1024 维**,
|
|
8
8
|
* 维度检查发现不了,cosine() 会照常算出数字——不报错,只是越来越不准。
|
|
9
9
|
*
|
|
10
10
|
* 用法:
|
|
@@ -52,7 +52,7 @@ const base = cfg.apiBase || 'https://api.siliconflow.cn/v1'
|
|
|
52
52
|
|
|
53
53
|
if (!apiKey) {
|
|
54
54
|
die(`没配 apiKey(${cfgPath} 的 "apiKey" 或环境变量 SILICONFLOW_API_KEY)。
|
|
55
|
-
没有 key
|
|
55
|
+
没有 key 就没有 embedding 模型,重建无从谈起(v0.5.2 起已不再用本地哈希向量兜底)。`)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
let silicon
|
|
@@ -78,7 +78,7 @@ const metaPath = join(dir, 'vectors.meta.json')
|
|
|
78
78
|
let meta = null
|
|
79
79
|
try { meta = JSON.parse(readFileSync(metaPath, 'utf8')) } catch { /* 没有就是老库 */ }
|
|
80
80
|
if (meta) console.log('现有向量 ', `${meta.count} 条 / ${meta.dim} 维 / 来自 ${meta.sig || '(未知)'}`)
|
|
81
|
-
else console.log('现有向量 ', '(
|
|
81
|
+
else console.log('现有向量 ', '(没有指纹文件,视为旧库)')
|
|
82
82
|
|
|
83
83
|
if (meta && meta.sig === signature && !has('--rebuild')) {
|
|
84
84
|
console.log('\n✓ 指纹已经一致,不需要重建(确实想重嵌加 --rebuild)')
|