mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 03:30:22 +08:00
fix: 已登记的 IP 或主机名不再被地区拦截。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
271839b418
commit
faf7e10405
4 files changed
+231
-5
No files matched your search
+19
-1
@@ -1,3 +1,5 @@
|
||||
import { ownServerNote } from "./net-scope.js";
|
||||
|
||||
export const GLOBAL_PROMPT_ORDER = -100000;
|
||||
export const IDENTITY_CARD_PREFIX = "WHO YOU ARE (highest priority";
|
||||
|
||||
@@ -416,6 +418,22 @@ function foldInjectIntoPersona(sections, injectText) {
|
||||
return [{ name: "deployment:persona-prefix", text: inject, order }, ...out];
|
||||
}
|
||||
|
||||
const OWN_SERVER_MARK = "OWN SERVERS — EXACT LIST ONLY";
|
||||
|
||||
function withOwnServers(injectText) {
|
||||
const text = String(injectText || "").trim();
|
||||
if (!text) return text;
|
||||
try {
|
||||
const note = ownServerNote();
|
||||
if (!note) return text;
|
||||
const at = text.indexOf(OWN_SERVER_MARK);
|
||||
const base = at >= 0 ? text.slice(0, at).trim() : text;
|
||||
return `${base}\n\n${note}`;
|
||||
} catch {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
export function rewritePromptAssembly(assembled, fallbackInject = "", options = {}) {
|
||||
if (!assembled || !Array.isArray(assembled.sections)) return assembled;
|
||||
const opts = normalizeRewriteOptions(fallbackInject, options);
|
||||
@@ -436,7 +454,7 @@ export function rewritePromptAssembly(assembled, fallbackInject = "", options =
|
||||
}
|
||||
}
|
||||
|
||||
const injectText = collectInjectText(purge, opts.fallbackInject);
|
||||
const injectText = withOwnServers(collectInjectText(purge, opts.fallbackInject));
|
||||
const redteam = isRedteamSession(opts.context);
|
||||
// #29: 不要把上一条 system/message 全文钉回 sections。
|
||||
// 默认留下 dsh-purge 段。0.1.5 在 waterfall 之后若 complete:true,只认这段把注入抄进最终提示词;
|
||||
|
||||
Reference in new issue
Block a user