mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 21:01:32 +08:00
refactor(ocr): 统一OCR类型导入路径
将所有OCR相关类型从'@renderer/types/ocr'改为从'@renderer/types'或'@types'导入 优化DEFAULT_OCR_PROVIDER类型定义
This commit is contained in:
parent
2b463374ac
commit
a6aee21a96
@ -1,13 +1,14 @@
|
||||
import { loggerService } from '@logger'
|
||||
import { ImageFileMetadata, isImageFile } from '@types'
|
||||
import {
|
||||
ImageFileMetadata,
|
||||
ImageOcrProvider,
|
||||
isBuiltinOcrProvider,
|
||||
isImageFile,
|
||||
isImageOcrProvider,
|
||||
OcrProvider,
|
||||
OcrResult,
|
||||
SupportedOcrFile
|
||||
} from 'src/renderer/src/types/ocr'
|
||||
} from '@types'
|
||||
|
||||
import { getTesseractWorker } from './TesseractService'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { BuiltinOcrProvider, ImageOcrProvider, OcrProviderCapability } from '@renderer/types/ocr'
|
||||
import { BuiltinOcrProvider, ImageOcrProvider, OcrProviderCapability } from '@renderer/types'
|
||||
|
||||
const tesseract: BuiltinOcrProvider & ImageOcrProvider = {
|
||||
id: 'tesseract',
|
||||
@ -10,6 +10,6 @@ const tesseract: BuiltinOcrProvider & ImageOcrProvider = {
|
||||
|
||||
export const BUILTIN_OCR_PROVIDERS: BuiltinOcrProvider[] = [tesseract] as const
|
||||
|
||||
export const DEFAULT_OCR_PROVIDER: Record<OcrProviderCapability, BuiltinOcrProvider> = {
|
||||
export const DEFAULT_OCR_PROVIDER: Record<OcrProviderCapability, BuiltinOcrProvider & ImageOcrProvider> = {
|
||||
image: tesseract
|
||||
} as const
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { useAppSelector } from '@renderer/store'
|
||||
import { ImageFileMetadata, isImageFile } from '@renderer/types'
|
||||
import { SupportedOcrFile } from '@renderer/types/ocr'
|
||||
import { ImageFileMetadata, isImageFile, SupportedOcrFile } from '@renderer/types'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export const useImageOcr = () => {}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { OcrProvider, OcrResult, SupportedOcrFile } from '@renderer/types/ocr'
|
||||
import { OcrProvider, OcrResult, SupportedOcrFile } from '@renderer/types'
|
||||
|
||||
// const logger = loggerService.withContext('main:OcrService')
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
||||
import { BUILTIN_OCR_PROVIDERS, DEFAULT_OCR_PROVIDER } from '@renderer/config/ocr'
|
||||
import { ImageOcrProvider, OcrProvider } from '@renderer/types/ocr'
|
||||
import { ImageOcrProvider, OcrProvider } from '@renderer/types'
|
||||
|
||||
export interface OcrState {
|
||||
providers: OcrProvider[]
|
||||
|
||||
@ -9,6 +9,8 @@ export * from './file'
|
||||
import type { FileMetadata } from './file'
|
||||
import type { Message } from './newMessage'
|
||||
|
||||
export * from './ocr'
|
||||
|
||||
export type Assistant = {
|
||||
id: string
|
||||
name: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FileMetadata, FileTypes, Model } from '@types'
|
||||
import { FileMetadata, FileTypes, Model } from '.'
|
||||
|
||||
export const BuiltinOcrProviderIds = {
|
||||
tesseract: 'tesseract'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import TesseractLogo from '@renderer/assets/images/providers/Tesseract.js.png'
|
||||
import { isBuiltinOcrProviderId } from '@renderer/types/ocr'
|
||||
import { isBuiltinOcrProviderId } from '@renderer/types'
|
||||
|
||||
export function getOcrProviderLogo(providerId: string) {
|
||||
if (isBuiltinOcrProviderId(providerId)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user