mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 12:30:22 +08:00
fix: 0.2.0 system prompt修复 + patch89 + override状态机 + 提示词优化
- core.js: isKeepableUserOverride重排序, markOverrideCustomized不写hash(explicitSave), commitOverrideOnApply读盘, patch89 SYSTEM_FIELD_EXTRACT - index.js: system_field_extracted状态字段(status/apply/override端点) - default-prompt-inject.en.md: 优化英文版提示词 - default-prompt-inject.zh.md: 优化中文版提示词 - docs/修改文档.md: 完整修改文档+还原说明 - pi-ai anthropic-messages.js: system从顶层字段改为messages里role:system消息
This commit is contained in:
1 parent
6c1d638d1b
commit
e1d8e59087
24 files changed
+3353
-1198
No files matched your search
+10
-10
@@ -237,22 +237,22 @@ export async function setActive(dshHome, id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 本进程框内提交 > $DSH_HOME/prompt-inject.md > 加密槽。
|
||||
* 规则集只改 agents 目标文件,不参与 system 注入链(#74 磁盘与 UI/注入一致)。
|
||||
* $DSH_HOME/prompt-inject.md(点保存覆盖的那份)> 本进程未落盘的框 > 加密槽。
|
||||
* 规则集只改 agents 目标文件,不参与 system 注入链。
|
||||
*/
|
||||
export function resolveInjectText(dshHome) {
|
||||
const home = path.normalize(String(dshHome || findDshHome() || ""));
|
||||
const disk = readPromptInjectFileSync(home);
|
||||
if (normalizeOverride(disk)) {
|
||||
const source = hashOverride(disk) === defaultOverrideHash() ? "default" : "prompt";
|
||||
return { text: disk, source, ruleId: null };
|
||||
}
|
||||
const pinned = peekCommittedOverride(home);
|
||||
if (typeof pinned === "string" && normalizeOverride(pinned)) {
|
||||
return { text: normalizeOverride(pinned), source: "prompt", ruleId: null };
|
||||
return { text: String(pinned).replace(/\r\n/g, "\n"), source: "prompt", ruleId: null };
|
||||
}
|
||||
const diskNorm = normalizeOverride(readPromptInjectFileSync(home));
|
||||
if (diskNorm) {
|
||||
const source = hashOverride(diskNorm) === defaultOverrideHash() ? "default" : "prompt";
|
||||
return { text: diskNorm, source, ruleId: null };
|
||||
}
|
||||
const bundled = normalizeOverride(defaultOverrideText());
|
||||
if (bundled) return { text: bundled, source: "default", ruleId: null };
|
||||
const bundled = defaultOverrideText();
|
||||
if (normalizeOverride(bundled)) return { text: bundled, source: "default", ruleId: null };
|
||||
return { text: "", source: "none", ruleId: null };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user