mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-26 02:38:31 +02:00
fix: remove remnant job table, normalize taskstatus enum
This commit is contained in:
@@ -7,7 +7,7 @@ use axum_htmx::{HxBoosted, HxRequest};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use common::storage::types::{
|
||||
conversation::Conversation, file_info::FileInfo, text_content::TextContent, user::User,
|
||||
conversation::Conversation, file_info::FileInfo, text_content::TextContent, user::User, knowledge_entity::KnowledgeEntity, text_chunk::TextChunk,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -138,6 +138,10 @@ pub async fn delete_text_content(
|
||||
FileInfo::delete_by_id(&file_info.id, &state.db).await?;
|
||||
}
|
||||
|
||||
// Delete related knowledge entities and text chunks
|
||||
KnowledgeEntity::delete_by_source_id(&id, &state.db).await?;
|
||||
TextChunk::delete_by_source_id(&id, &state.db).await?;
|
||||
|
||||
// Delete the text content
|
||||
state.db.delete_item::<TextContent>(&id).await?;
|
||||
|
||||
|
||||
@@ -186,9 +186,9 @@ pub async fn get_task_updates_stream(
|
||||
format!("In progress, attempt {}", attempts)
|
||||
}
|
||||
IngestionTaskStatus::Completed => "Completed".to_string(),
|
||||
IngestionTaskStatus::Error(ref err_msg) => {
|
||||
IngestionTaskStatus::Error { message } => {
|
||||
// Providing a user-friendly error message from the status
|
||||
format!("Error: {}", err_msg)
|
||||
format!("Error: {}", message)
|
||||
}
|
||||
IngestionTaskStatus::Cancelled => "Cancelled".to_string(),
|
||||
};
|
||||
@@ -197,9 +197,9 @@ pub async fn get_task_updates_stream(
|
||||
|
||||
// Check for terminal states to close the stream
|
||||
match updated_task.status {
|
||||
IngestionTaskStatus::Completed |
|
||||
IngestionTaskStatus::Error(_) |
|
||||
IngestionTaskStatus::Cancelled => {
|
||||
IngestionTaskStatus::Completed
|
||||
| IngestionTaskStatus::Error { .. }
|
||||
| IngestionTaskStatus::Cancelled => {
|
||||
// Send a specific event that HTMX uses to close the connection
|
||||
// Send a event to reload the recent content
|
||||
// Send a event to remove the loading indicatior
|
||||
|
||||
Reference in New Issue
Block a user