Enhanced transcription usability.

This commit is contained in:
Lucas Winther committed 2026-07-17 15:18:15 +02:00
1 parent 770cfc9ff7
commit 74858f63fc
8 files changed
+244 -21

No files matched your search

+20 -2
View File
@@ -104,6 +104,9 @@ export function App() {
const [liveStatus, setLiveStatus] = useState<LiveStatus>("idle");
const [liveCommitted, setLiveCommitted] = useState("");
const [liveTentative, setLiveTentative] = useState("");
// Committed segments still waiting for their final pass — surfaced while
// stopping so a long drain shows movement instead of a frozen label.
const [livePending, setLivePending] = useState(0);
const [modelId, setModelId] = useState(DEFAULT_MODEL_ID);
const [devicePreference, setDevicePreference] = useState<DevicePreference>(
@@ -477,6 +480,7 @@ export function App() {
setFileName(null);
setLiveCommitted("");
setLiveTentative("");
setLivePending(0);
setLiveStatus("starting");
const useServer =
@@ -499,6 +503,7 @@ export function App() {
if (data.type === "update") {
setLiveCommitted(data.update.committedText);
setLiveTentative(data.update.tentativeText);
setLivePending(data.update.pendingFinalPasses ?? 0);
if (data.update.error) setError(data.update.error);
} else if (data.type === "result") {
setResult(data.result);
@@ -526,7 +531,15 @@ export function App() {
try {
const mic = await startMicCapture((chunk) => {
if (ws.readyState === WebSocket.OPEN) {
ws.send(chunk.buffer);
// The byte view narrows the buffer typing to what send()
// accepts (same pattern as ServerEngine's request body).
ws.send(
new Uint8Array(
chunk.buffer as ArrayBuffer,
chunk.byteOffset,
chunk.byteLength,
),
);
}
});
liveWsRef.current = ws;
@@ -562,6 +575,7 @@ export function App() {
onUpdate: (update) => {
setLiveCommitted(update.committedText);
setLiveTentative(update.tentativeText);
setLivePending(update.pendingFinalPasses);
if (update.error) setError(update.error);
},
});
@@ -739,7 +753,11 @@ export function App() {
}
activeLabel={
liveStatus === "stopping"
? "Finishing up…"
? livePending > 0
? `Finishing up… transcribing ${livePending} remaining segment${
livePending === 1 ? "" : "s"
}`
: "Finishing up…"
: liveActive
? "Listening…"
: undefined