mirror of
https://github.com/perstarkse/minne.git
synced 2026-06-29 05:16:26 +02:00
fix: atomic ingestion persist with task reclaim and shared cleanup.
One transaction per task replaces prior artifact rows; workers skip the pipeline when content already exists, eval seeding reuses persist_artifacts, and deletes clear graph children via shared SQL.
This commit is contained in:
@@ -5,10 +5,7 @@ use axum::{
|
||||
use axum_htmx::{HxBoosted, HxRequest, HxTarget};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use common::storage::types::{
|
||||
file_info::FileInfo, knowledge_entity::KnowledgeEntity, text_chunk::TextChunk,
|
||||
text_content::TextContent, user::User,
|
||||
};
|
||||
use common::storage::types::{file_info::FileInfo, text_content::TextContent, user::User};
|
||||
|
||||
use crate::{
|
||||
html_state::HtmlState,
|
||||
@@ -180,9 +177,7 @@ pub async fn delete_text_content(
|
||||
}
|
||||
}
|
||||
|
||||
// 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?;
|
||||
TextContent::clear_ingested_children(&id, &user.id, &state.db).await?;
|
||||
|
||||
// Delete the text content
|
||||
state.db.delete_item::<TextContent>(&id).await?;
|
||||
|
||||
@@ -23,9 +23,7 @@ use common::storage::types::user::DashboardStats;
|
||||
use common::{
|
||||
error::AppError,
|
||||
storage::types::{
|
||||
file_info::FileInfo, ingestion_task::IngestionTask, knowledge_entity::KnowledgeEntity,
|
||||
knowledge_relationship::KnowledgeRelationship, text_chunk::TextChunk,
|
||||
text_content::TextContent, user::User,
|
||||
file_info::FileInfo, ingestion_task::IngestionTask, text_content::TextContent, user::User,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -81,11 +79,7 @@ pub async fn delete_text_content(
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the text content and any related data
|
||||
TextChunk::delete_by_source_id(&text_content.id, &state.db).await?;
|
||||
KnowledgeEntity::delete_by_source_id(&text_content.id, &state.db).await?;
|
||||
KnowledgeRelationship::delete_relationships_by_source_id(&text_content.id, &user.id, &state.db)
|
||||
.await?;
|
||||
TextContent::clear_ingested_children(&text_content.id, &user.id, &state.db).await?;
|
||||
state
|
||||
.db
|
||||
.delete_item::<TextContent>(&text_content.id)
|
||||
|
||||
Reference in New Issue
Block a user