Aggiorna la gestione degli stati di ingestione e modifica l'intervallo di aggiornamento dei documenti

This commit is contained in:
andrea.terzani
2025-04-14 12:56:26 +02:00
parent c00b708006
commit 913ae66195

View File

@@ -162,7 +162,7 @@ const initFilters = () => {
initFilters(); initFilters();
const statuses = ref(['NEW', 'LOADED', 'INGESTED', 'FAILED', 'ERROR']); // Add your statuses here const statuses = ref(['NEW', 'LOADED', 'INGESTED', 'FAILED', 'ERROR', 'INGESTION_QUEUE', 'INGESTING']); // Add your statuses here
onMounted(() => { onMounted(() => {
userPrefStore.fetchUserData().then(() => { userPrefStore.fetchUserData().then(() => {
@@ -170,7 +170,7 @@ onMounted(() => {
setInterval(() => { setInterval(() => {
updateDocuments(); updateDocuments();
}, 10000); }, 5000);
}); });
@@ -195,15 +195,15 @@ function updateDocuments() {
}; };
const allDocumentsIngested = computed(() => { const allDocumentsIngested = computed(() => {
return ksdocuments.value && ksdocuments.value.every(doc => doc.ingestionStatus === 'INGESTED'); return ksdocuments.value && ksdocuments.value.every(doc => doc.ingestionStatus == 'INGESTED');
}); });
const getStatus = (data) => { const getStatus = (data) => {
if (data.ingestionStatus === 'INGESTED') { if (data.ingestionStatus == 'INGESTED') {
return 'success'; return 'success';
} else if (data.ingestionStatus === 'LOADED' || data.ingestionStatus === 'ERROR') { } else if (data.ingestionStatus == 'LOADED' || data.ingestionStatus == 'ERROR') {
return 'danger'; return 'danger';
} else if (data.ingestionStatus === 'IN PROGRESS') { } else if (data.ingestionStatus == 'IN PROGRESS' || data.ingestionStatus == 'INGESTION_QUEUE' || data.ingestionStatus == 'INGESTING') {
return 'info'; return 'info';
} else { } else {
return 'warning'; return 'warning';
@@ -319,12 +319,12 @@ const confirmDeleteFromVectorStore = (id) => {
//ingestion //ingestion
const startIndividualngestion = (id) => { const startIndividualngestion = (id) => {
toast.add({ severity: 'info', summary: 'Info', detail: 'Starting Ingestion', life: 3000 }); toast.add({ severity: 'info', summary: 'Info', detail: 'Starting Ingestion', life: 3000 });
fe_status = "IN PROGRESS" fe_status = "INGESTION_QUEUE"
axios.get(`/test/ingest_document/${id}`) axios.get(`/test/ingest_document/${id}`)
.then(response => { .then(response => {
if (response.data.status == "OK") { if (response.data.status == "OK") {
toast.add({ severity: 'success', summary: 'Success', detail: 'Document ingestion started...', life: 3000 }); toast.add({ severity: 'success', summary: 'Success', detail: 'Document ingestion started...', life: 3000 });
fe_status = "IN PROGRESS" fe_status = "INGESTION_QUEUE"
} }
if (response.data.status == "ERROR") { if (response.data.status == "ERROR") {
toast.add({ severity: 'error', summary: 'Success', detail: 'Error ingesting document:' + response.data.message, life: 3000 }); toast.add({ severity: 'error', summary: 'Success', detail: 'Error ingesting document:' + response.data.message, life: 3000 });