mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Clarify regex preview stage vs semantics
This commit is contained in:
6
panel.js
6
panel.js
@@ -3928,6 +3928,12 @@ function _renderRegexReuseBadges(rule = {}) {
|
||||
text: "仅 Prompt",
|
||||
});
|
||||
}
|
||||
if (rule.promptStageMode !== "skip" && rule.promptStageApplies === false) {
|
||||
badges.push({
|
||||
className: "is-skip",
|
||||
text: "当前任务未启用",
|
||||
});
|
||||
}
|
||||
return badges
|
||||
.map(
|
||||
(badge) => `<span class="bme-regex-preview-item__badge ${badge.className}">${_escHtml(badge.text)}</span>`,
|
||||
|
||||
@@ -437,6 +437,12 @@ function summarizeRule(rule, reason = "") {
|
||||
|
||||
function summarizeRuleForPromptPreview(rule, stageConfig = {}, reason = "") {
|
||||
const summary = summarizeRule(rule, reason);
|
||||
const promptSemanticApplies =
|
||||
summary.sourceType === "local"
|
||||
? summary.sourceFlags.system !== false &&
|
||||
rule?.destinationFlags?.prompt !== false
|
||||
: summary.promptReplaceAsEmpty ||
|
||||
(summary.promptOnly === true && rule?.destinationFlags?.prompt !== false);
|
||||
const promptStageApplies = shouldApplyRuleForStage(
|
||||
rule,
|
||||
"input.finalPrompt",
|
||||
@@ -444,8 +450,10 @@ function summarizeRuleForPromptPreview(rule, stageConfig = {}, reason = "") {
|
||||
);
|
||||
return {
|
||||
...summary,
|
||||
promptSemanticApplies,
|
||||
promptStageApplies,
|
||||
promptStageMode: promptStageApplies
|
||||
promptStageEnabled: isTaskRegexStageEnabled(stageConfig, "input.finalPrompt"),
|
||||
promptStageMode: promptSemanticApplies
|
||||
? summary.promptReplaceAsEmpty
|
||||
? "clear"
|
||||
: "replace"
|
||||
|
||||
@@ -588,6 +588,38 @@ try {
|
||||
beautifyFinalDebug.entries[0].appliedRules.map((item) => item.id),
|
||||
["beautify-final-strip"],
|
||||
);
|
||||
const beautifyFinalPromptStageOffSettings = buildSettings({
|
||||
stages: {
|
||||
input: true,
|
||||
output: true,
|
||||
"input.userMessage": true,
|
||||
"input.recentMessages": true,
|
||||
"input.candidateText": true,
|
||||
"input.finalPrompt": false,
|
||||
"output.rawResponse": true,
|
||||
"output.beforeParse": true,
|
||||
},
|
||||
});
|
||||
const beautifyStageOffInspect = inspectTaskRegexReuse(
|
||||
beautifyFinalPromptStageOffSettings,
|
||||
"extract",
|
||||
);
|
||||
const beautifyStageOffRule = beautifyStageOffInspect.activeRules.find(
|
||||
(rule) => rule.id === "beautify-final-strip",
|
||||
);
|
||||
assert.equal(beautifyStageOffRule?.promptStageMode, "clear");
|
||||
assert.equal(beautifyStageOffRule?.promptStageApplies, false);
|
||||
assert.equal(
|
||||
applyTaskRegex(
|
||||
beautifyFinalPromptStageOffSettings,
|
||||
"extract",
|
||||
"input.finalPrompt",
|
||||
"Decor",
|
||||
{ entries: [] },
|
||||
"user",
|
||||
),
|
||||
"Decor",
|
||||
);
|
||||
const destinationBeautifySettings = buildSettings({
|
||||
sources: {
|
||||
global: true,
|
||||
|
||||
Reference in New Issue
Block a user