Files
archie/ui/src/chat/ChatUpdateCard.vue
T
sam fa14e7da80
Quality / check (push) Canceled after 1m18s
deploy / gate (push) Successful in 4m47s
deploy / archied-image (push) Successful in 3m27s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
fix(ui): chat failures are shown where they happen and leave the real state (#1748)
Mic permission failure shows an inline alert; setModel only switches on
server confirmation and reverts + reports in the transcript on failure;
a failed session refresh after a turn no longer becomes a retryable turn
error; a voice clip during a turn queues instead of dropping; blocked
localStorage falls back to a per-load channel id; a failed install offers
Retry/Not now again; rename/branch use a labelled Dialog instead of
window.prompt; a failed cancel is reported; a stopped turn no longer
blocks transcript reloads.
2026-11-07 00:17:44 +11:00

71 lines
2.5 KiB
Vue

<script setup lang="ts">
import { computed, ref } from "vue";
import { Button } from "@/components/ui/button";
import { api } from "@/lib/api";
import type { ChatUpdate } from "./state";
const props = defineProps<{ update: ChatUpdate }>();
interface Component {
Label?: string;
ID?: string;
Installed?: string;
Available?: string;
Changelog?: string;
}
const available = computed(() => (props.update.available ?? []) as Component[]);
const state = ref<"idle" | "installing" | "deferred" | "done" | "failed">("idle");
const result = ref("");
async function install() {
state.value = "installing";
try {
const out = await api.updateInstall<{ result?: { installed?: Record<string, string> } }>(props.update.snapshot);
const installed = out.result?.installed;
result.value = installed
? Object.entries(installed).map(([id, v]) => `${id} → ${v}`).join(", ") + ". Archie restarts to apply it."
: "Update finished.";
state.value = "done";
} catch (err) {
result.value = (err as Error).message;
state.value = "failed";
}
}
async function later() {
try {
await api.updateDefer(props.update.snapshot);
state.value = "deferred";
} catch (err) {
result.value = (err as Error).message;
state.value = "failed";
}
}
</script>
<template>
<div class="text-label">
<p v-if="!available.length">Up to date</p>
<template v-else>
<p class="font-medium">An update is available</p>
<ul class="mt-1 space-y-0.5">
<li v-for="c in available" :key="c.ID">
{{ c.Label || c.ID }}: <span class="font-mono">{{ c.Installed || "?" }} → {{ c.Available }}</span>
<a v-if="c.Changelog" :href="c.Changelog" target="_blank" rel="noopener" class="ml-1 text-caption underline">changes</a>
</li>
</ul>
<div v-if="state === 'idle' || state === 'failed'" class="mt-3 flex gap-2">
<Button v-if="update.can_install" size="sm" @click="install">Install</Button>
<Button size="sm" variant="ghost" @click="later">Not now</Button>
</div>
<p v-else-if="state === 'installing'" class="mt-2 text-fg-muted">Installing…</p>
<p v-else-if="state === 'deferred'" class="mt-2 text-fg-muted">Skipped until a newer release.</p>
<p v-else-if="state === 'done'" class="mt-2 text-ok">{{ result }}</p>
<p v-else class="mt-2 text-danger">{{ result }}</p>
<p v-if="state === 'idle' && !update.can_install" class="mt-2 text-caption text-fg-muted">No install script on this host.</p>
</template>
</div>
</template>