Merge branch 'master' of https://code.texpixel.com/YogeLiu/doc_ai_backed
This commit is contained in:
@@ -12,10 +12,7 @@ type GetFormulaTaskResponse struct {
|
||||
Latex string `json:"latex"`
|
||||
Markdown string `json:"markdown"`
|
||||
MathML string `json:"mathml"`
|
||||
MathMLMW string `json:"mathml_mw"`
|
||||
ImageBlob string `json:"image_blob"`
|
||||
DocxURL string `json:"docx_url"`
|
||||
PDFURL string `json:"pdf_url"`
|
||||
MML string `json:"mml"`
|
||||
}
|
||||
|
||||
// FormulaRecognitionResponse 公式识别服务返回的响应
|
||||
@@ -25,7 +22,8 @@ type FormulaRecognitionResponse struct {
|
||||
|
||||
// ImageOCRResponse 图片OCR接口返回的响应
|
||||
type ImageOCRResponse struct {
|
||||
Latex string `json:"latex"` // LaTeX 格式内容
|
||||
Markdown string `json:"markdown"` // Markdown 格式内容
|
||||
Latex string `json:"latex"` // LaTeX 格式内容 (无公式时为空)
|
||||
MathML string `json:"mathml"` // MathML 格式(无公式时为空)
|
||||
MML string `json:"mml"` // MML 格式(无公式时为空)
|
||||
}
|
||||
|
||||
@@ -24,10 +24,7 @@ type TaskListDTO struct {
|
||||
Latex string `json:"latex"`
|
||||
Markdown string `json:"markdown"`
|
||||
MathML string `json:"mathml"`
|
||||
MathMLMW string `json:"mathml_mw"`
|
||||
ImageBlob string `json:"image_blob"`
|
||||
DocxURL string `json:"docx_url"`
|
||||
PDFURL string `json:"pdf_url"`
|
||||
MML string `json:"mml"`
|
||||
}
|
||||
|
||||
type TaskListResponse struct {
|
||||
|
||||
@@ -180,6 +180,7 @@ func (s *RecognitionService) GetFormualTask(ctx context.Context, taskNo string)
|
||||
Latex: taskRet.Latex,
|
||||
Markdown: markdown,
|
||||
MathML: taskRet.MathML,
|
||||
MML: taskRet.MML,
|
||||
Status: int(task.Status),
|
||||
}, nil
|
||||
}
|
||||
@@ -544,6 +545,7 @@ func (s *RecognitionService) processFormulaTask(ctx context.Context, taskID int6
|
||||
Latex: ocrResp.Latex,
|
||||
Markdown: ocrResp.Markdown,
|
||||
MathML: ocrResp.MathML,
|
||||
MML: ocrResp.MML,
|
||||
})
|
||||
if err != nil {
|
||||
log.Error(ctx, "func", "processFormulaTask", "msg", "保存任务结果失败", "error", err)
|
||||
|
||||
@@ -92,11 +92,13 @@ func (svc *TaskService) GetTaskList(ctx context.Context, req *task.TaskListReque
|
||||
var latex string
|
||||
var markdown string
|
||||
var mathML string
|
||||
var mml string
|
||||
recognitionResult := recognitionResultMap[item.ID]
|
||||
if recognitionResult != nil {
|
||||
latex = recognitionResult.Latex
|
||||
markdown = recognitionResult.Markdown
|
||||
mathML = recognitionResult.MathML
|
||||
mml = recognitionResult.MML
|
||||
}
|
||||
originURL, err := oss.GetDownloadURL(ctx, item.FileURL)
|
||||
if err != nil {
|
||||
@@ -106,6 +108,7 @@ func (svc *TaskService) GetTaskList(ctx context.Context, req *task.TaskListReque
|
||||
Latex: latex,
|
||||
Markdown: markdown,
|
||||
MathML: mathML,
|
||||
MML: mml,
|
||||
TaskID: item.TaskUUID,
|
||||
FileName: item.FileName,
|
||||
Status: int(item.Status),
|
||||
|
||||
@@ -9,8 +9,9 @@ type RecognitionResult struct {
|
||||
TaskID int64 `gorm:"column:task_id;bigint;not null;default:0;comment:任务ID" json:"task_id"`
|
||||
TaskType TaskType `gorm:"column:task_type;varchar(16);not null;comment:任务类型;default:''" json:"task_type"`
|
||||
Latex string `json:"latex" gorm:"column:latex;type:text;not null;default:''"`
|
||||
Markdown string `json:"markdown" gorm:"column:markdown;type:text;not null;default:''"` // Mathpix Markdown 格式
|
||||
Markdown string `json:"markdown" gorm:"column:markdown;type:text;not null;default:''"` // Markdown 格式
|
||||
MathML string `json:"mathml" gorm:"column:mathml;type:text;not null;default:''"` // MathML 格式
|
||||
MML string `json:"mml" gorm:"column:mml;type:text;not null;default:''"` // MML 格式
|
||||
}
|
||||
|
||||
type RecognitionResultDao struct {
|
||||
|
||||
Reference in New Issue
Block a user