Port PR14140 and PR16881 to GO (#17102)

### Summary

Port
https://github.com/infiniflow/ragflow/pull/14140/
https://github.com/infiniflow/ragflow/pull/16881
This commit is contained in:
qinling0210
2026-07-21 17:46:23 +08:00
committed by GitHub
parent 20b760f266
commit 0189ca3700
19 changed files with 570 additions and 152 deletions

View File

@@ -382,11 +382,14 @@ func pagesFromDispatch(pages []schema.Page) [][]byte {
// at rag/flow/parser/parser.py:_invoke — the downstream chunker
// / tokenizer / extractor components read the matching family
// key, with "pages" as the universal fallback shape.
func buildParserOutputs(parsed []schema.Page, dispatched parserDispatchResult, name string, fileType utility.FileType) map[string]any {
func buildParserOutputs(parsed []schema.Page, dispatched parserDispatchResult, name string, fileType utility.FileType, lang string) map[string]any {
out := map[string]any{
"pages": toAnyPages(parsed),
"name": name,
}
if lang != "" {
out["lang"] = lang
}
if dispatched.Err == nil && dispatched.OutputFormat != "" {
out["output_format"] = dispatched.OutputFormat
switch dispatched.OutputFormat {