Add explicit send button to dialogue input
Build and publish frontend / publish (push) Successful in 52s
Build and publish frontend / publish (push) Successful in 52s
This commit is contained in:
@@ -10,7 +10,7 @@ If the player asks to find or approach someone and no NPC is present, the direct
|
||||
|
||||
The separate `/admin` route provides an authenticated operations view for player search/profile/trace, YAML prompt assets, generated Luau rules with validation results, runtime debug logging, 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 Driftloggar view lets an administrator switch `debug=true` on or off without restarting pods; the setting is stored in PostgreSQL and propagated to running replicas. Verbose pod logs include request, AI-call, validation, and commit metadata but never raw player text, prompts, model responses, sessions, or secrets. Full protected prompt/provider exchanges remain in the audited player trace.
|
||||
|
||||
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.
|
||||
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. A clearly labeled **Skicka** button beside the microphone submits typed text; Enter also submits while Shift+Enter inserts a newline. Typed text, speech transcriptions, and the send button all use the same submission flow.
|
||||
|
||||
Player-facing speech uses Piper TTS in WebAssembly in the browser after audio is activated by a user gesture. It reads game dialogue, onboarding, account responses, character and world creation, gameplay replies, in-game errors, and microphone disclosures; the `/admin` route is excluded. The audio is decoded and played through the Web Audio API, independently of `speechSynthesis`. The first unauthenticated visit keeps the introduction visible and it can be started with `Läs introduktionen`. New game replies are read automatically and the transcript remains available to screen readers and as text. Returning players hear the latest saved game reply when they reopen the game. The player can change speaking rate; narrator pitch is neutral and character pitch is varied consistently by voice identity. These preferences are stored in browser `localStorage`. If WebAssembly, model loading, or audio playback fails, the same content remains available as text and the dialogue offers a retry.
|
||||
|
||||
|
||||
+4
-2
@@ -70,8 +70,8 @@
|
||||
<form id="message-form">
|
||||
<label for="message" id="message-label">Skriv ett meddelande</label>
|
||||
<textarea id="message" name="message" maxlength="4000" aria-describedby="message-help" autocomplete="off"></textarea>
|
||||
<div id="message-tools"><button type="button" id="microphone" aria-pressed="false" aria-describedby="voice-status">Starta mikrofon</button></div>
|
||||
<span id="message-help" class="sr-only">Tryck Enter för att skicka. Tryck Skift och Enter för ny rad.</span>
|
||||
<div id="message-tools"><button type="submit" id="send-message">Skicka</button> <button type="button" id="microphone" aria-pressed="false" aria-describedby="voice-status">Starta mikrofon</button></div>
|
||||
<span id="message-help" class="sr-only">Tryck på Skicka eller Enter för att skicka. Tryck Skift och Enter för ny rad.</span>
|
||||
</form>
|
||||
<p id="voice-status" role="status" aria-live="polite"></p>
|
||||
<div id="speech-progress-container" hidden>
|
||||
@@ -280,6 +280,8 @@
|
||||
function refreshMicrophone() {
|
||||
const button = document.querySelector('#microphone');
|
||||
if (button) button.disabled = play.hidden || messageField.disabled || submitBusy;
|
||||
const sendButton = document.querySelector('#send-message');
|
||||
if (sendButton) sendButton.disabled = play.hidden || messageField.disabled || submitBusy;
|
||||
}
|
||||
function persistVoiceSettings() {
|
||||
voiceSettings.mode = 'game-voice';
|
||||
|
||||
@@ -28,6 +28,7 @@ grep -q "retry.textContent = 'Läs senaste repliken'" index.html
|
||||
grep -q "location.pathname !== '/admin'" index.html
|
||||
grep -q "if (options.speak !== false && location.pathname !== '/admin')" index.html
|
||||
grep -q 'id="microphone" aria-pressed="false"' index.html
|
||||
grep -q 'type="submit" id="send-message">Skicka</button>' index.html
|
||||
grep -q 'id="voice-status" role="status" aria-live="polite"' index.html
|
||||
grep -q 'id="speech-progress" aria-label="Nedladdning av svensk röstmodell"' index.html
|
||||
grep -q 'id="speech-progress-value"' index.html
|
||||
@@ -101,8 +102,8 @@ if grep -Eq 'id="(new-character|world-setup|shop|buy-offer|balance|inventory|pla
|
||||
echo 'The active player UI must not contain permanent data panels, forms, or action buttons.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if sed -n '/<section id="play"/,/^ <\/section>/p' index.html | grep '<button' | grep -v 'id="microphone"' >/dev/null; then
|
||||
echo 'Only the microphone control may appear beside the game text input.' >&2
|
||||
if sed -n '/<section id="play"/,/^ <\/section>/p' index.html | grep '<button' | grep -Ev 'id="(microphone|send-message)"' >/dev/null; then
|
||||
echo 'Only the send and microphone controls may appear beside the game text input.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user