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