dsh-feiyu-memgate 0.1.0 → 0.2.0
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 +4 -4
- package/README.zh.md +4 -4
- package/client/client.js +17 -11
- package/docs/DETAIL.en.md +4 -4
- package/docs/DETAIL.md +4 -4
- package/package.json +1 -1
- package/python/GATEWAY_VERSION.json +4 -4
- package/python/feiyu_memgate/backends/base.py +10 -3
- package/python/feiyu_memgate/config.py +3 -3
- package/python/feiyu_memgate/core/stages.py +10 -6
- package/src/config.js +6 -4
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Most settings take effect at once. A change of `gateway.mode`, `gateway.python`,
|
|
|
82
82
|
| `advanced.recallLimit` | Most memories added per turn (1 to 10). Also the default number of `memgate_search` results. | 5 | Applies to a gateway you run yourself as well. |
|
|
83
83
|
| `advanced.recallTimeoutMs` | How long a turn waits for automatic recall (500 to 20000 ms). A slower lookup is skipped. | 4000 | |
|
|
84
84
|
| `advanced.language` | Language of the memory block, the tool replies and `/memgate`: `auto` (follow the system language), `zh` or `en`. | `auto` | Memories themselves are never translated. |
|
|
85
|
-
| `advanced.profile` | How strict the gateway is about what counts as related: `
|
|
85
|
+
| `advanced.profile` | How strict the gateway is about what counts as related: `broad` or `precise`. | `broad` | `broad` returns more memories per turn, misses less and lets more noise through; because the memory block stays in the conversation, the context also grows faster. `precise` returns about one close match per turn and misses more. Up to 0.1.1 the default was `precise`; set it to `precise` to get that behaviour back. The measured numbers are in the [gateway's deployment tiers](https://github.com/N0rmal-114/feiyu-memgate#部署档位) (in Chinese); on the keyword store the gateway measured only a small gain from `broad`. Managed mode only. |
|
|
86
86
|
| `advanced.dailyWrites` | Most memories the gateway accepts per day (0 to 100000). 0 means no cap. | 50 | The day starts at local midnight. The count starts again whenever the gateway restarts. Managed mode only. |
|
|
87
87
|
| `advanced.redaction` | Remove secrets such as keys, tokens and passwords from memories when they are saved and when they are recalled. | on | Pattern based. It does not recognize a bare secret that has no keyword next to it. Managed mode only. |
|
|
88
88
|
| `advanced.newerFirst` | Among nearly equal matches, put newer memories first. | on | It looks only at dates. It does not detect that two memories contradict each other. Managed mode only. |
|
|
@@ -216,9 +216,9 @@ The setup survives closing or reloading the page. After a DSH restart in the mid
|
|
|
216
216
|
- **One store per tier.** The plugin uses a single gateway client and a single store per tier. It does not keep separate memories per user or per project.
|
|
217
217
|
- **The settings page depends on host UI interfaces that are still changing.** The plugin works without it: every setting can be changed with `/memgate` or in the profile file.
|
|
218
218
|
- **Forgetting is experimental** and has been tested only in simulations.
|
|
219
|
-
- **Real-host testing.** Tested in the installed DeepSeek Harness 0.2.2-rc.1 on Windows 11 with an isolated profile: the plugin loads, the bundled gateway starts with a Python from PATH, the settings page renders and saves, the status and model routes answer only to the owner session, the chat command works, and with the add-on and bge-small-zh-v1.5 the local tier is used and reworded questions find their memories. Not tested: macOS and Linux desktops, the Desktop application's own window (the web profile of the same host was used), a conversation with a real model (automatic recall and the two tools were exercised in tests and against the gateway, not in a live chat)
|
|
219
|
+
- **Real-host testing.** Tested in the installed DeepSeek Harness 0.2.2-rc.1 on Windows 11 with an isolated profile: the plugin loads, the bundled gateway starts with a Python from PATH, the settings page renders and saves, the status and model routes answer only to the owner session, the chat command works, and with the add-on and bge-small-zh-v1.5 the local tier is used and reworded questions find their memories. Installing the add-on from npm through the settings page was run too, with the dependency's install script refused: the add-on is installed and enabled, the model is downloaded and the local tier takes over (the path that allows the script was not run). Not tested: macOS and Linux desktops, the Desktop application's own window (the web profile of the same host was used), and a conversation with a real model (automatic recall and the two tools were exercised in tests and against the gateway, not in a live chat).
|
|
220
220
|
- **Other versions and systems.** Other DSH versions in the accepted ranges, other operating systems and other Python builds are not covered by a real-host test.
|
|
221
|
-
- This is version 0.
|
|
221
|
+
- This is version 0.2.0. It changes one default: `advanced.profile` is now `broad` (it was `precise`).
|
|
222
222
|
|
|
223
223
|
## Troubleshooting
|
|
224
224
|
|
|
@@ -236,4 +236,4 @@ Start with `/memgate status`. It shows the state of the gateway, the Python that
|
|
|
236
236
|
|
|
237
237
|
## Licence
|
|
238
238
|
|
|
239
|
-
MIT, see [LICENSE](LICENSE). The bundled gateway in `python/` is the same author's project, [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate), under the same licence ([python/LICENSE](python/LICENSE)). It is version 0.1.0 at commit `
|
|
239
|
+
MIT, see [LICENSE](LICENSE). The bundled gateway in `python/` is the same author's project, [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate), under the same licence ([python/LICENSE](python/LICENSE)). It is version 0.1.0 at commit `403931fee02961435abe9b09245781afcdcb19de` as recorded in [python/GATEWAY_VERSION.json](python/GATEWAY_VERSION.json).
|
package/README.zh.md
CHANGED
|
@@ -82,7 +82,7 @@ dsh plugin --profile desktop add dsh-feiyu-memgate
|
|
|
82
82
|
| `advanced.recallLimit` | 每轮最多加入几条记忆(1 到 10),也是 `memgate_search` 默认返回的条数。 | 5 | 你自己运行的网关同样适用。 |
|
|
83
83
|
| `advanced.recallTimeoutMs` | 每轮最多等自动召回多少毫秒(500 到 20000)。更慢的查找跳过。 | 4000 | |
|
|
84
84
|
| `advanced.language` | 记忆块、工具回复和 `/memgate` 用的语言:`auto`(跟随系统语言)、`zh` 或 `en`。 | `auto` | 记忆本身不会被翻译。 |
|
|
85
|
-
| `advanced.profile` | 网关判断“相关”的严格程度:`
|
|
85
|
+
| `advanced.profile` | 网关判断“相关”的严格程度:`broad` 或 `precise`。 | `broad` | `broad` 每轮返回的条数多,漏得少,杂讯也多;记忆块会留在对话里,所以上下文也涨得更快。`precise` 每轮约一条、更贴题,漏得也多。0.1.1 及之前默认是 `precise`,想要原来的行为就改回 `precise`。实测数字见网关文档的[部署档位](https://github.com/N0rmal-114/feiyu-memgate#部署档位);在关键词存储上,网关实测换成 `broad` 的收益很小。只用于 managed 模式。 |
|
|
86
86
|
| `advanced.dailyWrites` | 网关每天最多收下几条记忆(0 到 100000),0 表示不限。 | 50 | 一天从本地时间零点算起。网关每次重启,计数重新开始。只用于 managed 模式。 |
|
|
87
87
|
| `advanced.redaction` | 保存和召回记忆时,去掉密钥、令牌、密码这类秘密。 | 开 | 基于模式匹配,认不出旁边没有关键词提示的孤立秘密。只用于 managed 模式。 |
|
|
88
88
|
| `advanced.newerFirst` | 相关度差不多时,较新的记忆排在前面。 | 开 | 只看日期,不判断两条记忆是否矛盾。只用于 managed 模式。 |
|
|
@@ -216,9 +216,9 @@ profile 的 `cordis.patch.yml` 里,一行会整个替换同一个 `id` 那一
|
|
|
216
216
|
- **每种检索方式只有一个存储。** 插件只用一个网关客户端和每种方式一个存储,不按用户或项目分开保存记忆。
|
|
217
217
|
- **设置页面依赖宿主里仍在变化的界面接口。** 没有它插件照样能用:每项设置都能用 `/memgate` 或在 profile 文件里修改。
|
|
218
218
|
- **遗忘是实验性的**,只在模拟里测过。
|
|
219
|
-
- **真实环境测试。** 在 Windows 11 上已安装的 DeepSeek Harness 0.2.2-rc.1 里,用一个隔离的配置测过:插件能加载,自带网关用 PATH 上的 Python 启动,设置页面能显示和保存,状态接口和模型接口只回应所有者的会话,聊天命令可用;装上向量插件和 bge-small-zh-v1.5 后用的是 local
|
|
219
|
+
- **真实环境测试。** 在 Windows 11 上已安装的 DeepSeek Harness 0.2.2-rc.1 里,用一个隔离的配置测过:插件能加载,自带网关用 PATH 上的 Python 启动,设置页面能显示和保存,状态接口和模型接口只回应所有者的会话,聊天命令可用;装上向量插件和 bge-small-zh-v1.5 后用的是 local 检索方式,换了说法的问题能找到对应的记忆。通过设置页面从 npm 安装向量插件也测过,测的是拒绝依赖的安装脚本这条路:向量插件装好并启用,模型下载完成,检索方式换成 local(允许脚本的那条路没有跑过)。没有测过:macOS 和 Linux 桌面、桌面应用自己的窗口(用的是同一宿主的 web 配置)、和真实模型的对话(自动召回和两个工具只在测试里和对着网关测过,没有在实际聊天里用过)。
|
|
220
220
|
- **其他版本和系统。** 可接受范围内的其他 DSH 版本、其他操作系统和其他 Python 构建,都没有在真实宿主里测过。
|
|
221
|
-
- 当前版本是 0.
|
|
221
|
+
- 当前版本是 0.2.0。它改了一个默认值:`advanced.profile` 现在是 `broad`(原来是 `precise`)。
|
|
222
222
|
|
|
223
223
|
## 故障排查
|
|
224
224
|
|
|
@@ -236,4 +236,4 @@ profile 的 `cordis.patch.yml` 里,一行会整个替换同一个 `id` 那一
|
|
|
236
236
|
|
|
237
237
|
## 许可
|
|
238
238
|
|
|
239
|
-
MIT,见 [LICENSE](LICENSE)。`python/` 里自带的网关是同一作者的项目 [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate),许可相同([python/LICENSE](python/LICENSE))。版本是 0.1.0,提交是 `
|
|
239
|
+
MIT,见 [LICENSE](LICENSE)。`python/` 里自带的网关是同一作者的项目 [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate),许可相同([python/LICENSE](python/LICENSE))。版本是 0.1.0,提交是 `403931fee02961435abe9b09245781afcdcb19de`,记录在 [python/GATEWAY_VERSION.json](python/GATEWAY_VERSION.json) 里。
|
package/client/client.js
CHANGED
|
@@ -434,20 +434,20 @@ window.__ModuleLoader__.load({ id: 'dsh-feiyu-memgate', factory: (require) => {
|
|
|
434
434
|
{
|
|
435
435
|
"key": "profile",
|
|
436
436
|
"kind": "choice",
|
|
437
|
-
"default": "
|
|
437
|
+
"default": "broad",
|
|
438
438
|
"options": [
|
|
439
439
|
{
|
|
440
|
-
"value": "
|
|
440
|
+
"value": "broad",
|
|
441
441
|
"label": {
|
|
442
|
-
"en": "
|
|
443
|
-
"zh": "
|
|
442
|
+
"en": "broad: more memories per turn, misses less, more noise",
|
|
443
|
+
"zh": "broad:每轮条数多,漏得少,杂讯也多"
|
|
444
444
|
}
|
|
445
445
|
},
|
|
446
446
|
{
|
|
447
|
-
"value": "
|
|
447
|
+
"value": "precise",
|
|
448
448
|
"label": {
|
|
449
|
-
"en": "
|
|
450
|
-
"zh": "
|
|
449
|
+
"en": "precise: about one memory per turn, closer matches, misses more",
|
|
450
|
+
"zh": "precise:每轮约一条,更贴题,漏得也多"
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
],
|
|
@@ -456,8 +456,8 @@ window.__ModuleLoader__.load({ id: 'dsh-feiyu-memgate', factory: (require) => {
|
|
|
456
456
|
"zh": "召回档位"
|
|
457
457
|
},
|
|
458
458
|
"help": {
|
|
459
|
-
"en": "How strict the gateway is about what counts as related.",
|
|
460
|
-
"zh": "
|
|
459
|
+
"en": "How strict the gateway is about what counts as related. The memory block stays in the conversation, so broad makes the context grow faster.",
|
|
460
|
+
"zh": "网关判断“相关”的严格程度。记忆块会留在对话里,broad 会让上下文涨得更快。"
|
|
461
461
|
}
|
|
462
462
|
},
|
|
463
463
|
{
|
|
@@ -1066,6 +1066,12 @@ window.__ModuleLoader__.load({ id: 'dsh-feiyu-memgate', factory: (require) => {
|
|
|
1066
1066
|
body)
|
|
1067
1067
|
}
|
|
1068
1068
|
|
|
1069
|
+
// The answer to a click and the stored state of the chain often carry the same failure (a declined
|
|
1070
|
+
// install script is both). Found in a real host: the message was shown twice. Show the stored one.
|
|
1071
|
+
function sameProblem(a, b) {
|
|
1072
|
+
return Boolean(a && b && a.code && a.code === b.code)
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1069
1075
|
function Problem(props) {
|
|
1070
1076
|
const { problem, lang, t } = props
|
|
1071
1077
|
if (!problem) return null
|
|
@@ -1187,7 +1193,7 @@ window.__ModuleLoader__.load({ id: 'dsh-feiyu-memgate', factory: (require) => {
|
|
|
1187
1193
|
view.python && view.python.problem ? h(Problem, { problem: view.python.problem, lang, t }) : null,
|
|
1188
1194
|
line ? h('p', { style: S.note, role: 'status' }, line) : null,
|
|
1189
1195
|
view.chain && view.chain.error ? h(Problem, { problem: view.chain.error, lang, t }) : null,
|
|
1190
|
-
refusal ? h(Problem, { problem: refusal, lang, t }) : null,
|
|
1196
|
+
refusal && !sameProblem(refusal, view.chain && view.chain.error) ? h(Problem, { problem: refusal, lang, t }) : null,
|
|
1191
1197
|
declined ? h('p', { style: S.note, role: 'status' }, t('declined')) : null,
|
|
1192
1198
|
view.builds
|
|
1193
1199
|
? h('div', { style: S.confirm, role: 'dialog', 'aria-label': t('phase.builds') },
|
|
@@ -1310,7 +1316,7 @@ window.__ModuleLoader__.load({ id: 'dsh-feiyu-memgate', factory: (require) => {
|
|
|
1310
1316
|
// For tests: the page's pure parts and components.
|
|
1311
1317
|
internals: {
|
|
1312
1318
|
FIELDS, NS, ROW_KEY, STATUS_ROUTE, MODELS_ROUTE, dictionaries, fieldView, buildOps, saveDraft, statusRows, checkText,
|
|
1313
|
-
fetchStatus, fetchModels, postModels, pickText, formatSize, memoryText, modelActions, chainLine, SettingsPage, SettingsBody, ModelsSection,
|
|
1319
|
+
fetchStatus, fetchModels, postModels, pickText, formatSize, memoryText, modelActions, chainLine, sameProblem, SettingsPage, SettingsBody, ModelsSection,
|
|
1314
1320
|
ModelRowForTests: ModelRow,
|
|
1315
1321
|
},
|
|
1316
1322
|
}
|
package/docs/DETAIL.en.md
CHANGED
|
@@ -39,7 +39,7 @@ Every setting can be changed in three places: this plugin's settings page on the
|
|
|
39
39
|
| `modules.autoCapture` | Store your messages after each turn | off |
|
|
40
40
|
| `retrieval.tier` | How memories are found: `auto`, `keyword`, `endpoint`, `local` | `auto` |
|
|
41
41
|
| `advanced.recallLimit` | Most memories added per turn | 5 |
|
|
42
|
-
| `advanced.profile` | `
|
|
42
|
+
| `advanced.profile` | `broad`: more memories per turn, misses less, more noise, faster context growth; `precise`: about one close match per turn | `broad` |
|
|
43
43
|
| `advanced.dailyWrites` | Most memories written per day, 0 for no cap | 50 |
|
|
44
44
|
| `advanced.redaction` | Remove keys, tokens and passwords when saving and recalling | on |
|
|
45
45
|
| `gateway.mode` | `managed` uses the bundled gateway, `external` a gateway you run | `managed` |
|
|
@@ -72,8 +72,8 @@ An add-on that is installed but not switched on (for example after a `dsh plugin
|
|
|
72
72
|
- Only memories the model chose to save exist, unless automatic capture is on.
|
|
73
73
|
- The daily write cap is counted in memory, per DSH process, and starts again when the gateway restarts.
|
|
74
74
|
- The settings page depends on host UI interfaces that are still changing; without it, every setting can be changed with `/memgate` or in the profile file.
|
|
75
|
-
- Real-host testing. Tested in the installed DeepSeek Harness 0.2.2-rc.1 on Windows 11 with an isolated profile: the plugin loads, the bundled gateway starts with a Python from PATH, the settings page renders and saves, the status and model routes answer only to the owner session, the chat command works, and with the add-on and bge-small-zh-v1.5 the local tier is used and reworded questions find their memories. Not tested: macOS and Linux desktops, the Desktop application's own window (the web profile of the same host was used), a conversation with a real model (automatic recall and the two tools were exercised in tests and against the gateway, not in a live chat)
|
|
76
|
-
- This is version 0.
|
|
75
|
+
- Real-host testing. Tested in the installed DeepSeek Harness 0.2.2-rc.1 on Windows 11 with an isolated profile: the plugin loads, the bundled gateway starts with a Python from PATH, the settings page renders and saves, the status and model routes answer only to the owner session, the chat command works, and with the add-on and bge-small-zh-v1.5 the local tier is used and reworded questions find their memories. Installing the add-on from npm through the settings page was run too, with the dependency's install script refused: the add-on is installed and enabled, the model is downloaded and the local tier takes over (the path that allows the script was not run). Not tested: macOS and Linux desktops, the Desktop application's own window (the web profile of the same host was used), and a conversation with a real model (automatic recall and the two tools were exercised in tests and against the gateway, not in a live chat).
|
|
76
|
+
- This is version 0.2.0. It changes one default: `advanced.profile` is now `broad` (it was `precise`).
|
|
77
77
|
|
|
78
78
|
## Troubleshooting
|
|
79
79
|
|
|
@@ -81,4 +81,4 @@ Start with `/memgate status`. If no Python is found, install Python 3.11 or late
|
|
|
81
81
|
|
|
82
82
|
## Licence
|
|
83
83
|
|
|
84
|
-
MIT. The bundled gateway is the same author's project [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate), under the same licence, version 0.1.0 at commit `
|
|
84
|
+
MIT. The bundled gateway is the same author's project [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate), under the same licence, version 0.1.0 at commit `403931fee02961435abe9b09245781afcdcb19de`.
|
package/docs/DETAIL.md
CHANGED
|
@@ -39,7 +39,7 @@ dsh plugin --profile <name> add dsh-feiyu-memgate
|
|
|
39
39
|
| `modules.autoCapture` | 每轮结束后把你的消息直接存入记忆 | 关 |
|
|
40
40
|
| `retrieval.tier` | 检索方式:`auto`、`keyword`、`endpoint`、`local` | `auto` |
|
|
41
41
|
| `advanced.recallLimit` | 每轮最多加入几条记忆 | 5 |
|
|
42
|
-
| `advanced.profile` | `
|
|
42
|
+
| `advanced.profile` | `broad` 每轮条数多、漏得少、杂讯也多,上下文涨得更快;`precise` 每轮约一条、更贴题 | `broad` |
|
|
43
43
|
| `advanced.dailyWrites` | 每天最多写入几条,0 为不限 | 50 |
|
|
44
44
|
| `advanced.redaction` | 保存和召回时去掉密钥、令牌、密码 | 开 |
|
|
45
45
|
| `gateway.mode` | `managed` 用自带网关,`external` 连接你自己运行的网关 | `managed` |
|
|
@@ -72,8 +72,8 @@ dsh plugin --profile <name> add dsh-feiyu-memgate
|
|
|
72
72
|
- 只有模型选择保存的记忆才存在,除非打开自动记录。
|
|
73
73
|
- 每日写入上限在内存里计数,按 DSH 进程计,网关重启后重新开始。
|
|
74
74
|
- 设置页面依赖宿主里仍在变化的界面接口;没有它,用 `/memgate` 或 profile 文件也能改全部设置。
|
|
75
|
-
- 真实环境测试:在 Windows 11 上已安装的 DeepSeek Harness 0.2.2-rc.1 里,用一个隔离的配置测过:插件能加载,自带网关用 PATH 上的 Python 启动,设置页面能显示和保存,状态接口和模型接口只回应所有者的会话,聊天命令可用;装上向量插件和 bge-small-zh-v1.5 后用的是 local
|
|
76
|
-
- 当前版本是 0.
|
|
75
|
+
- 真实环境测试:在 Windows 11 上已安装的 DeepSeek Harness 0.2.2-rc.1 里,用一个隔离的配置测过:插件能加载,自带网关用 PATH 上的 Python 启动,设置页面能显示和保存,状态接口和模型接口只回应所有者的会话,聊天命令可用;装上向量插件和 bge-small-zh-v1.5 后用的是 local 检索方式,换了说法的问题能找到对应的记忆。通过设置页面从 npm 安装向量插件也测过,测的是拒绝依赖的安装脚本这条路:向量插件装好并启用,模型下载完成,检索方式换成 local(允许脚本的那条路没有跑过)。没有测过:macOS 和 Linux 桌面、桌面应用自己的窗口(用的是同一宿主的 web 配置)、和真实模型的对话(自动召回和两个工具只在测试里和对着网关测过,没有在实际聊天里用过)。
|
|
76
|
+
- 当前版本是 0.2.0。它改了一个默认值:`advanced.profile` 现在是 `broad`(原来是 `precise`)。
|
|
77
77
|
|
|
78
78
|
## 遇到问题
|
|
79
79
|
|
|
@@ -81,4 +81,4 @@ dsh plugin --profile <name> add dsh-feiyu-memgate
|
|
|
81
81
|
|
|
82
82
|
## 许可
|
|
83
83
|
|
|
84
|
-
MIT。自带的网关是同一作者的项目 [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate),许可相同,版本 0.1.0,提交 `
|
|
84
|
+
MIT。自带的网关是同一作者的项目 [feiyu-memgate](https://github.com/N0rmal-114/feiyu-memgate),许可相同,版本 0.1.0,提交 `403931fee02961435abe9b09245781afcdcb19de`。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-feiyu-memgate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "DeepSeek Harness (DSH) plugin for the feiyu-memgate memory gateway: automatic recall, remember and search tools, with a bundled gateway.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"package": "feiyu-memgate",
|
|
3
3
|
"repository": "https://github.com/N0rmal-114/feiyu-memgate",
|
|
4
4
|
"version": "0.1.0",
|
|
5
|
-
"commit": "
|
|
5
|
+
"commit": "403931fee02961435abe9b09245781afcdcb19de",
|
|
6
6
|
"dirty": false,
|
|
7
7
|
"files": {
|
|
8
8
|
"LICENSE": "5ced0abe92eb65e7bdceda54797958785c6523fb7e927bb5fb4851d4e9c9865a",
|
|
9
9
|
"feiyu_memgate/__init__.py": "de5e4762ab5eca26b89b0ce338f0e033af9c6a19c1f2b12c5ac8b586b2d87bcb",
|
|
10
10
|
"feiyu_memgate/__main__.py": "13a1a5b340cdcfc1902b62be90e508c7c71886000d5bf087e7854aadf09fb35e",
|
|
11
11
|
"feiyu_memgate/backends/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
12
|
-
"feiyu_memgate/backends/base.py": "
|
|
12
|
+
"feiyu_memgate/backends/base.py": "9e4a7b20525bdb8275fb64f1070ce610218a990091a51d9a27f558bb55c24809",
|
|
13
13
|
"feiyu_memgate/backends/embedding.py": "bb2025529a7ef0b09ecfb6df3b733ac0ac431b9eb5d41db74cf03c92da5668af",
|
|
14
14
|
"feiyu_memgate/backends/hybrid.py": "8a3585dde73501ae70d3ee980e7922c1e9b807aed3ccfcc5cc3e84ae0ffd68c7",
|
|
15
15
|
"feiyu_memgate/backends/inmemory.py": "2b655907cc9d4a36202babe5b0d276e09940e74179b86b7934dd9d8c956c6e4c",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"feiyu_memgate/client/http.py": "38cbd9baf18e174c4405aa2b8fbb0587521ffe47e189322b9f809ac2b1bb7a63",
|
|
23
23
|
"feiyu_memgate/client/local.py": "7b0efd940e1d562fea9dbc02beaabc2cbb26369c6e397e1e353d87253a86595f",
|
|
24
24
|
"feiyu_memgate/client/query.py": "a257c45e8378dabc956cb62da3246523baed16f714a9a759f35af9dfe4b923d8",
|
|
25
|
-
"feiyu_memgate/config.py": "
|
|
25
|
+
"feiyu_memgate/config.py": "adf087def69274ec93f082a31a6ba8280740bc1eb332e3daabc14ac6d2b2a9d6",
|
|
26
26
|
"feiyu_memgate/core/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
27
27
|
"feiyu_memgate/core/limits.py": "513c3bc278cd2101329efd497e96b1845ce95f06a96bbd8a87e27c20c0a97f7c",
|
|
28
28
|
"feiyu_memgate/core/pool.py": "4f3454556f68db4044a762573b7b7164f865357f45cdaffd53f18f349c0fb8db",
|
|
29
29
|
"feiyu_memgate/core/recall.py": "d05942264224d3d6aabba9977048c94e5a794f94ea4171d56d0b61ad3c3cf0fa",
|
|
30
30
|
"feiyu_memgate/core/redact.py": "ef0d654cf06197d6e01bd08b9e21f760aa8870a28d78c72d24fae27f4c5cfe95",
|
|
31
|
-
"feiyu_memgate/core/stages.py": "
|
|
31
|
+
"feiyu_memgate/core/stages.py": "e0ce71674fcf1d9ba221e524ea30ae61317b9143cfbe77f8601a3c163db04d9c",
|
|
32
32
|
"feiyu_memgate/core/tidy.py": "b050113a1416b924c32fc606b9e7b1fcff9c1130f982fe7cd117d2e996e66507",
|
|
33
33
|
"feiyu_memgate/core/watch.py": "b43b41e3aff5a7e4b183efe27bf6d417c8625823831a8887054ca80470bf7a02",
|
|
34
34
|
"feiyu_memgate/core/write.py": "ded042ca80d373af4c4a48e15f736f205c4f2c07c4eadfad9cb884f34199f00f",
|
|
@@ -25,6 +25,11 @@ class MemoryBackend(abc.ABC):
|
|
|
25
25
|
to stop early. Read them with getattr: ctl may be None or lack them. A backend without
|
|
26
26
|
sockets and without long work ignores ctl.
|
|
27
27
|
|
|
28
|
+
Score lines: `default_min_score` and `default_relative_ratio` (optional) are the lines of the "precise"
|
|
29
|
+
profile; the `default_` prefix is historical, it does not mean the default profile. `broad_min_score` and
|
|
30
|
+
`broad_relative_ratio` are those of "broad", which is the default profile of the stages. A backend that
|
|
31
|
+
declares no broad line keeps its `default_` line under either profile.
|
|
32
|
+
|
|
28
33
|
Failures raise BackendError (or any exception): the gateway counts the store
|
|
29
34
|
as failed for this request and goes on with the others. Error messages must not
|
|
30
35
|
contain memory text or keys.
|
|
@@ -49,13 +54,15 @@ class MemoryBackend(abc.ABC):
|
|
|
49
54
|
# follows each write for a few minutes and reports the outcome in /healthz?deep=1.
|
|
50
55
|
tracks_writes = False
|
|
51
56
|
# The min_score a recall should use for this backend when the policy names none (the gateway's
|
|
52
|
-
# `min_score` stage reads it).
|
|
57
|
+
# `min_score` stage reads it). The `default_` prefix is historical: it names the line of the "precise"
|
|
58
|
+
# profile, not the default profile (the default profile is "broad", see broad_* below). Scores of different backends mean different things (keyword
|
|
53
59
|
# overlap, semantic similarity), so a backend states a sensible floor for its own scale.
|
|
54
60
|
# Optional: a backend that does not set it gets the gateway's own default.
|
|
55
61
|
default_min_score = None
|
|
56
62
|
# The recall-leaning counterparts, used by the `min_score` / `relative_score` stages when their option
|
|
57
|
-
# `profile` is "broad" (they trade precision and silence for more answered
|
|
58
|
-
# backend has no distinct broad setting: the stages then use the
|
|
63
|
+
# `profile` is "broad", which is the stages' default (they trade precision and silence for more answered
|
|
64
|
+
# questions). None means this backend has no distinct broad setting: the stages then use the default_ line
|
|
65
|
+
# above under either profile.
|
|
59
66
|
broad_min_score = None
|
|
60
67
|
broad_relative_ratio = None
|
|
61
68
|
|
|
@@ -239,9 +239,9 @@ _PROFILE_STAGES = ("min_score", "relative_score")
|
|
|
239
239
|
|
|
240
240
|
def _with_profile(specs, profile):
|
|
241
241
|
"""`specs` (a recall stage list, or None for the default one) with `profile` added to every min_score and
|
|
242
|
-
relative_score entry that does not set its own `profile`.
|
|
243
|
-
|
|
244
|
-
if profile
|
|
242
|
+
relative_score entry that does not set its own `profile`. No profile (None) leaves the entries alone: the
|
|
243
|
+
stages then use their own default, "broad". An explicit "precise" is added like any other. Entries that are not a name or a table are left for _pieces to refuse."""
|
|
244
|
+
if profile is None:
|
|
245
245
|
return specs
|
|
246
246
|
if specs is None:
|
|
247
247
|
specs = list(stages_module.DEFAULT_STAGES)
|
|
@@ -19,7 +19,9 @@ MIN_SCORE = 0.5
|
|
|
19
19
|
RELATIVE_RATIO = 0.6
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
# "broad" is the default of the stages that take a profile; "precise" is the profile a user switches to.
|
|
22
23
|
PROFILES = ("precise", "broad")
|
|
24
|
+
DEFAULT_PROFILE = "broad"
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
def _fraction(value):
|
|
@@ -56,12 +58,13 @@ class MinScore(RecallStage):
|
|
|
56
58
|
store's own default_min_score (a keyword backend declares a lower one than a vector
|
|
57
59
|
backend, whose scores live on another scale), else 0.5.
|
|
58
60
|
Options: value (default None: each store's own default), per_store ({store name: threshold}),
|
|
59
|
-
profile ("
|
|
60
|
-
|
|
61
|
+
profile ("broad", the default: the store's `broad_min_score`, a lower line that answers more questions
|
|
62
|
+
and lets more noise through; or "precise": the store's `default_min_score`, about one memory per question).
|
|
63
|
+
A store that declares no broad line keeps its `default_` line under either profile.
|
|
61
64
|
An explicit value or per_store entry wins over the profile.
|
|
62
65
|
"""
|
|
63
66
|
|
|
64
|
-
def __init__(self, value=None, per_store=None, profile="
|
|
67
|
+
def __init__(self, value=None, per_store=None, profile="broad"):
|
|
65
68
|
self.value = value
|
|
66
69
|
self.per_store = dict(per_store or {})
|
|
67
70
|
self.profile = check_profile("min_score", profile)
|
|
@@ -96,13 +99,14 @@ class RelativeScore(RecallStage):
|
|
|
96
99
|
Put it after every stage that changes scores (`min_score`, `source_weight`, `freshness`): it
|
|
97
100
|
then compares the scores that decide the order. Options: ratio (0..1; default None: each
|
|
98
101
|
store's own; 0 keeps everything), gap (a score difference, default None: no gap rule), profile
|
|
99
|
-
("
|
|
100
|
-
store
|
|
102
|
+
("broad", the default: the store's `broad_relative_ratio`, which keeps more candidates; or "precise": the
|
|
103
|
+
store's `default_relative_ratio`; a store that declares no broad line keeps its `default_` line under
|
|
104
|
+
either profile). An explicit ratio wins over the profile.
|
|
101
105
|
"""
|
|
102
106
|
|
|
103
107
|
cheap = True
|
|
104
108
|
|
|
105
|
-
def __init__(self, ratio=None, gap=None, profile="
|
|
109
|
+
def __init__(self, ratio=None, gap=None, profile="broad"):
|
|
106
110
|
self.profile = check_profile("relative_score", profile)
|
|
107
111
|
if ratio is not None and not _fraction(ratio):
|
|
108
112
|
raise ConfigError("relative_score: ratio must be a number between 0 and 1")
|
package/src/config.js
CHANGED
|
@@ -154,13 +154,15 @@ const GROUPS = [
|
|
|
154
154
|
],
|
|
155
155
|
label: { en: 'Language', zh: '语言' },
|
|
156
156
|
help: { en: 'Language of the memory block, the tool replies and the /memgate command.', zh: '记忆块、工具回复和 /memgate 命令用的语言。' } },
|
|
157
|
-
|
|
157
|
+
// broad is the default since 0.2.0, like the gateway's own default: in a chat a topic usually touches
|
|
158
|
+
// several memories. The block stays in the history, so precise is there for those who want less context.
|
|
159
|
+
{ key: 'profile', kind: 'choice', default: 'broad',
|
|
158
160
|
options: [
|
|
159
|
-
{ value: '
|
|
160
|
-
{ value: '
|
|
161
|
+
{ value: 'broad', label: { en: 'broad: more memories per turn, misses less, more noise', zh: 'broad:每轮条数多,漏得少,杂讯也多' } },
|
|
162
|
+
{ value: 'precise', label: { en: 'precise: about one memory per turn, closer matches, misses more', zh: 'precise:每轮约一条,更贴题,漏得也多' } },
|
|
161
163
|
],
|
|
162
164
|
label: { en: 'Recall profile', zh: '召回档位' },
|
|
163
|
-
help: { en: 'How strict the gateway is about what counts as related.', zh: '
|
|
165
|
+
help: { en: 'How strict the gateway is about what counts as related. The memory block stays in the conversation, so broad makes the context grow faster.', zh: '网关判断“相关”的严格程度。记忆块会留在对话里,broad 会让上下文涨得更快。' } },
|
|
164
166
|
{ key: 'dailyWrites', kind: 'integer', default: 50, min: 0, max: 100000,
|
|
165
167
|
label: { en: 'Daily write cap', zh: '每日写入上限' },
|
|
166
168
|
help: { en: 'Most memories the gateway accepts per day; 0 means no cap. The count starts again whenever the gateway restarts.', zh: '网关每天最多收下几条记忆;0 表示不限。网关重启后重新计数。' } },
|