feat: add mml
This commit is contained in:
@@ -3,7 +3,6 @@ package service
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.com/bitwsd/document_ai/internal/model/task"
|
"gitea.com/bitwsd/document_ai/internal/model/task"
|
||||||
@@ -87,13 +86,12 @@ func (svc *TaskService) GetTaskList(ctx context.Context, req *task.TaskListReque
|
|||||||
for _, item := range tasks {
|
for _, item := range tasks {
|
||||||
var latex string
|
var latex string
|
||||||
var markdown string
|
var markdown string
|
||||||
|
var mathML 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
|
||||||
if markdown == "" {
|
mathML = recognitionResult.MathML
|
||||||
markdown = fmt.Sprintf("$$%s$$", latex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
originURL, err := oss.GetDownloadURL(ctx, item.FileURL)
|
originURL, err := oss.GetDownloadURL(ctx, item.FileURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -102,6 +100,7 @@ func (svc *TaskService) GetTaskList(ctx context.Context, req *task.TaskListReque
|
|||||||
resp.TaskList = append(resp.TaskList, &task.TaskListDTO{
|
resp.TaskList = append(resp.TaskList, &task.TaskListDTO{
|
||||||
Latex: latex,
|
Latex: latex,
|
||||||
Markdown: markdown,
|
Markdown: markdown,
|
||||||
|
MathML: mathML,
|
||||||
TaskID: item.TaskUUID,
|
TaskID: item.TaskUUID,
|
||||||
FileName: item.FileName,
|
FileName: item.FileName,
|
||||||
Status: int(item.Status),
|
Status: int(item.Status),
|
||||||
|
|||||||
Reference in New Issue
Block a user