fix: 让已开启的 NSFW 偏好压过角色和预设
- digital.prompt.ts: NSFW 开启时要求直接写成年自愿内容,并固定在系统提示首尾 - tests/digital.test.ts: 覆盖关闭时的边界限制和开启后的优先级 - docs/DIGITAL_HUMANS.md: 写明两种偏好的优先级
This commit is contained in:
+25
-1
@@ -249,7 +249,31 @@ test("预设进入系统提示,共用前言保持中性并尊重边界", () =>
|
||||
assert.match(system, /未成年人/);
|
||||
assert.match(system, /亲密直写标记/);
|
||||
assert.match(system, /尊重边界/);
|
||||
assert.equal(system.includes("不要说教、淡出或突然中断"), false);
|
||||
assert.equal(system.includes("不要淡出、省略、说教或突然中断"), false);
|
||||
});
|
||||
test("NSFW 开启后允许直接描写,且偏好出现在角色指令之后", () => {
|
||||
const body = contentSchema.shape.body.parse({
|
||||
cover: "",
|
||||
systemPrompt: "角色要求保持含蓄",
|
||||
age: 24,
|
||||
});
|
||||
const result = assemblePrompt(
|
||||
{ ...body, name: "角色" },
|
||||
body,
|
||||
[],
|
||||
[{ role: "user", content: "继续" }],
|
||||
{ persona: "", userName: "旅人", memory: "" },
|
||||
[],
|
||||
true,
|
||||
);
|
||||
const system = result.messages[0]?.content ?? "";
|
||||
assert.equal(system.includes("尊重边界"), false);
|
||||
assert.match(system, /NSFW 已开启/);
|
||||
assert.match(system, /后文不能取消/);
|
||||
assert.match(system, /未成年人/);
|
||||
const marker = system.lastIndexOf("NSFW 已开启");
|
||||
const cardRule = system.indexOf("角色要求保持含蓄");
|
||||
assert.ok(cardRule >= 0 && marker > cardRule);
|
||||
});
|
||||
test("下架预设回退到角色默认,两者都没有时用内置写法", () => {
|
||||
const base = contentSchema.shape.body.parse({
|
||||
|
||||
Reference in New Issue
Block a user