修复 ocr 错误
This commit is contained in:
@@ -34,6 +34,13 @@ export interface QrCodeOcrResult {
|
||||
raw_text: string
|
||||
}
|
||||
|
||||
export interface OCRJobRecord {
|
||||
paddle_job_id: string
|
||||
status: 'submitted' | 'running' | 'done' | 'failed'
|
||||
result: QrCodeOcrResult | null
|
||||
error: string
|
||||
}
|
||||
|
||||
export interface QrCodeListQuery {
|
||||
status?: QrCodeStatus
|
||||
keyword?: string
|
||||
@@ -121,6 +128,28 @@ export async function recognizeQrCodeGroupName(file: File) {
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function submitOCRJob(file: File) {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
const { data } = await apiClient.post<ApiResponse<{ job_id: string }>>(
|
||||
'/admin/chats/qrcodes/ocr-group-name/async',
|
||||
form,
|
||||
{
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
silent: true,
|
||||
}
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function getOCRJobResult(jobId: string) {
|
||||
const { data } = await apiClient.get<ApiResponse<OCRJobRecord>>(
|
||||
`/admin/chats/qrcodes/ocr-group-name/async/${jobId}`,
|
||||
{ silent: true }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function updateQrCode(id: number, payload: UpdateQrCodePayload) {
|
||||
const { data } = await apiClient.patch<ApiResponse<ChatQrCode>>(
|
||||
`/admin/chats/qrcodes/${id}`,
|
||||
|
||||
Reference in New Issue
Block a user