mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import {
|
|
createDefaultTaskProfiles,
|
|
getActiveTaskProfile,
|
|
migrateLegacyTaskProfiles,
|
|
} from "../prompt-profiles.js";
|
|
|
|
const legacySettings = {
|
|
extractPrompt: "旧提取提示",
|
|
recallPrompt: "旧召回提示",
|
|
compressPrompt: "",
|
|
synopsisPrompt: "",
|
|
reflectionPrompt: "",
|
|
consolidationPrompt: "",
|
|
};
|
|
|
|
const migrated = migrateLegacyTaskProfiles(legacySettings);
|
|
assert.equal(migrated.taskProfilesVersion, 1);
|
|
assert.ok(migrated.taskProfiles);
|
|
assert.ok(migrated.taskProfiles.extract);
|
|
assert.ok(migrated.taskProfiles.recall);
|
|
|
|
const extractProfile = getActiveTaskProfile(
|
|
{
|
|
...legacySettings,
|
|
taskProfiles: migrated.taskProfiles,
|
|
},
|
|
"extract",
|
|
);
|
|
assert.equal(extractProfile.taskType, "extract");
|
|
assert.equal(extractProfile.id, "default");
|
|
assert.ok(Array.isArray(extractProfile.blocks));
|
|
assert.equal(extractProfile.blocks.length, 3);
|
|
assert.deepEqual(
|
|
extractProfile.blocks.map((block) => block.name),
|
|
["角色定义", "输出格式", "行为规则"],
|
|
);
|
|
assert.ok(
|
|
extractProfile.blocks.every((block) => block.type === "custom"),
|
|
);
|
|
assert.equal(
|
|
extractProfile.metadata.legacyPromptField,
|
|
"extractPrompt",
|
|
);
|
|
assert.equal(
|
|
extractProfile.metadata.legacyPromptSnapshot,
|
|
"旧提取提示",
|
|
);
|
|
|
|
const defaults = createDefaultTaskProfiles();
|
|
assert.ok(defaults.extract.profiles.length > 0);
|
|
assert.ok(defaults.recall.profiles.length > 0);
|
|
assert.ok(defaults.compress.profiles.length > 0);
|
|
assert.ok(defaults.synopsis.profiles.length > 0);
|
|
assert.ok(defaults.reflection.profiles.length > 0);
|
|
|
|
console.log("task-profile-migration tests passed");
|