mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Add detailed block-level diagnostic logging for prompt build
Logs all block names/roles/enabled status at loop entry, user-block content lengths before sanitization, and final execution message counts to pinpoint exactly where user-role blocks disappear. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1098,6 +1098,12 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
let assistantRoleBlockCount = 0;
|
||||
let systemRoleBlockCount = 0;
|
||||
|
||||
console.log(
|
||||
`[ST-BME][prompt-diag] buildTaskPrompt: taskType=${taskType}, ` +
|
||||
`total blocks=${blocks.length}, ` +
|
||||
`block roles=[${blocks.map((b) => `${b.name}(${b.role},${b.enabled !== false ? "on" : "off"})`).join(", ")}]`,
|
||||
);
|
||||
|
||||
for (const block of blocks) {
|
||||
if (!block || block.enabled === false) continue;
|
||||
|
||||
@@ -1118,6 +1124,15 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
content = interpolateVariables(block.content || "", resolvedContext);
|
||||
}
|
||||
|
||||
if (role === "user") {
|
||||
console.log(
|
||||
`[ST-BME][prompt-diag] user block "${block.name || block.id}": ` +
|
||||
`type=${block.type}, contentLen=${String(content || "").length}, ` +
|
||||
`rawContentLen=${String(block.content || "").length}, ` +
|
||||
`blockedContentsCount=${worldInfoRuntimeBlockedContents.length}`,
|
||||
);
|
||||
}
|
||||
|
||||
const sanitizedBlockContent = sanitizeTaskPromptText(
|
||||
settings,
|
||||
taskType,
|
||||
@@ -1205,6 +1220,13 @@ export async function buildTaskPrompt(settings = {}, taskType, context = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
`[ST-BME][prompt-diag] buildTaskPrompt done: ` +
|
||||
`executionMessages=${executionMessages.length}, ` +
|
||||
`userBlocks=${userRoleBlockCount}, systemBlocks=${systemRoleBlockCount}, ` +
|
||||
`customMessages=${customMessages.length}`,
|
||||
);
|
||||
|
||||
for (const message of worldInfoResolution.additionalMessages || []) {
|
||||
const executionMessage = createExecutionMessage(
|
||||
message.role,
|
||||
|
||||
Reference in New Issue
Block a user