mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-11 19:55:51 +00:00
### 修复 - **翰林院(RAG)API Key 污染**: - 修复 `saveSettingsFromUI` 无差别遍历翰林院面板内全部 `[data-setting-key]` 输入(包含被 `profile-sync` 接管隐藏的字段),导致掩码占位符 `••••••••` 被当作真值写回 `settings.rerank.apiKey` / `settings.retrieval.apiKey`,URL / model 也被 Profile 值覆盖到 legacy 字段。修复后会跳过祖先带 `data-profile-hidden` 的输入 - `getRerankSettings` / `getEmbedRetrievalSettings` 同时加入防御性还原:识别历史污染留下的 `••••••••` 时归为空字符串,避免取消 Profile 分配后实际请求带占位符 token 被 401 ---
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
/**
|
||
* core/memory-blocks/index.js
|
||
*
|
||
* 记忆块工作流系统对外入口。导入此模块即触发:
|
||
* 1. generator-handlers 加载 → 注册内置 'static' handler
|
||
* 2. registerBuiltinBlocks() → 注册首批内置块(sulv1-4)
|
||
*
|
||
* 公开 API:
|
||
* - register / unregister / getById / listByContext / listAll
|
||
* - registerHandler / getHandler / listHandlerTypes
|
||
* - applyToTemplate(template, opts)
|
||
* - applyToTemplates(templates, opts) ← 多模板批处理首选
|
||
* - generateBlockMap(opts)
|
||
*
|
||
* opts 字段:{ context, settings, signal?, extras? }
|
||
*
|
||
* 设计目标:
|
||
* - BlockDefinition 纯数据,可 JSON 序列化(Phase 3 用户自定义导入导出)
|
||
* - generator 通过 type 查表,handler 集中注册,便于扩展 ai_call / plugin
|
||
* - 同一 context 下的块 Promise.all 并发;任一块抛 AbortError 整体中断
|
||
*/
|
||
|
||
export {
|
||
register,
|
||
unregister,
|
||
getById,
|
||
listByContext,
|
||
listAll,
|
||
clear,
|
||
replaceContextBlocks,
|
||
} from './registry.js';
|
||
|
||
export {
|
||
registerHandler,
|
||
unregisterHandler,
|
||
getHandler,
|
||
listHandlerTypes,
|
||
} from './generator-handlers.js';
|
||
|
||
export {
|
||
applyToTemplate,
|
||
applyToTemplates,
|
||
generateBlockMap,
|
||
} from './executor.js';
|
||
|
||
import { registerBuiltinBlocks } from './builtin-blocks.js';
|
||
|
||
// 导入此模块即完成内置块注册(幂等)
|
||
registerBuiltinBlocks();
|
||
|
||
export { registerBuiltinBlocks };
|