预设装配注入人设与身份宏,并支持编辑采样参数。
让游玩提示词能吃到当前用户角色,同时在设置里可调 generation。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,10 @@ import {
|
||||
listAllPresetEntries,
|
||||
listEnabledPresetEntries,
|
||||
} from "../src/preset/entries.js";
|
||||
import {
|
||||
applyPresetGeneration,
|
||||
normalizeGeneration,
|
||||
} from "../src/preset/generation.js";
|
||||
import { importSillyTavernPreset } from "../src/preset/importer.js";
|
||||
|
||||
const samplePreset = {
|
||||
@@ -170,3 +174,35 @@ describe("applyPresetEntryPatches", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("normalizeGeneration / applyPresetGeneration", () => {
|
||||
it("keeps finite numbers and clears empty fields on replace", () => {
|
||||
expect(
|
||||
normalizeGeneration({
|
||||
temperature: "0.9",
|
||||
topP: "",
|
||||
maxOutputTokens: 4096,
|
||||
reasoningEffort: " high ",
|
||||
verbosity: " ",
|
||||
stream: true,
|
||||
seed: "not-a-number",
|
||||
}),
|
||||
).toEqual({
|
||||
temperature: 0.9,
|
||||
maxOutputTokens: 4096,
|
||||
reasoningEffort: "high",
|
||||
stream: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("replaces preset generation wholesale", () => {
|
||||
const report = importSillyTavernPreset(samplePreset);
|
||||
expect(report.preset.generation.temperature).toBe(1);
|
||||
const next = applyPresetGeneration(report.preset, {
|
||||
topP: 0.8,
|
||||
maxOutputTokens: 2048,
|
||||
});
|
||||
expect(next.generation).toEqual({ topP: 0.8, maxOutputTokens: 2048 });
|
||||
expect(next.prompts).toBe(report.preset.prompts);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user