mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 11:19:10 +08:00
fix(ocr): 修复ocrImage函数未使用await导致的问题
This commit is contained in:
parent
07c7c33310
commit
b212056356
@ -31,9 +31,10 @@ export const useOcr = () => {
|
|||||||
const ocr = async (file: SupportedOcrFile) => {
|
const ocr = async (file: SupportedOcrFile) => {
|
||||||
const key = uuid()
|
const key = uuid()
|
||||||
window.message.loading({ content: t('ocr.processing'), key, duration: 0 })
|
window.message.loading({ content: t('ocr.processing'), key, duration: 0 })
|
||||||
|
// await to keep show loading message
|
||||||
try {
|
try {
|
||||||
if (isImageFile(file)) {
|
if (isImageFile(file)) {
|
||||||
return ocrImage(file)
|
return await ocrImage(file)
|
||||||
} else {
|
} else {
|
||||||
// @ts-expect-error all types should be covered
|
// @ts-expect-error all types should be covered
|
||||||
throw new Error(t('ocr.file.not_supported', { type: file.type }))
|
throw new Error(t('ocr.file.not_supported', { type: file.type }))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user