From 2529b51a1746ef29c48e218b6b8bb481305bf0ff Mon Sep 17 00:00:00 2001 From: icarus Date: Fri, 22 Aug 2025 14:31:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ocr):=20=E5=B0=86=E8=8E=B7=E5=8F=96OCR?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=95=86logo=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=88=B0utils=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将getOcrProviderLogo函数从config/ocr.ts移动到utils/ocr.ts,保持功能集中 --- src/renderer/src/config/ocr.ts | 15 ++------------- src/renderer/src/utils/ocr.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 src/renderer/src/utils/ocr.ts diff --git a/src/renderer/src/config/ocr.ts b/src/renderer/src/config/ocr.ts index 49cd16d5fc..fbceb01d27 100644 --- a/src/renderer/src/config/ocr.ts +++ b/src/renderer/src/config/ocr.ts @@ -1,15 +1,4 @@ -import TesseractLogo from '@renderer/assets/images/providers/Tesseract.js.png' -import { BuiltinOcrProvider, isBuiltinOcrProviderId } from '@renderer/types/ocr' - -export function getOcrProviderLogo(providerId: string) { - if (isBuiltinOcrProviderId(providerId)) { - switch (providerId) { - case 'tesseract': - return TesseractLogo - } - } - return undefined -} +import { BuiltinOcrProvider } from '@renderer/types/ocr' export const BUILTIN_OCR_PROVIDERS: BuiltinOcrProvider[] = [ { @@ -19,4 +8,4 @@ export const BUILTIN_OCR_PROVIDERS: BuiltinOcrProvider[] = [ image: true } } -] +] as const diff --git a/src/renderer/src/utils/ocr.ts b/src/renderer/src/utils/ocr.ts new file mode 100644 index 0000000000..2d59335e1d --- /dev/null +++ b/src/renderer/src/utils/ocr.ts @@ -0,0 +1,12 @@ +import TesseractLogo from '@renderer/assets/images/providers/Tesseract.js.png' +import { isBuiltinOcrProviderId } from '@renderer/types/ocr' + +export function getOcrProviderLogo(providerId: string) { + if (isBuiltinOcrProviderId(providerId)) { + switch (providerId) { + case 'tesseract': + return TesseractLogo + } + } + return undefined +}