mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 10:29:02 +08:00
refactor(ocr): simplify ocr providers api by returning string array
Remove unused OcrProvider type and related endpoints. The GET endpoint now returns a simple array of provider IDs instead of full provider objects, as the detailed provider data will be handled separately.
This commit is contained in:
parent
471b1fae2d
commit
695afb6f75
@ -1,6 +1,5 @@
|
||||
// NOTE: Types are defined inline in the schema for simplicity
|
||||
// If needed, specific types can be imported from './apiModels'
|
||||
import type { OcrProvider } from '@types'
|
||||
|
||||
import type { BodyForPath, ConcreteApiPaths, QueryParamsForPath, ResponseForPath } from './apiPaths'
|
||||
import type { HttpMethod, PaginatedResponse, PaginationParams } from './apiTypes'
|
||||
@ -350,27 +349,7 @@ export interface ApiSchemas {
|
||||
|
||||
'/ocr/providers': {
|
||||
GET: {
|
||||
response: OcrProvider[]
|
||||
}
|
||||
POST: {
|
||||
body: {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'/ocr/providers/:id': {
|
||||
GET: {
|
||||
response: OcrProvider
|
||||
}
|
||||
PATCH: {
|
||||
// TODO
|
||||
}
|
||||
PUT: {
|
||||
// TODO
|
||||
}
|
||||
DELETE: {
|
||||
// TODO
|
||||
response: string[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* TypeScript will error if any endpoint is missing.
|
||||
*/
|
||||
|
||||
import { ocrService } from '@main/services/ocr/OcrService'
|
||||
import type { ApiImplementation } from '@shared/data/api/apiSchemas'
|
||||
|
||||
import { TestService } from '../services/TestService'
|
||||
@ -212,27 +213,7 @@ export const apiHandlers: ApiImplementation = {
|
||||
|
||||
'/ocr/providers': {
|
||||
GET: async () => {
|
||||
// We should implement it when user data migration completed.
|
||||
// OcrProvider should be migrate to db, because the data objects contains user settings.
|
||||
throw new Error('Not implemented')
|
||||
},
|
||||
POST: async () => {
|
||||
throw new Error('Not implemented')
|
||||
}
|
||||
},
|
||||
|
||||
'/ocr/providers/:id': {
|
||||
GET: async () => {
|
||||
throw new Error('Not implemented')
|
||||
},
|
||||
PATCH: async () => {
|
||||
throw new Error('Not implemented')
|
||||
},
|
||||
PUT: async () => {
|
||||
throw new Error('Not implemented')
|
||||
},
|
||||
DELETE: async () => {
|
||||
throw new Error('Not implemented')
|
||||
return ocrService.listProviderIds()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user