Changeset 0.20.0 (#85)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.gobha.me/xcaliber/chat-switchboard/models"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/notifications"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/storage"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/store"
|
||||
)
|
||||
@@ -85,6 +86,10 @@ func (ing *Ingester) IngestDocument(kb *models.KnowledgeBase, doc *models.KBDocu
|
||||
log.Printf("❌ ingest doc %s (%s): %v", doc.ID, doc.Filename, err)
|
||||
ing.stores.KnowledgeBases.UpdateDocumentStatus(ctx, doc.ID, "error", &errMsg)
|
||||
ing.stores.KnowledgeBases.Update(ctx, kb.ID, map[string]interface{}{"status": "active"})
|
||||
// Notify document owner of ingestion failure (v0.20.0)
|
||||
if svc := notifications.Default(); svc != nil {
|
||||
notifications.NotifyKBError(svc, userID, kb.ID, kb.Name, errMsg)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -205,6 +210,11 @@ func (ing *Ingester) ingest(ctx context.Context, kb *models.KnowledgeBase, doc *
|
||||
log.Printf(" ✓ ingest complete: %s (%d chunks, %s)",
|
||||
doc.Filename, len(chunks), time.Since(start).Round(time.Millisecond))
|
||||
|
||||
// Notify document owner of successful ingestion (v0.20.0)
|
||||
if svc := notifications.Default(); svc != nil {
|
||||
notifications.NotifyKBReady(svc, userID, kb.ID, kb.Name, len(chunks))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user