ingst chat message added

This commit is contained in:
Christoph K.
2026-03-12 19:20:05 +01:00
parent 5337e7af6f
commit 75003b9534
2 changed files with 50 additions and 0 deletions

View File

@@ -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 }