diff --git a/index.html b/index.html index c97d958..8743d13 100644 --- a/index.html +++ b/index.html @@ -31,8 +31,10 @@ #admin-content article > .admin-story-reply { display: none; } #admin-content .admin-simple-conversation > h2, #admin-content .admin-simple-conversation > p:not(.admin-story-empty), - #admin-content .admin-simple-conversation article > :not(.admin-story-reply) { display: none; } + #admin-content .admin-simple-conversation article > :not(.admin-story-player):not(.admin-story-reply) { display: none; } + #admin-content .admin-simple-conversation article > .admin-story-player, #admin-content .admin-simple-conversation article > .admin-story-reply { display: block; margin-block: .85rem; white-space: pre-wrap; } + #admin-content .admin-simple-conversation article > .admin-story-player { font-weight: 650; } #admin-content pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32rem; overflow: auto; } #admin-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: 1rem; } #player-search { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; } @@ -717,7 +719,11 @@ let showedPlayerInput = false; for (const event of group.events) { const payload = event.payload || {}; - if (payload.player_message) { adminElement('p', `Spelaren: ${payload.player_message}`, card); showedPlayerInput = true; } + if (payload.player_message) { + const playerLine = adminElement('p', `Spelaren: ${payload.player_message}`, card); + playerLine.className = 'admin-story-player'; + showedPlayerInput = true; + } const reply = payload.reply || payload.npc_reply; if (reply) { const story = adminElement('p', `Berättelsen: ${reply}`, card); @@ -738,9 +744,15 @@ } if (!showedPlayerInput) { const failedTurnInput = [...group.interactions].reverse().map(latestPlayerText).find(Boolean); - if (failedTurnInput) adminElement('p', `Spelaren: ${failedTurnInput}`, card); + if (failedTurnInput) { + const playerLine = adminElement('p', `Spelaren: ${failedTurnInput}`, card); + playerLine.className = 'admin-story-player'; + } + } + for (const message of group.messages) { + const playerLine = adminElement('p', `Spelare: ${message.message}`, card); + playerLine.className = 'admin-story-player'; } - for (const message of group.messages) adminElement('p', `Spelarmeddelande: ${message.message}`, card); for (const interaction of group.interactions) { if (!interaction.response) continue; const button = adminElement('button', `AI-svar · ${interaction.prompt_id} · ${interaction.outcome}: ${interaction.response}`, card); diff --git a/tests/admin-conversation-trace.test.cjs b/tests/admin-conversation-trace.test.cjs index 650ca6a..8911467 100644 --- a/tests/admin-conversation-trace.test.cjs +++ b/tests/admin-conversation-trace.test.cjs @@ -37,6 +37,8 @@ test('admin can switch to a storyteller-only reading view and return to diagnost assert.match(page, /Lättläst konversation/); assert.match(page, /Visa felsökningsspår/); assert.match(page, /root\.classList\.toggle\('admin-simple-conversation', adminSimpleConversation\)/); + assert.match(page, /playerLine\.className = 'admin-story-player'/); assert.match(page, /story\.className = 'admin-story-reply'/); - assert.match(page, /article > :not\(\.admin-story-reply\)/); + assert.match(page, /article > :not\(\.admin-story-player\):not\(\.admin-story-reply\)/); + assert.match(page, /article > \.admin-story-player,\s*#admin-content \.admin-simple-conversation article > \.admin-story-reply/); });