Files
ragflow/internal/service/document_upload_helpers.go
Jack 10c00a9614 Feat: add built in DSL file API (#17003)
### Summary

1. list and get by id API for builtin DSL
2. add DSL default component param values validation
3. remove all hard code keys for parser config
2026-07-18 11:00:08 +08:00

27 lines
765 B
Go

package service
import (
"encoding/hex"
pipelinepkg "ragflow/internal/ingestion/pipeline"
"ragflow/internal/utility"
"github.com/zeebo/xxh3"
)
// selectUploadParser resolves the parser_id for a document by delegating to
// the builtin pipeline registry, which owns the file-type-to-parser mapping.
func selectUploadParser(docType utility.FileType, filename, defaultParser string) string {
registry, err := pipelinepkg.DefaultRegistry()
if err != nil || registry == nil {
return defaultParser
}
return registry.DefaultParserID(string(docType), filename, defaultParser)
}
// contentHashHex mirrors Python xxhash.xxh128(blob).hexdigest().
func contentHashHex(blob []byte) string {
sum := xxh3.Hash128(blob).Bytes()
return hex.EncodeToString(sum[:])
}