moved entry points to bin to clarify

This commit is contained in:
Per Stark
2024-11-22 12:33:47 +01:00
parent 1e789e1153
commit bd99b11e1a
6 changed files with 12 additions and 6 deletions

1
Cargo.lock generated
View File

@@ -5387,7 +5387,6 @@ dependencies = [
"axum",
"axum_typed_multipart",
"futures",
"futures-lite 2.3.0",
"lapin",
"mime",
"mime_guess",

View File

@@ -8,7 +8,6 @@ async-openai = "0.24.1"
axum = { version = "0.7.5", features = ["multipart", "macros"] }
axum_typed_multipart = "0.12.1"
futures = "0.3.31"
futures-lite = "2.3.0"
lapin = { version = "2.5.0", features = ["serde_json"] }
mime = "0.3.17"
mime_guess = "2.0.5"
@@ -29,8 +28,8 @@ uuid = { version = "1.10.0", features = ["v4", "serde"] }
[[bin]]
name = "server"
path = "src/server.rs"
path = "src/bin/server.rs"
[[bin]]
name = "consumer"
path = "src/consumer.rs"
name = "worker"
path = "src/bin/worker.rs"

View File

@@ -1,3 +1,5 @@
use std::time::Instant;
use text_splitter::TextSplitter;
use tracing::{debug, info};
@@ -35,11 +37,17 @@ impl ContentProcessor {
// Store original content
store_item(&self.db_client, content.clone()).await?;
let now = Instant::now();
// Process in parallel where possible
let (analysis, _similar_chunks) = tokio::try_join!(
self.perform_semantic_analysis(content),
self.find_similar_content(content),
)?;
let end = now.elapsed();
info!(
"{:?} time elapsed during creation of entities and relationships",
end
);
// Convert and store entities
let (entities, relationships) = analysis

View File

@@ -1,4 +1,4 @@
use futures_lite::stream::StreamExt;
use futures::StreamExt;
use lapin::{message::Delivery, options::*, types::FieldTable, Channel, Consumer, Queue};
use crate::{