save ocr/tts/transcription results next to source file from context menu
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -413,9 +413,10 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
||||
const filePath = entryPath(entry.name);
|
||||
const toastId = toast.loading('Generating speech audio...');
|
||||
try {
|
||||
const { audioPath, audioRoot } = await files.tts(filePath);
|
||||
const { audioPath } = await files.tts(filePath, { saveNextTo: true });
|
||||
toast.dismiss(toastId);
|
||||
setSearchParams({ view: filePath, ephemeral: audioPath, ephemeralRoot: audioRoot });
|
||||
refresh();
|
||||
setSearchParams({ view: audioPath });
|
||||
} catch {
|
||||
toast.error('Failed to generate speech audio', { id: toastId });
|
||||
}
|
||||
@@ -425,9 +426,10 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
||||
const filePath = entryPath(entry.name);
|
||||
const toastId = toast.loading('Extracting text from image...');
|
||||
try {
|
||||
const { ocrPath, ocrRoot } = await files.ocr(filePath);
|
||||
const { ocrPath } = await files.ocr(filePath, { saveNextTo: true });
|
||||
toast.dismiss(toastId);
|
||||
setSearchParams({ view: filePath, ephemeral: ocrPath, ephemeralRoot: ocrRoot });
|
||||
refresh();
|
||||
setSearchParams({ view: ocrPath });
|
||||
} catch {
|
||||
toast.error('Failed to extract text from image', { id: toastId });
|
||||
}
|
||||
@@ -437,9 +439,10 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
||||
const filePath = entryPath(entry.name);
|
||||
const toastId = toast.loading('Transcribing audio...');
|
||||
try {
|
||||
const { transcriptionPath, transcriptionRoot } = await files.transcribe(filePath);
|
||||
const { transcriptionPath } = await files.transcribe(filePath, { saveNextTo: true });
|
||||
toast.dismiss(toastId);
|
||||
setSearchParams({ view: filePath, ephemeral: transcriptionPath, ephemeralRoot: transcriptionRoot });
|
||||
refresh();
|
||||
setSearchParams({ view: transcriptionPath });
|
||||
} catch {
|
||||
toast.error('Failed to transcribe audio', { id: toastId });
|
||||
}
|
||||
|
||||
@@ -48,17 +48,17 @@ export const useFilesAPI = (root: string = 'home') => {
|
||||
downloadVideo: (url: string, path: string, audioOnly: boolean) =>
|
||||
client.post(withRoot('/file-browser/download-video'), { url, path, audioOnly }),
|
||||
|
||||
tts: (path: string) =>
|
||||
client.post<{ audioPath: string; audioRoot: string }>('/file-browser/tts', { path, root }),
|
||||
tts: (path: string, opts?: { saveNextTo?: boolean }) =>
|
||||
client.post<{ audioPath: string; audioRoot: string }>('/file-browser/tts', { path, root, ...opts }),
|
||||
|
||||
ttsText: (id: string, text: string) =>
|
||||
client.post<{ audioPath: string; audioRoot: string }>('/file-browser/tts-text', { id, text }),
|
||||
|
||||
ocr: (path: string) =>
|
||||
client.post<{ ocrPath: string; ocrRoot: string }>('/file-browser/ocr', { path, root }),
|
||||
ocr: (path: string, opts?: { saveNextTo?: boolean }) =>
|
||||
client.post<{ ocrPath: string; ocrRoot: string }>('/file-browser/ocr', { path, root, ...opts }),
|
||||
|
||||
transcribe: (path: string) =>
|
||||
client.post<{ transcriptionPath: string; transcriptionRoot: string }>('/file-browser/transcribe', { path, root }),
|
||||
transcribe: (path: string, opts?: { saveNextTo?: boolean }) =>
|
||||
client.post<{ transcriptionPath: string; transcriptionRoot: string }>('/file-browser/transcribe', { path, root, ...opts }),
|
||||
|
||||
extractAudio: (path: string) =>
|
||||
client.post<{ audioPath: string; audioRoot: string }>('/file-browser/extract-audio', { path, root }),
|
||||
|
||||
Reference in New Issue
Block a user