mirror of
https://github.com/perstarkse/minne.git
synced 2026-07-08 13:55:23 +02:00
release: 1.0.5
fix fix
This commit is contained in:
@@ -7,14 +7,14 @@ use chrono::Utc;
|
||||
use common::storage::{
|
||||
db::SurrealDbClient,
|
||||
indexes::maybe_run_scheduled_index_rebuild,
|
||||
types::ingestion_task::{IngestionTask, DEFAULT_LEASE_SECS},
|
||||
types::ingestion_task::{DEFAULT_LEASE_SECS, IngestionTask},
|
||||
};
|
||||
pub use pipeline::{
|
||||
persist_artifacts, EmbeddedKnowledgeEntity, EmbeddedTextChunk, IngestionConfig,
|
||||
IngestionPipeline, IngestionTuning, PipelineArtifacts,
|
||||
EmbeddedKnowledgeEntity, EmbeddedTextChunk, IngestionConfig, IngestionPipeline,
|
||||
IngestionTuning, PipelineArtifacts, persist_artifacts,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use tokio::time::{sleep, Duration};
|
||||
use tokio::time::{Duration, sleep};
|
||||
use tracing::{error, info, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ use tracing::{debug, info, warn};
|
||||
use self::{
|
||||
context::PipelineContext,
|
||||
stages::{enrich, persist, prepare_content, retrieve_related},
|
||||
state::{ready, Enriched, IngestionMachine},
|
||||
state::{Enriched, IngestionMachine, ready},
|
||||
};
|
||||
|
||||
/// Wall-clock duration of each pre-persistence pipeline stage.
|
||||
@@ -355,10 +355,10 @@ mod finalize_tests {
|
||||
use tokio::time::sleep;
|
||||
|
||||
use super::{
|
||||
IngestionPipeline, PipelineServices,
|
||||
config::IngestionTuning,
|
||||
test_support::setup_db,
|
||||
tests::{pipeline_config, reserve_task, MockServices},
|
||||
IngestionPipeline, PipelineServices,
|
||||
tests::{MockServices, pipeline_config, reserve_task},
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -12,14 +12,13 @@ use common::{
|
||||
storage::{
|
||||
db::SurrealDbClient,
|
||||
types::{
|
||||
knowledge_entity::KnowledgeEntity,
|
||||
EmbeddingRecord, StoredObject, knowledge_entity::KnowledgeEntity,
|
||||
knowledge_entity_embedding::KnowledgeEntityEmbedding, text_chunk::TextChunk,
|
||||
text_chunk_embedding::TextChunkEmbedding, text_content::TextContent, EmbeddingRecord,
|
||||
StoredObject,
|
||||
text_chunk_embedding::TextChunkEmbedding, text_content::TextContent,
|
||||
},
|
||||
},
|
||||
};
|
||||
use tokio::time::{sleep, Duration};
|
||||
use tokio::time::{Duration, sleep};
|
||||
use tracing::warn;
|
||||
|
||||
use super::{
|
||||
@@ -268,8 +267,8 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::pipeline::test_support::{
|
||||
self, count_chunks_for_source, count_entities_for_source, count_relationships_for_source,
|
||||
large_artifacts, persist, sample_artifacts, setup_db, TEST_EMBEDDING_DIM,
|
||||
self, TEST_EMBEDDING_DIM, count_chunks_for_source, count_entities_for_source,
|
||||
count_relationships_for_source, large_artifacts, persist, sample_artifacts, setup_db,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -15,14 +15,14 @@ use common::{
|
||||
db::SurrealDbClient,
|
||||
store::StorageManager,
|
||||
types::{
|
||||
ingestion_payload::IngestionPayload, knowledge_relationship::KnowledgeRelationship,
|
||||
system_settings::SystemSettings, text_chunk::TextChunk, text_content::TextContent,
|
||||
StoredObject,
|
||||
StoredObject, ingestion_payload::IngestionPayload,
|
||||
knowledge_relationship::KnowledgeRelationship, system_settings::SystemSettings,
|
||||
text_chunk::TextChunk, text_content::TextContent,
|
||||
},
|
||||
},
|
||||
utils::{config::AppConfig, embedding::EmbeddingProvider},
|
||||
};
|
||||
use retrieval_pipeline::{reranking::RerankerPool, retrieved_entities_to_json, RetrievedEntity};
|
||||
use retrieval_pipeline::{RetrievedEntity, reranking::RerankerPool, retrieved_entities_to_json};
|
||||
use text_splitter::{ChunkCapacity, ChunkConfig, TextSplitter};
|
||||
|
||||
use super::{enrichment_result::LLMEnrichmentResult, preparation::to_text_content};
|
||||
@@ -358,7 +358,7 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Context;
|
||||
use async_openai::{config::OpenAIConfig, types::chat::ChatCompletionRequestMessage, Client};
|
||||
use async_openai::{Client, config::OpenAIConfig, types::chat::ChatCompletionRequestMessage};
|
||||
use common::{
|
||||
storage::{
|
||||
db::SurrealDbClient, store::StorageManager, types::system_settings::SystemSettingsPatch,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::{
|
||||
IngestionPipeline,
|
||||
config::{IngestionConfig, IngestionTuning},
|
||||
enrichment_result::LLMEnrichmentResult,
|
||||
services::PipelineServices,
|
||||
@@ -8,7 +9,6 @@ use super::{
|
||||
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};
|
||||
@@ -405,9 +405,11 @@ async fn ingestion_pipeline_happy_path_persists_artifacts() -> anyhow::Result<()
|
||||
call_log.get(0..4),
|
||||
Some(&["prepare", "retrieve", "enrich", "convert"][..])
|
||||
);
|
||||
assert!(call_log
|
||||
.get(4..)
|
||||
.is_some_and(|tail| tail.iter().all(|entry| *entry == "chunk")));
|
||||
assert!(
|
||||
call_log
|
||||
.get(4..)
|
||||
.is_some_and(|tail| tail.iter().all(|entry| *entry == "chunk"))
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -38,11 +38,11 @@ async fn materialize_temp_file(
|
||||
let mut path = env::temp_dir();
|
||||
let mut file_name = format!("minne-ingest-{}", Uuid::new_v4());
|
||||
|
||||
if let Some(ext) = extension {
|
||||
if !ext.is_empty() {
|
||||
file_name.push('.');
|
||||
file_name.push_str(ext);
|
||||
}
|
||||
if let Some(ext) = extension
|
||||
&& !ext.is_empty()
|
||||
{
|
||||
file_name.push('.');
|
||||
file_name.push_str(ext);
|
||||
}
|
||||
|
||||
path.push(file_name);
|
||||
@@ -142,7 +142,7 @@ pub async fn extract_text_from_file(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use async_openai::{config::OpenAIConfig, Client};
|
||||
use async_openai::{Client, config::OpenAIConfig};
|
||||
use bytes::Bytes;
|
||||
use chrono::Utc;
|
||||
use common::{
|
||||
|
||||
@@ -3,7 +3,7 @@ use async_openai::types::chat::{
|
||||
ChatCompletionRequestMessageContentPartTextArgs, ChatCompletionRequestUserMessageArgs,
|
||||
CreateChatCompletionRequestArgs, ImageDetail, ImageUrlArgs,
|
||||
};
|
||||
use base64::{engine::general_purpose::STANDARD, Engine as _};
|
||||
use base64::{Engine as _, engine::general_purpose::STANDARD};
|
||||
use common::{
|
||||
error::AppError,
|
||||
storage::{db::SurrealDbClient, types::system_settings::SystemSettings},
|
||||
|
||||
@@ -148,20 +148,27 @@ async fn maybe_dump_debug_image(page_index: u32, bytes: &[u8]) -> Result<(), App
|
||||
mod tests {
|
||||
use super::*;
|
||||
use anyhow::{self};
|
||||
use lopdf::dictionary;
|
||||
use lopdf::Object;
|
||||
use lopdf::dictionary;
|
||||
|
||||
#[test]
|
||||
fn test_debug_dump_directory_env_var() -> anyhow::Result<()> {
|
||||
std::env::remove_var(DEBUG_IMAGE_ENV_VAR);
|
||||
// SAFETY: test runs serially; env is restored before return.
|
||||
unsafe {
|
||||
std::env::remove_var(DEBUG_IMAGE_ENV_VAR);
|
||||
}
|
||||
assert!(debug_dump_directory().is_none());
|
||||
|
||||
std::env::set_var(DEBUG_IMAGE_ENV_VAR, "/tmp/minne_pdf_debug");
|
||||
unsafe {
|
||||
std::env::set_var(DEBUG_IMAGE_ENV_VAR, "/tmp/minne_pdf_debug");
|
||||
}
|
||||
let dir =
|
||||
debug_dump_directory().ok_or_else(|| anyhow::anyhow!("expected debug directory"))?;
|
||||
assert_eq!(dir, PathBuf::from("/tmp/minne_pdf_debug"));
|
||||
|
||||
std::env::remove_var(DEBUG_IMAGE_ENV_VAR);
|
||||
unsafe {
|
||||
std::env::remove_var(DEBUG_IMAGE_ENV_VAR);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use async_openai::types::chat::{
|
||||
ChatCompletionRequestMessageContentPartTextArgs, ChatCompletionRequestUserMessageArgs,
|
||||
CreateChatCompletionRequest, CreateChatCompletionRequestArgs, ImageDetail, ImageUrlArgs,
|
||||
};
|
||||
use base64::{engine::general_purpose::STANDARD, Engine as _};
|
||||
use base64::{Engine as _, engine::general_purpose::STANDARD};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use common::{
|
||||
|
||||
Reference in New Issue
Block a user