mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 05:11:24 +08:00
feat(ocr): 添加对OCR支持文件类型的类型定义和校验函数
添加SupportedOcrFileType类型和isSupportedOcrFileType校验函数 添加SupportedOcrFile类型和isSupportedOcrFile校验函数
This commit is contained in:
parent
69cb81db85
commit
6011805527
@ -1,4 +1,4 @@
|
||||
import { Model } from '@types'
|
||||
import { FileMetadata, FileTypes, Model } from '@types'
|
||||
|
||||
export const BuiltinOcrProviderIds = {
|
||||
tesseract: 'tesseract'
|
||||
@ -61,3 +61,17 @@ export type ImageOcrProvider = OcrProvider & {
|
||||
export const isImageOcrProvider = (p: OcrProvider): p is ImageOcrProvider => {
|
||||
return p.capabilities.image
|
||||
}
|
||||
|
||||
export type SupportedOcrFileType = FileTypes.IMAGE
|
||||
|
||||
export const isSupportedOcrFileType = (type: FileTypes): type is SupportedOcrFileType => {
|
||||
return type === FileTypes.IMAGE
|
||||
}
|
||||
|
||||
export type SupportedOcrFile = FileMetadata & {
|
||||
type: FileTypes.IMAGE
|
||||
}
|
||||
|
||||
export const isSupportedOcrFile = (file: FileMetadata): file is SupportedOcrFile => {
|
||||
return isSupportedOcrFileType(file.type)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user