mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
refactor(ocr): convert OcrProvider type to zod schema
Use zod schema for better type safety and validation capabilities
This commit is contained in:
parent
a3bc279c74
commit
ec68886e4a
@ -89,12 +89,14 @@ export type OcrProviderConfig =
|
||||
| OcrPpocrConfig
|
||||
| OcrOvConfig
|
||||
|
||||
export type OcrProvider = {
|
||||
id: string
|
||||
name: string
|
||||
capabilities: OcrProviderCapabilityRecord
|
||||
config?: OcrProviderBaseConfig
|
||||
}
|
||||
export const OcrProviderSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
capabilities: OcrProviderCapabilityRecordSchema,
|
||||
config: OcrProviderBaseConfigSchema.optional()
|
||||
})
|
||||
|
||||
export type OcrProvider = z.infer<typeof OcrProviderSchema>
|
||||
|
||||
export type OcrApiProviderConfig = OcrProviderBaseConfig & {
|
||||
api: OcrProviderApiConfig
|
||||
|
||||
Loading…
Reference in New Issue
Block a user