Commit 80e1d112 authored by Wade's avatar Wade

update grap param

parent 786b69d4
......@@ -130,13 +130,20 @@ func main() {
UserName: input.Username,
}
if _, ok := input.Metadata[graphrag.DocNameKey]; !ok {
resDocName :=""
if v, ok := input.Metadata[graphrag.DocNameKey]; !ok {
// Generate random docName.
docName, err := graphrag.GenerateRandomDocName(8)
if err != nil {
return "", fmt.Errorf("generate random docName for document %w", err)
}
input.Metadata[graphrag.DocNameKey] = docName
resDocName = docName
}else{
if str, isString := v.(string); isString {
resDocName = str
}
}
doc := ai.DocumentFromText(input.Content, input.Metadata)
......@@ -147,7 +154,7 @@ func main() {
if err != nil {
return "", fmt.Errorf("index document: %w", err)
}
return "Document indexed successfully", nil
return fmt.Sprintf("Document indexed successfully, docname %s",resDocName), nil
})
// Define a simple flow that generates jokes about a given topic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment