完善二维码池 OCR 配置与识别

This commit is contained in:
yml
2026-06-18 15:22:46 +08:00
parent e8bdf574f4
commit 35f2d93fdf
16 changed files with 1025 additions and 48 deletions
@@ -6,12 +6,15 @@ export type QrCodeStatus = 'unused' | 'used' | 'disabled'
export interface ChatQrCode {
id: number
image_url: string
group_name: string
status: QrCodeStatus
conversation_id: number | null
bound_conversation_title: string
used_at: string | null
expires_at: string | null
created_by: number
note: string
wecom_renamed: boolean
created_at: string
updated_at: string
}
@@ -23,6 +26,12 @@ export interface QrCodeStats {
total_count: number
}
export interface QrCodeOcrResult {
group_name: string
candidates: string[]
raw_text: string
}
export interface QrCodeListQuery {
status?: QrCodeStatus
page?: number
@@ -31,14 +40,17 @@ export interface QrCodeListQuery {
export interface CreateQrCodePayload {
image_url: string
group_name?: string
note?: string
expires_at?: string | null
}
export interface UpdateQrCodePayload {
image_url?: string
group_name?: string
note?: string
status?: QrCodeStatus
wecom_renamed?: boolean
expires_at?: string | null
clear_expires_at?: boolean
}
@@ -73,6 +85,20 @@ export async function batchCreateQrCodes(items: CreateQrCodePayload[]) {
return data.data
}
export async function recognizeQrCodeGroupName(file: File) {
const form = new FormData()
form.append('file', file)
const { data } = await apiClient.post<ApiResponse<QrCodeOcrResult>>(
'/admin/chats/qrcodes/ocr-group-name',
form,
{
headers: { 'Content-Type': 'multipart/form-data' },
silent: true,
}
)
return data.data
}
export async function updateQrCode(id: number, payload: UpdateQrCodePayload) {
const { data } = await apiClient.patch<ApiResponse<ChatQrCode>>(
`/admin/chats/qrcodes/${id}`,