ingst chat message added
This commit is contained in:
@@ -234,4 +234,21 @@ func ingestChunks(ctx context.Context, embClient *openai.Client, pointsClient pb
|
||||
return err
|
||||
}
|
||||
|
||||
// IngestChatMessage speichert eine einzelne Chat-Nachricht in Qdrant.
|
||||
func IngestChatMessage(text, author, source string) error {
|
||||
ctx := context.Background()
|
||||
ctx = metadata.AppendToOutgoingContext(ctx, "api-key", config.Cfg.Qdrant.APIKey)
|
||||
|
||||
embClient := config.NewEmbeddingClient()
|
||||
conn := config.NewQdrantConn()
|
||||
defer conn.Close()
|
||||
|
||||
ensureCollection(ctx, pb.NewCollectionsClient(conn))
|
||||
pointsClient := pb.NewPointsClient(conn)
|
||||
|
||||
fullText := fmt.Sprintf("[%s] %s", author, text)
|
||||
c := chunk{Text: fullText, Source: source, Type: "chat"}
|
||||
return ingestChunks(ctx, embClient, pointsClient, []chunk{c})
|
||||
}
|
||||
|
||||
func boolPtr(b bool) *bool { return &b }
|
||||
|
||||
Reference in New Issue
Block a user