Go: add office_oxide and parse docx file. (#15976)

### What problem does this PR solve?

As title.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-06-12 20:28:15 +08:00
committed by GitHub
parent 4115282c5f
commit 234f1b7cff
15 changed files with 504 additions and 15 deletions

View File

@@ -29,6 +29,8 @@ import (
"os/exec"
"path/filepath"
"ragflow/internal/ingestion"
"ragflow/internal/ingestion/parser"
"ragflow/internal/utility"
"strings"
"time"
)
@@ -3249,6 +3251,22 @@ func (c *CLI) UserParseLocalFile(cmd *Command) (ResponseIf, error) {
docParseModel = ""
}
fileType := utility.GetFileType(filename)
fileParser, err := parser.GetParser(fileType)
if err != nil {
return nil, err
}
fileContent, err := os.ReadFile(filename)
if err != nil {
return nil, fmt.Errorf("failed to read dsl file: %w", err)
}
if err = fileParser.Parse(filename, fileContent); err != nil {
return nil, formatRequestError("parse local file", err)
}
var result SimpleResponse
result.Code = 0
result.Message = fmt.Sprintf("Success to parse local file %q, vision: %v, chat: %v, asr: %v, ocr: %v, embedding: %v, doc_parse: %v", filename, visionModel, chatModel, asrModel, ocrModel, embeddingModel, docParseModel)