Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5354132489 | ||
|
|
0005bb1c83 |
@@ -6,6 +6,8 @@ After login, character creation and play use one dialogue history and one text i
|
||||
|
||||
During play the UI has no persistent location, task, inventory, economy, status, or purchase panels. The player asks for information or writes an action in the same input. Rust validates state changes; the AI can only propose a typed intent. A direct request to travel may establish a new place and an encounter when Rust commits that movement.
|
||||
|
||||
If the player asks to find or approach someone and no NPC is present, the direct dialogue scene may propose one person and an opening line. Rust creates that NPC only for the explicit request and commits the first exchange idempotently; a later turn continues the saved conversation. Clear requests about the current location are answered from its saved facts without asking the player to restate what they want to inspect.
|
||||
|
||||
The separate `/admin` route provides an authenticated, read-only operations view for player search/profile/trace, YAML prompt assets, generated Luau rules with validation results, and the append-only audit log. All privileged data comes from the Rust `/api/admin/...` API; the browser never connects directly to PostgreSQL. Backend endpoints require `accounts.is_admin=true`.
|
||||
|
||||
The game is text- and dialogue-based and uses no images. Place descriptions include sound, smell, air/temperature, touch/surface, and spatial-orientation cues. Visible details may also be described in words, but are never required to understand the scene or play. The transcript is screen-reader announced, and Enter submits the input while Shift+Enter inserts a newline; no separate send button is required.
|
||||
|
||||
@@ -2,5 +2,5 @@ apiVersion: v2
|
||||
name: ai-spel-frontend
|
||||
description: Static web frontend for the Swedish life simulator
|
||||
type: application
|
||||
version: 0.1.30
|
||||
appVersion: "0.1.30"
|
||||
version: 0.1.31
|
||||
appVersion: "0.1.31"
|
||||
+14
-3
@@ -115,6 +115,17 @@
|
||||
}
|
||||
return line;
|
||||
}
|
||||
function explainDialogueError(error) {
|
||||
const code = String(error?.message || '');
|
||||
const known = {
|
||||
dialogue_temporarily_unavailable: 'Berättartjänsten svarar inte just nu. Vänta en stund och försök igen.',
|
||||
world_version_conflict: 'Världen hann ändras medan du skrev. Jag har uppdaterat läget; skicka meddelandet igen.',
|
||||
world_not_available: 'Världen är inte tillgänglig just nu. Försök igen om en liten stund.',
|
||||
};
|
||||
return known[code] || (/^[a-z0-9_]+$/.test(code)
|
||||
? 'Jag kunde inte behandla det just nu. Försök igen om en liten stund.'
|
||||
: code || 'Ett tillfälligt fel uppstod. Försök igen om en liten stund.');
|
||||
}
|
||||
function setVoiceStatus(message = '') { document.querySelector('#voice-status').textContent = message; }
|
||||
function refreshMicrophone() {
|
||||
const button = document.querySelector('#microphone');
|
||||
@@ -534,19 +545,19 @@
|
||||
gameState.world.version = result.world_version;
|
||||
gameState.world.world_time = result.world_time;
|
||||
pendingDialogue = null;
|
||||
if (result.intent === 'move') {
|
||||
if (result.intent === 'move' || result.intent === 'meet') {
|
||||
try {
|
||||
const refreshed = await request('/api/world');
|
||||
if (refreshed.world) gameState = refreshed;
|
||||
} catch (_) { /* The committed dialogue stays successful if this optional view refresh fails. */ }
|
||||
}
|
||||
const speakingNpc = result.intent === 'speak' ? gameState.world.npc : null;
|
||||
const speakingNpc = ['speak', 'meet'].includes(result.intent) ? gameState.world.npc : null;
|
||||
appendLine('assistant', result.reply, speakingNpc
|
||||
? {speaker: speakingNpc.name, voice: {characterId: speakingNpc.id, voiceIdentity: speakingNpc.voice_identity}}
|
||||
: {speaker: 'Berättelsen', voice: {role: 'narrator', voiceIdentity: 'neutral'}});
|
||||
} catch (error) {
|
||||
messageField.value = message;
|
||||
appendLine('assistant', `Meddelandet kunde inte behandlas: ${error.message}. Texten ligger kvar i inmatningen; skicka igen för att försöka på nytt.`);
|
||||
appendLine('assistant', `${explainDialogueError(error)} Ditt meddelande ligger kvar i inmatningen.`);
|
||||
}
|
||||
messageField.disabled = false;
|
||||
messageField.focus();
|
||||
|
||||
@@ -26,6 +26,8 @@ grep -q "event.key === 'Enter' && !event.shiftKey" index.html
|
||||
grep -q "request('/api/character/draft'" index.html
|
||||
grep -q "request('/api/world/draft'" index.html
|
||||
grep -q "request('/api/dialogue'" index.html
|
||||
grep -q "result.intent === 'move' || result.intent === 'meet'" index.html
|
||||
grep -q 'dialogue_temporarily_unavailable:' index.html
|
||||
grep -q 'id="admin-view"' index.html
|
||||
grep -q '/api/admin/players?' index.html
|
||||
grep -q "request('/api/admin/prompts'" index.html
|
||||
|
||||
Reference in New Issue
Block a user