mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 14:29:15 +08:00
Merge branch 'feat/ocr' into feat/ocr-translate
This commit is contained in:
commit
b062dff59c
@ -32,6 +32,9 @@ export const useOcr = () => {
|
|||||||
try {
|
try {
|
||||||
if (isImageFile(file)) {
|
if (isImageFile(file)) {
|
||||||
return ocrImage(file)
|
return ocrImage(file)
|
||||||
|
} else {
|
||||||
|
// @ts-expect-error all types should be covered
|
||||||
|
throw new Error(t('ocr.file.not_supported', { type: file.type }))
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('Failed to ocr.', e as Error)
|
logger.error('Failed to ocr.', e as Error)
|
||||||
@ -40,8 +43,6 @@ export const useOcr = () => {
|
|||||||
} finally {
|
} finally {
|
||||||
window.message.destroy(key)
|
window.message.destroy(key)
|
||||||
}
|
}
|
||||||
// @ts-expect-error all types should be covered
|
|
||||||
throw new Error(t('ocr.file.not_supported', { type: file.type }))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user