fix(voice): address review of typed AI chat

Typed chat sessions no longer end on the voice inactivity timeout, and a
failed or stopped reply keeps the conversation: Stop cancels only the
reply in progress, and map actions that already ran stay in the model's
context. Each upstream request and map action gets its own deadline, old
tool results shrink instead of the history overflowing, and step limits,
a missing or rejected key, the OAuth lock and throttling each get their
own message.

- Server: OpenAI chat is off under GEV_PREFER_CODEX_OAUTH; chat throttles
  default to the provider's throttle; replies carry API_KEY_MISSING,
  API_KEY_REJECTED, CODEX_OAUTH_REQUIRED and RATE_LIMITED codes; upstream
  Retry-After passes through, and a rejected key (Gemini's invalid-key 400
  included) cools down for a minute
- Pinokio forwards the chat throttle settings
- UI: the reply reveal publishes only the message list; the border orbit
  runs only while busy; layers attach with a button or Enter; the log is
  aria-busy while a reply types out; auto-scroll respects a reader who
  scrolled up; Escape closes the attach menu; the chat gear says Settings;
  a note says chat bills the OpenAI key when voice uses ChatGPT sign-in
- Layout does less work while panel height animates; unused blurs removed
- Gemini voice start ends chat; the voice preview clears on every new
  session
- Tests for the route gates, client limits, attachments and the fixes
This commit is contained in:
manjunath22466 committed 2026-11-03 22:01:08 +05:30
1 parent 11cd0142ac
commit da8b0dd8cd
49 files changed
+2121 -160

No files matched your search

+39 -2
View File
@@ -85,7 +85,6 @@
overflow: hidden;
color: var(--text-primary);
background: rgba(7, 22, 31, 0.97);
backdrop-filter: blur(24px);
border: 1px solid rgba(54, 220, 255, 0.3);
border-radius: 0.9rem;
box-shadow: 0 1rem 3rem #0008;
@@ -181,6 +180,12 @@
#gev-chat-empty p {
margin: 0 0 1rem;
}
#gev-chat-auth-note {
margin: 0;
padding: 0 1rem 0.3rem;
color: var(--text-secondary);
font-size: 0.7rem;
}
#gev-chat-empty button {
border: 1px solid var(--glass-border);
border-radius: 1rem;
@@ -469,6 +474,19 @@
background: #10232d;
font: inherit;
}
#gev-chat-layer-row {
display: flex;
gap: 0.4rem;
margin-bottom: 0.4rem;
}
#gev-chat-layer-row select {
flex: 1 1 auto;
min-width: 0;
}
#gev-chat-attach-menu button:disabled {
opacity: 0.5;
cursor: default;
}
#gev-chat-attach-menu p {
margin-bottom: 0;
font-size: 0.65rem;
@@ -1052,7 +1070,19 @@
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
mask-composite: exclude;
animation: gev-border-orbit 4s linear infinite;
}
/* The edge orbits only while voice is live or a chat reply is on its way;
an idle or minimized chat keeps it still. Touch screens and reduced
motion keep it still too. */
@media (prefers-reduced-motion: no-preference) and (pointer: fine) {
#command-dock
> #gev-voice-control:is(
[data-assistant-mode='voice'],
[data-assistant-mode='chat'][data-chat-busy='true']
)
> .gev-active-border {
animation: gev-border-orbit 4s linear infinite;
}
}
@keyframes gev-border-orbit {
to {
@@ -1433,6 +1463,13 @@ body[data-assistant-docked='true'] #right-context-rail {
background: var(--assistant-glass);
border-color: var(--assistant-glass-border);
box-shadow: var(--assistant-glass-shadow);
}
/* The mini reply sits inside the chat panel, whose own blur makes it the
backdrop root: a blur on the reply could not reach the map. */
:root:not([data-ui-theme='cyber'])
#command-dock
#gev-voice-control
:is(#gev-chat-panel, #gev-voice-panel, #gev-voice-panel[data-minimized]) {
-webkit-backdrop-filter: blur(24px) saturate(1.4);
backdrop-filter: blur(24px) saturate(1.4);
}
+39 -13
View File
@@ -14,6 +14,8 @@ const store = useVoiceStore();
const { controls, chat: messages } = storeToRefs(store);
const emit = (name, ...args) => controls.value?.emit(name, ...args);
const list = ref(null);
const layerSelect = ref(null);
const layerChoice = ref('');
// The input holds what the person types until its owner writes it (history
// recall, a suggestion, clearing after send): only then is it replaced.
@@ -27,12 +29,31 @@ const vOwnedDraft = {
},
};
// Keep the newest message in view as the conversation grows.
watch(messages, () =>
nextTick(() => {
// Keep the newest message in view as the conversation grows, while the
// reader is at the bottom: one who scrolled up to read stays there until
// they send. The position is read on scroll, not on every reveal frame.
let stuck = true;
const onListScroll = () => {
const el = list.value;
if (el) stuck = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
};
watch(messages, (next, previous) => {
const sent =
next.length > (previous?.length ?? 0) && next.at(-1)?.role === 'user';
if (!stuck && !sent) return;
void nextTick(() => {
if (list.value) list.value.scrollTop = list.value.scrollHeight;
}),
);
});
});
// Arrow keys only move the layer choice (a closed select changes on each
// press on Windows and Linux); the Attach button or Enter attaches it.
function attachLayer() {
const value = layerChoice.value;
layerChoice.value = '';
if (layerSelect.value) layerSelect.value.value = '';
if (value) emit('chat-layer', value);
}
const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
</script>
@@ -43,11 +64,11 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<div><strong>{{ t('GEV CHAT') }}</strong><p>{{ t('Ask about the map. Tell it where to go.') }}</p></div>
<div id="gev-chat-header-actions">
<PanelLayoutButtons :docked="props.view.layout.docked" :minimized="props.view.chat.minimized" @dock="emit('layout-dock')" @minimize="emit('chat-minimize')" />
<button v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" type="button" :aria-label="t('Voice Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><span class="material-symbols-outlined gev-voice-settings-icon" aria-hidden="true">settings</span></button>
<button v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" type="button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><span class="material-symbols-outlined gev-voice-settings-icon" aria-hidden="true">settings</span></button>
<button id="gev-chat-close" type="button" :aria-label="t('Close chat')" @click="emit('chat-close')">×</button>
</div>
</header>
<div id="gev-chat-messages" ref="list" role="log" :aria-label="t('Conversation')" aria-live="polite">
<div id="gev-chat-messages" ref="list" role="log" :aria-label="t('Conversation')" aria-live="polite" :aria-busy="props.view.chat.busy || props.view.chat.revealing ? 'true' : undefined" @scroll.passive="onListScroll">
<div id="gev-chat-empty" :hidden="!props.view.chat.empty">
<svg viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><ellipse cx="12" cy="12" rx="4" ry="10"></ellipse><path d="M2 12h20"></path></svg>
<h3>{{ t('Explore with a question') }}</h3>
@@ -59,15 +80,20 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
</div>
</div>
<p id="gev-chat-status" role="status">{{ props.view.chat.status }}</p>
<!-- Stays under the status for the whole conversation. -->
<p v-if="props.view.chat.authNote" id="gev-chat-auth-note">{{ props.view.chat.authNote }}</p>
<div id="gev-chat-attachments" :aria-label="t('Attachments')" :hidden="!props.view.chat.attachments.length">
<button v-for="item in props.view.chat.attachments" :key="item.key" type="button" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</button>
</div>
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen">
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen" @keydown="emit('chat-attach-keydown', $event)">
<label for="gev-chat-layer">{{ t('Attach a map layer') }}</label>
<select id="gev-chat-layer" :disabled="props.view.chat.locked" @change="emit('chat-layer', $event.target.value); $event.target.value = ''">
<option value="">{{ t('Choose a layer…') }}</option>
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
</select>
<div id="gev-chat-layer-row">
<select id="gev-chat-layer" ref="layerSelect" :disabled="props.view.chat.locked" @change="layerChoice = $event.target.value" @keydown.enter.prevent="attachLayer()">
<option value="">{{ t('Choose a layer…') }}</option>
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
</select>
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
</div>
<button id="gev-chat-file-button" type="button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</button>
<p>{{ t('TXT, Markdown, CSV, JSON or GeoJSON · up to 10 KB each. Attachments are sent to your AI provider with your message.') }}</p>
<input id="gev-chat-file" type="file" accept=".txt,.md,.csv,.json,.geojson" multiple hidden @change="emit('chat-files', $event.target)" />
@@ -84,7 +110,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
</div>
<form id="gev-chat-form" @submit.prevent="emit('chat-submit')">
<button id="gev-chat-restore" type="button" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></button>
<button id="gev-chat-attach" type="button" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></button>
<button id="gev-chat-attach" type="button" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></button>
<textarea id="gev-chat-input" v-owned-draft="{ text: props.view.chat.draft, revision: props.view.chat.draftRevision }" :rows="props.view.chat.rows" maxlength="4000" :aria-label="t('Message GEV')" :placeholder="t('Ask GEV anything about the map…')" @input="emit('chat-input', $event.target.value)" @keydown="emit('chat-keydown', $event)"></textarea>
<button id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></button>
</form>
+2 -1
View File
@@ -88,7 +88,8 @@ const frameStyle = (panel) => ({
<ChatPanel v-if="view.panel" :view="view" />
<VoiceVisualizer />
<div class="gev-chat-thinking" aria-hidden="true"><span></span><span></span><span></span></div>
<div id="gev-assistant-phase" role="status" aria-live="polite">{{ view.phase.text }}</div>
<!-- Chat announces its phase in its own status line (#gev-chat-status); in chat mode this one stays silent. -->
<div id="gev-assistant-phase" role="status" :aria-live="view.root.assistantMode === 'chat' ? 'off' : 'polite'" :aria-hidden="view.root.assistantMode === 'chat' ? 'true' : undefined">{{ view.phase.text }}</div>
<div class="gev-voice-readout">
<div id="gev-voice-detail" :title="optional(view.detail.title)">{{ view.detail.text }}</div>
</div>