mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-11 23:25:50 +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.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
/**
|
||
* core/memory-blocks/builtin-blocks.js
|
||
*
|
||
* 内置块注册。当前只把剧情优化原硬编码的 sulv1-4 迁过来,作为新流水线的首批
|
||
* 静态块——既验证 substitution 流程正常,又保留原行为字节级一致。
|
||
*
|
||
* 旧位置:core/summarizer.js 中 processPlotOptimization 的硬编码 replacements。
|
||
*/
|
||
|
||
import { register } from './registry.js';
|
||
|
||
let initialized = false;
|
||
|
||
export function registerBuiltinBlocks() {
|
||
if (initialized) return;
|
||
initialized = true;
|
||
|
||
// 剧情优化(processPlotOptimization)的四个速率占位符
|
||
register({
|
||
id: 'plotOpt.sulv1',
|
||
placeholder: 'sulv1',
|
||
context: 'plotOptimization',
|
||
generator: { type: 'static', valueKey: 'plotOpt_rateMain', defaultValue: 1.0 },
|
||
name: '主线剧情速率',
|
||
order: 1,
|
||
});
|
||
register({
|
||
id: 'plotOpt.sulv2',
|
||
placeholder: 'sulv2',
|
||
context: 'plotOptimization',
|
||
generator: { type: 'static', valueKey: 'plotOpt_ratePersonal', defaultValue: 1.0 },
|
||
name: '个人线速率',
|
||
order: 2,
|
||
});
|
||
register({
|
||
id: 'plotOpt.sulv3',
|
||
placeholder: 'sulv3',
|
||
context: 'plotOptimization',
|
||
generator: { type: 'static', valueKey: 'plotOpt_rateErotic', defaultValue: 1.0 },
|
||
name: '速率3(留空)',
|
||
order: 3,
|
||
});
|
||
register({
|
||
id: 'plotOpt.sulv4',
|
||
placeholder: 'sulv4',
|
||
context: 'plotOptimization',
|
||
generator: { type: 'static', valueKey: 'plotOpt_rateCuckold', defaultValue: 1.0 },
|
||
name: '速率4(留空)',
|
||
order: 4,
|
||
});
|
||
}
|