Show dialogue context compaction notice and trace
Build and publish frontend / publish (push) Successful in 51s
Build and publish frontend / publish (push) Successful in 51s
This commit is contained in:
+10
-3
@@ -17,6 +17,7 @@
|
||||
#dialogue li { margin-block: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
#dialogue li[data-role="user"] { font-weight: 650; }
|
||||
#dialogue li[data-role="assistant"] { padding-inline-start: .75rem; border-inline-start: .2rem solid currentColor; }
|
||||
#dialogue li[data-role="system"] { padding-inline-start: .75rem; border-inline-start: .2rem dashed currentColor; font-size: .92em; }
|
||||
#message { width: 100%; min-height: 3.5rem; box-sizing: border-box; }
|
||||
#message-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
|
||||
#voice-status { min-height: 1.5em; }
|
||||
@@ -686,7 +687,7 @@
|
||||
transcript.replaceChildren();
|
||||
latestAssistantText = '';
|
||||
latestPlayerAction = [...lines].reverse().find(line => line.role === 'user')?.content || '';
|
||||
for (const line of lines) appendLine(line.role === 'user' ? 'user' : 'assistant', line.content, {speaker: line.speaker, speak: false});
|
||||
for (const line of lines) appendLine(line.role === 'user' ? 'user' : line.role === 'system' ? 'system' : 'assistant', line.content, {speaker: line.speaker, speak: false});
|
||||
refreshActionTools();
|
||||
if (lines.length > 0 && latestAssistantText && location.pathname !== '/admin') {
|
||||
voiceController?.speak(latestAssistantText, {role: 'narrator', voiceIdentity: 'neutral'});
|
||||
@@ -791,10 +792,13 @@
|
||||
|
||||
for (const interaction of orderedInteractions) {
|
||||
const external = interaction.external_call || {};
|
||||
addStep('ai', `${interaction.prompt_id} · v${interaction.prompt_version} · ${interaction.outcome}`,
|
||||
const isCompaction = interaction.prompt_id === 'dialogue-context-compaction';
|
||||
addStep('ai', `${isCompaction ? 'Kontextkomprimering' : interaction.prompt_id} · v${interaction.prompt_version} · ${interaction.outcome}`,
|
||||
{prompt_yaml: interaction.prompt_yaml, rendered_messages: interaction.rendered_messages, provider: external.service, model: external.model, thinking_effort: external.thinking_effort, provider_request: external.request},
|
||||
{response: interaction.response, outcome: interaction.outcome, provider_status: external.response_status, provider_response: external.response_body, provider_error: external.error, duration_ms: external.duration_ms, rust_interpretation_and_validation: interaction.metadata},
|
||||
'AI-förslag och providertrafik. Förslaget är inte i sig ett fastställt världsfaktum.');
|
||||
isCompaction
|
||||
? 'Äldre privat dialog kondenseras; kontrollera källhändelser, prompt, modellsvar, sammanfattningshash och sparad sekvens. Sammanfattningen är inte kanonisk världssanning.'
|
||||
: 'AI-förslag och providertrafik. Förslaget är inte i sig ett fastställt världsfaktum.');
|
||||
const metadata = interaction.metadata || {};
|
||||
if (metadata.validation_inputs || metadata.validation_results || metadata.decision?.includes?.('rule')) {
|
||||
addStep('luau', `Regelutkast och tester · ${metadata.rule_key || metadata.activity_key || interaction.prompt_id}`,
|
||||
@@ -977,6 +981,9 @@
|
||||
: speakingNpc
|
||||
? {speaker: speakingNpc.name, voice: {characterId: speakingNpc.id, voiceIdentity: speakingNpc.voice_identity}}
|
||||
: {speaker: 'Berättaren', voice: {role: 'narrator', voiceIdentity: 'neutral'}});
|
||||
if (result.context_compaction?.notice) {
|
||||
appendLine('system', result.context_compaction.notice, {speaker: 'Kontext', speak: false});
|
||||
}
|
||||
refreshActionTools();
|
||||
} catch (error) {
|
||||
messageField.value = message;
|
||||
|
||||
Reference in New Issue
Block a user