mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Merge branch 'Youzini-afk:main' into main
This commit is contained in:
@@ -238,6 +238,9 @@ function blockUsesWorldInfoContent(block = {}) {
|
||||
}
|
||||
|
||||
function messageUsesWorldInfoContent(message = {}) {
|
||||
if (message?.derivedFromWorldInfo === true) {
|
||||
return true;
|
||||
}
|
||||
if (usesWorldInfoSourceKey(message?.sourceKey)) {
|
||||
return true;
|
||||
}
|
||||
@@ -618,6 +621,9 @@ function sanitizePromptMessages(
|
||||
injectionMode: String(
|
||||
sanitized.value?.injectionMode || message?.injectionMode || "",
|
||||
),
|
||||
derivedFromWorldInfo:
|
||||
sanitized.value?.derivedFromWorldInfo === true ||
|
||||
message?.derivedFromWorldInfo === true,
|
||||
},
|
||||
);
|
||||
return executionMessage;
|
||||
@@ -1157,6 +1163,7 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
if (!block || block.enabled === false) continue;
|
||||
|
||||
const role = normalizeRole(block.role);
|
||||
const blockDerivedFromWorldInfo = blockUsesWorldInfoContent(block);
|
||||
let content = "";
|
||||
|
||||
if (block.type === "legacyPrompt") {
|
||||
@@ -1182,7 +1189,7 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
);
|
||||
}
|
||||
|
||||
const blockApplyMvu = !(isCustomFilter && blockUsesWorldInfoContent(block));
|
||||
const blockApplyMvu = !(isCustomFilter && blockDerivedFromWorldInfo);
|
||||
const sanitizedBlockContent = sanitizeTaskPromptText(
|
||||
settings,
|
||||
taskType,
|
||||
@@ -1229,6 +1236,7 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
order: Number.isFinite(Number(block.order))
|
||||
? Number(block.order)
|
||||
: block._orderIndex,
|
||||
derivedFromWorldInfo: blockDerivedFromWorldInfo,
|
||||
injectionMode: mode,
|
||||
delivery: resolveBlockDelivery(block),
|
||||
effectiveDelivery: resolveBlockDelivery(block),
|
||||
@@ -1242,6 +1250,7 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
blockType: String(block.type || "custom"),
|
||||
sourceKey: String(block.sourceKey || ""),
|
||||
injectionMode: mode,
|
||||
derivedFromWorldInfo: blockDerivedFromWorldInfo,
|
||||
});
|
||||
if (executionMessage) {
|
||||
executionMessages.push(executionMessage);
|
||||
@@ -1265,9 +1274,29 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
assistantRoleBlockCount += 1;
|
||||
}
|
||||
if (mode === "prepend") {
|
||||
customMessages.unshift({ role, content });
|
||||
customMessages.unshift({
|
||||
role,
|
||||
content,
|
||||
source: "profile-block",
|
||||
blockId: String(block.id || ""),
|
||||
blockName: String(block.name || ""),
|
||||
blockType: String(block.type || "custom"),
|
||||
sourceKey: String(block.sourceKey || ""),
|
||||
injectionMode: mode,
|
||||
derivedFromWorldInfo: blockDerivedFromWorldInfo,
|
||||
});
|
||||
} else {
|
||||
customMessages.push({ role, content });
|
||||
customMessages.push({
|
||||
role,
|
||||
content,
|
||||
source: "profile-block",
|
||||
blockId: String(block.id || ""),
|
||||
blockName: String(block.name || ""),
|
||||
blockType: String(block.type || "custom"),
|
||||
sourceKey: String(block.sourceKey || ""),
|
||||
injectionMode: mode,
|
||||
derivedFromWorldInfo: blockDerivedFromWorldInfo,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1436,6 +1465,7 @@ export function buildTaskLlmPayload(promptBuild = null, fallbackUserPrompt = "")
|
||||
blockType: String(message.blockType || ""),
|
||||
sourceKey: String(message.sourceKey || ""),
|
||||
injectionMode: String(message.injectionMode || ""),
|
||||
derivedFromWorldInfo: message.derivedFromWorldInfo === true,
|
||||
}),
|
||||
)
|
||||
.filter(Boolean)
|
||||
|
||||
28
style.css
28
style.css
@@ -1338,12 +1338,15 @@
|
||||
color: var(--bme-on-surface) !important;
|
||||
cursor: pointer;
|
||||
padding-right: 36px;
|
||||
/* 影响原生下拉列表用亮色还是暗色绘制(否则在浅色面板下 option 可能出现黑底) */
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
:root[data-bme-color-scheme="light"]
|
||||
#st-bme-panel
|
||||
:is(select.bme-config-input, select.bme-filter-select, select.bme-task-builtin-select) {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
#st-bme-panel select.bme-config-input option,
|
||||
@@ -1353,6 +1356,31 @@
|
||||
color: var(--bme-on-surface);
|
||||
}
|
||||
|
||||
/* 原生 option 在部分浏览器/系统上不用 CSS 变量;亮色主题用实色保证每项都是浅底深字 */
|
||||
:root[data-bme-color-scheme="light"] #st-bme-panel select option {
|
||||
background-color: #ffffff !important;
|
||||
color: #1c1917 !important;
|
||||
}
|
||||
|
||||
:root[data-bme-color-scheme="light"] #st-bme-panel select option:checked,
|
||||
:root[data-bme-color-scheme="light"] #st-bme-panel select option:hover,
|
||||
:root[data-bme-color-scheme="light"] #st-bme-panel select option:focus {
|
||||
background-color: #e7e5e4 !important;
|
||||
color: #1c1917 !important;
|
||||
}
|
||||
|
||||
:root[data-bme-color-scheme="dark"] #st-bme-panel select option {
|
||||
background-color: #2a2a2d !important;
|
||||
color: #e4e1e6 !important;
|
||||
}
|
||||
|
||||
:root[data-bme-color-scheme="dark"] #st-bme-panel select option:checked,
|
||||
:root[data-bme-color-scheme="dark"] #st-bme-panel select option:hover,
|
||||
:root[data-bme-color-scheme="dark"] #st-bme-panel select option:focus {
|
||||
background-color: #3d3d42 !important;
|
||||
color: #f4f4f5 !important;
|
||||
}
|
||||
|
||||
#st-bme-panel input.bme-config-input:-webkit-autofill,
|
||||
#st-bme-panel input.bme-config-input:-webkit-autofill:hover,
|
||||
#st-bme-panel input.bme-config-input:-webkit-autofill:focus,
|
||||
|
||||
@@ -670,6 +670,18 @@ try {
|
||||
customInterpolatedPromptBuild.systemPrompt,
|
||||
/<status_current_variable>secret=true<\/status_current_variable>/,
|
||||
);
|
||||
const customInterpolatedPayload = buildTaskLlmPayload(
|
||||
customInterpolatedPromptBuild,
|
||||
"unused fallback",
|
||||
);
|
||||
assert.equal(
|
||||
customInterpolatedPayload.promptMessages.some((message) =>
|
||||
/<status_current_variable>secret=true<\/status_current_variable>/.test(
|
||||
message.content,
|
||||
),
|
||||
),
|
||||
true,
|
||||
);
|
||||
|
||||
const noWorldInfoBlockSettings = {
|
||||
taskProfiles: {
|
||||
|
||||
Reference in New Issue
Block a user