feat: Add support for sending notification after knowledge base processing

This commit is contained in:
n4ze3m
2024-07-16 00:37:50 +05:30
parent f5f0157260
commit 9c8584f1c4
14 changed files with 383 additions and 307 deletions

View File

@@ -12,6 +12,7 @@ import { PageAssisCSVUrlLoader } from "@/loader/csv"
import { PageAssisTXTUrlLoader } from "@/loader/txt"
import { PageAssistDocxLoader } from "@/loader/docx"
import { cleanUrl } from "./clean-url"
import { sendEmbeddingCompleteNotification } from "./send-notification"
export const processKnowledge = async (msg: any, id: string): Promise<void> => {
@@ -102,6 +103,8 @@ export const processKnowledge = async (msg: any, id: string): Promise<void> => {
}
await updateKnowledgeStatus(id, "finished")
await sendEmbeddingCompleteNotification()
} catch (error) {
console.error(`Error processing knowledge with id: ${id}`, error)
await updateKnowledgeStatus(id, "failed")