mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-20 06:31:02 +08:00
### 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
27 lines
765 B
Go
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[:])
|
|
}
|