feat(翻译页面): 添加OCR处理中的加载状态提示

在翻译页面中添加OCR处理时的加载状态提示,提升用户体验
This commit is contained in:
icarus 2025-08-22 18:37:55 +08:00
parent c5d7d7b849
commit 377d75366e
2 changed files with 4 additions and 1 deletions

View File

@ -1561,7 +1561,8 @@
"ocr": {
"file": {
"not_supported": "不支持的文件类型 {{type}}"
}
},
"processing": "OCR 处理中..."
},
"ollama": {
"keep_alive_time": {

View File

@ -440,6 +440,7 @@ const TranslatePage: FC = () => {
try {
const [file] = await onSelectFile({ multipleSelections: false })
if (isSupportedOcrFile(file)) {
window.message.loading({ content: t('ocr.processing'), key: 'translate_ocr_processing' })
const ocrResult = await ocr(file)
setText(ocrResult.text)
} else {
@ -450,6 +451,7 @@ const TranslatePage: FC = () => {
window.message.error(formatErrorMessage(e))
} finally {
setIsProcessing(false)
window.message.destroy('translate_ocr_processing')
}
}, [ocr, onSelectFile, selecting, t])