mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-29 14:31:35 +08:00
Merge branch 'feat/ocr' into feat/ocr-translate
This commit is contained in:
commit
10e058c066
@ -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 }))
|
||||
|
||||
@ -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 & {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user