mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:10:22 +08:00
fix: 第一轮注入后不再钉上一轮整段系统提示 (#25)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f5f57b4669
commit
30bdb49958
4 files changed
+2
-9
No files matched your search
@@ -7,7 +7,6 @@ import * as rules from "./rules.js";
|
||||
import * as updater from "./update.js";
|
||||
import {
|
||||
GLOBAL_PROMPT_ORDER,
|
||||
existingSystemPrompt,
|
||||
isMnemonPluginMessage,
|
||||
rewritePromptAssembly,
|
||||
shouldInjectPrompt,
|
||||
@@ -209,14 +208,12 @@ function installIdentityOverride(ctx, config = {}) {
|
||||
const hook = async (_assembly, context, next) => {
|
||||
const inject = config.enabled === false ? "" : readInjectFallback();
|
||||
const allow = config.enabled !== false && shouldInjectPrompt(context, config.injectOnce !== false, inject);
|
||||
const pin = !allow && existingSystemPrompt(context);
|
||||
return assembleState.run({ allow }, async () => {
|
||||
const assembled = typeof next === "function" ? await next() : _assembly;
|
||||
return rewritePromptAssembly(assembled, {
|
||||
fallbackInject: allow ? inject : "",
|
||||
dropMnemon: config.stripMnemon !== false,
|
||||
dropPurgeAfterFold: true,
|
||||
pinPersonaText: pin,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user