Merge branch 'feat/ocr' into feat/ocr-translate

This commit is contained in:
icarus 2025-08-24 00:06:24 +08:00
commit 10e058c066
2 changed files with 3 additions and 2 deletions

View File

@ -31,9 +31,10 @@ export const useOcr = () => {
const ocr = async (file: SupportedOcrFile) => {
const key = uuid()
window.message.loading({ content: t('ocr.processing'), key, duration: 0 })
// await to keep show loading message
try {
if (isImageFile(file)) {
return ocrImage(file)
return await ocrImage(file)
} else {
// @ts-expect-error all types should be covered
throw new Error(t('ocr.file.not_supported', { type: file.type }))

View File

@ -128,7 +128,7 @@ export type OcrImageHandler = (file: ImageFileMetadata) => Promise<OcrResult>
// Tesseract Types
export type OcrTesseractConfig = OcrProviderConfig & {
langs: Record<TesseractLangCode, boolean>
langs: Partial<Record<TesseractLangCode, boolean>>
}
export type OcrTesseractProvider = BuiltinOcrProvider & {