import { defHttp } from '@/utils/http/axios'

export interface OCRReqVo {
  file: File | Blob | null
  msg: string
}

export interface OCRRespVo {
  markdown: string
  json: string
}

/**
 * com.wmyun.module.system.controller.admin.forward.OCRController#OCRinterface
 * OCR识别
 * @param data markdown格式
 */
export function getOcrResult(data: OCRReqVo) {
  const formData = new FormData()
  if (data.file)
    formData.append('file', data.file)

  formData.append('mag', data.msg)
  return defHttp.post<OCRRespVo>({ url: '/system/ocr/OCRinterface', data: formData, headers: {
    'Content-Type': 'multipart/form-data',
  } })
}
