Add the Translate transcript panel with its own exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a0748b5fa6
commit
c110c9203f
6 files changed
+501
-7
No files matched your search
+24
-1
@@ -10,6 +10,7 @@ import { ModelPicker } from "./components/ModelPicker";
|
||||
import { StorageManager } from "./components/StorageManager";
|
||||
import { TranscriptView } from "./components/TranscriptView";
|
||||
import { TranscriptionOptions } from "./components/TranscriptionOptions";
|
||||
import { TranslatePanel } from "./components/TranslatePanel";
|
||||
import { decodeAudioFile } from "./lib/audio";
|
||||
import { classifyError, type ClassifiedError } from "./lib/errors";
|
||||
import {
|
||||
@@ -26,6 +27,7 @@ import { useAuth } from "./lib/useAuth";
|
||||
import { LIVE_TUNING, LiveTranscriber, type LiveTranscribeResult } from "./lib/live";
|
||||
import { startMicCapture, type MicCapture } from "./lib/mic";
|
||||
import { getDownloadedModels } from "./lib/modelCache";
|
||||
import { TRANSLATION_MODEL_IDS } from "./lib/translation";
|
||||
import { registerServiceWorker } from "./pwa/register";
|
||||
import {
|
||||
AUTO_LANGUAGE,
|
||||
@@ -68,6 +70,8 @@ interface AppErrorState {
|
||||
}
|
||||
|
||||
const MODEL_IDS = MODELS.map((model) => model.id);
|
||||
// Downloaded badges cover the Opus-MT models too (transcript translation, D-WS4b).
|
||||
const CACHED_MODEL_IDS = [...MODEL_IDS, ...TRANSLATION_MODEL_IDS];
|
||||
|
||||
export function App() {
|
||||
const workerRef = useRef<Worker | null>(null);
|
||||
@@ -183,7 +187,7 @@ export function App() {
|
||||
|
||||
function refreshDownloaded() {
|
||||
// Downloaded badges (D-005): query Cache Storage for cached weights.
|
||||
getDownloadedModels(MODEL_IDS).then(setDownloaded, () => {});
|
||||
getDownloadedModels(CACHED_MODEL_IDS).then(setDownloaded, () => {});
|
||||
}
|
||||
|
||||
// Terminate the worker when the app unmounts (also keeps HMR tidy).
|
||||
@@ -1165,6 +1169,25 @@ export function App() {
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Text translation of the finished transcript (D-WS4b) — any engine,
|
||||
file or live; secondary to the transcript itself. */}
|
||||
{result && !liveActive && (
|
||||
<TranslatePanel
|
||||
result={result}
|
||||
sourceLanguageHint={
|
||||
!model?.multilingual
|
||||
? "en"
|
||||
: taskForModel(modelId, task) === "translate"
|
||||
? "en"
|
||||
: language
|
||||
}
|
||||
downloaded={downloaded}
|
||||
onModelCached={refreshDownloaded}
|
||||
exportName={fileName}
|
||||
disabled={busy || liveActive}
|
||||
/>
|
||||
)}
|
||||
|
||||
{applyUpdate && (
|
||||
<div className="update-toast" role="status">
|
||||
<span>A new version of Whisper Web is available.</span>
|
||||
|
||||
Reference in new issue
Block a user