mirror of
https://github.com/perstarkse/minne.git
synced 2026-07-08 13:55:23 +02:00
chore: git-hooks rustfmt and clippy
This commit is contained in:
@@ -109,10 +109,7 @@ impl<'a> PipelineContext<'a> {
|
||||
let content = self.take_text_content()?;
|
||||
let analysis = self.take_analysis()?;
|
||||
|
||||
let (entities, relationships) = self
|
||||
.services
|
||||
.convert_analysis(&content, &analysis)
|
||||
.await?;
|
||||
let (entities, relationships) = self.services.convert_analysis(&content, &analysis).await?;
|
||||
|
||||
let chunk_range = self.chunk_token_range();
|
||||
let chunk_overlap = self.chunk_overlap_tokens();
|
||||
|
||||
@@ -186,11 +186,7 @@ impl IngestionPipeline {
|
||||
}
|
||||
|
||||
async fn artifacts_persisted(&self, task_id: &str) -> Result<bool, AppError> {
|
||||
Ok(self
|
||||
.db
|
||||
.get_item::<TextContent>(task_id)
|
||||
.await?
|
||||
.is_some())
|
||||
Ok(self.db.get_item::<TextContent>(task_id).await?.is_some())
|
||||
}
|
||||
|
||||
async fn finalize_succeeded(&self, task: &IngestionTask) -> Result<(), AppError> {
|
||||
@@ -379,8 +375,7 @@ mod finalize_tests {
|
||||
persist_max_backoff_ms: 10,
|
||||
..IngestionTuning::default()
|
||||
};
|
||||
let pipeline =
|
||||
IngestionPipeline::with_services(Arc::new(db.clone()), config, services)?;
|
||||
let pipeline = IngestionPipeline::with_services(Arc::new(db.clone()), config, services)?;
|
||||
|
||||
let task = reserve_task(
|
||||
&db,
|
||||
@@ -397,9 +392,7 @@ mod finalize_tests {
|
||||
let processing = task.mark_processing(&db).await?;
|
||||
|
||||
db.client
|
||||
.query(
|
||||
"UPDATE type::thing('ingestion_task', $id) SET worker_id = $wrong_worker;",
|
||||
)
|
||||
.query("UPDATE type::thing('ingestion_task', $id) SET worker_id = $wrong_worker;")
|
||||
.bind(("id", processing.id.clone()))
|
||||
.bind(("wrong_worker", "wrong-worker"))
|
||||
.await?;
|
||||
@@ -410,9 +403,7 @@ mod finalize_tests {
|
||||
sleep(Duration::from_millis(5)).await;
|
||||
let _ = db_fix
|
||||
.client
|
||||
.query(
|
||||
"UPDATE type::thing('ingestion_task', $id) SET worker_id = $worker_id;",
|
||||
)
|
||||
.query("UPDATE type::thing('ingestion_task', $id) SET worker_id = $worker_id;")
|
||||
.bind(("id", task_id))
|
||||
.bind(("worker_id", worker_id))
|
||||
.await;
|
||||
@@ -420,10 +411,7 @@ mod finalize_tests {
|
||||
|
||||
pipeline.finalize_succeeded(&processing).await?;
|
||||
|
||||
let stored: IngestionTask = db
|
||||
.get_item(&processing.id)
|
||||
.await?
|
||||
.context("task stored")?;
|
||||
let stored: IngestionTask = db.get_item(&processing.id).await?.context("task stored")?;
|
||||
assert_eq!(stored.state, TaskState::Succeeded);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -133,15 +133,15 @@ pub fn large_artifacts(
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn persist(
|
||||
db: &SurrealDbClient,
|
||||
artifacts: PipelineArtifacts,
|
||||
) -> Result<(), AppError> {
|
||||
pub async fn persist(db: &SurrealDbClient, artifacts: PipelineArtifacts) -> Result<(), AppError> {
|
||||
persist_artifacts(db, &tuning(), TEST_EMBEDDING_DIM, artifacts).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn count_chunks_for_source(db: &SurrealDbClient, source_id: &str) -> anyhow::Result<usize> {
|
||||
pub async fn count_chunks_for_source(
|
||||
db: &SurrealDbClient,
|
||||
source_id: &str,
|
||||
) -> anyhow::Result<usize> {
|
||||
let chunks: Vec<TextChunk> = db
|
||||
.client
|
||||
.query("SELECT * FROM text_chunk WHERE source_id = $source_id;")
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::{
|
||||
config::{IngestionConfig, IngestionTuning},
|
||||
enrichment_result::LLMEnrichmentResult,
|
||||
services::PipelineServices,
|
||||
test_support::{
|
||||
count_chunks_for_source, count_entities_for_source, count_relationships_for_source,
|
||||
persist, sample_artifacts, setup_db,
|
||||
},
|
||||
IngestionPipeline,
|
||||
};
|
||||
use crate::pipeline::context::{EmbeddedKnowledgeEntity, EmbeddedTextChunk};
|
||||
use anyhow::{self, Context};
|
||||
use async_trait::async_trait;
|
||||
@@ -20,16 +30,6 @@ use common::{
|
||||
};
|
||||
use retrieval_pipeline::{RetrievedChunk, RetrievedEntity};
|
||||
use tokio::sync::Mutex;
|
||||
use super::{
|
||||
config::{IngestionConfig, IngestionTuning},
|
||||
enrichment_result::LLMEnrichmentResult,
|
||||
services::PipelineServices,
|
||||
test_support::{
|
||||
count_chunks_for_source, count_entities_for_source, count_relationships_for_source,
|
||||
persist, sample_artifacts, setup_db,
|
||||
},
|
||||
IngestionPipeline,
|
||||
};
|
||||
|
||||
pub(crate) struct MockServices {
|
||||
text_content: TextContent,
|
||||
@@ -221,9 +221,7 @@ impl PipelineServices for FailingServices {
|
||||
content: &TextContent,
|
||||
analysis: &LLMEnrichmentResult,
|
||||
) -> Result<(Vec<EmbeddedKnowledgeEntity>, Vec<KnowledgeRelationship>), AppError> {
|
||||
self.inner
|
||||
.convert_analysis(content, analysis)
|
||||
.await
|
||||
self.inner.convert_analysis(content, analysis).await
|
||||
}
|
||||
|
||||
async fn prepare_chunks(
|
||||
|
||||
Reference in New Issue
Block a user