From 500ad53e31c71388dc582a860f63a4afa8dcc58a Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 14 Jan 2026 03:44:24 +0800 Subject: [PATCH] chore(minecraft): truncate system prompt in debug dashboard --- services/minecraft/src/debug/web/app.js | 29 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/services/minecraft/src/debug/web/app.js b/services/minecraft/src/debug/web/app.js index d2e19ed8b..4cfb9b420 100644 --- a/services/minecraft/src/debug/web/app.js +++ b/services/minecraft/src/debug/web/app.js @@ -16,6 +16,8 @@ const CONFIG = { UPDATE_THROTTLE: 100, // ms } +const SYSTEM_STATE_MARKER = 'The following blackboard provides you with information about your current state:' + // ============================================================================= // Utility Functions // ============================================================================= @@ -26,6 +28,17 @@ function escapeHtml(text) { return div.innerHTML } +function formatSystemMessageContent(content) { + if (typeof content !== 'string') + return content + + const idx = content.indexOf(SYSTEM_STATE_MARKER) + if (idx === -1) + return content + + return `===TRUNCATED===\n${content.slice(idx + SYSTEM_STATE_MARKER.length).trimStart()}` +} + function throttle(func, wait) { let timeout return function executedFunction(...args) { @@ -537,7 +550,9 @@ class LLMPanel { messagesHtml = trace.messages.map(msg => `
${msg.role || 'unknown'}
-
${escapeHtml(msg.content || '')}
+
${escapeHtml(msg.role === 'system' + ? formatSystemMessageContent(msg.content || '') + : (msg.content || ''))}
`).join('') } @@ -556,12 +571,12 @@ class LLMPanel {
Result
${escapeHtml(trace.content || '')}
- +
Messages
${messagesHtml || '
No messages
'}
- +
Usage
${JSON.stringify(trace.usage || {}, null, 2)}
@@ -783,8 +798,8 @@ class ToolsPanel { ${tool.params.map(param => `
- ${time} ${escapeHtml(event.type)}