diff --git a/crates/html-router/src/middlewares/response_middleware.rs b/crates/html-router/src/middlewares/response_middleware.rs
index 630b3d4..203af37 100644
--- a/crates/html-router/src/middlewares/response_middleware.rs
+++ b/crates/html-router/src/middlewares/response_middleware.rs
@@ -94,7 +94,7 @@ impl TemplateResponse {
pub fn redirect(path: impl Into) -> Self {
Self {
template_kind: TemplateKind::Redirect(path.into()),
- context: Value::from_serialize(&()),
+ context: Value::from_serialize(()),
}
}
}
diff --git a/crates/html-router/src/router_factory.rs b/crates/html-router/src/router_factory.rs
index 6becb3d..ae07534 100644
--- a/crates/html-router/src/router_factory.rs
+++ b/crates/html-router/src/router_factory.rs
@@ -38,13 +38,15 @@ macro_rules! create_asset_service {
}};
}
+pub type MiddleWareVecType = Vec) -> Router + Send>>;
+
pub struct RouterFactory {
app_state: HtmlState,
public_routers: Vec>,
protected_routers: Vec>,
nested_routes: Vec<(String, Router)>,
nested_protected_routes: Vec<(String, Router)>,
- custom_middleware: Vec) -> Router + Send>>,
+ custom_middleware: MiddleWareVecType,
public_assets_config: Option,
}
diff --git a/crates/html-router/src/routes/account/handlers.rs b/crates/html-router/src/routes/account/handlers.rs
index 1cbbb35..6aec7dd 100644
--- a/crates/html-router/src/routes/account/handlers.rs
+++ b/crates/html-router/src/routes/account/handlers.rs
@@ -112,7 +112,7 @@ pub async fn show_change_password(
) -> Result {
Ok(TemplateResponse::new_template(
"auth/change_password_form.html",
- {},
+ (),
))
}
@@ -138,6 +138,6 @@ pub async fn change_password(
Ok(TemplateResponse::new_partial(
"auth/account_settings.html",
"change_password_section",
- {},
+ (),
))
}
diff --git a/crates/html-router/src/routes/auth/signin.rs b/crates/html-router/src/routes/auth/signin.rs
index 3f7e813..1c6771d 100644
--- a/crates/html-router/src/routes/auth/signin.rs
+++ b/crates/html-router/src/routes/auth/signin.rs
@@ -31,9 +31,9 @@ pub async fn show_signin_form(
true => Ok(TemplateResponse::new_partial(
"auth/signin_form.html",
"body",
- {},
+ (),
)),
- false => Ok(TemplateResponse::new_template("auth/signin_form.html", {})),
+ false => Ok(TemplateResponse::new_template("auth/signin_form.html", ())),
}
}
diff --git a/crates/html-router/src/routes/auth/signup.rs b/crates/html-router/src/routes/auth/signup.rs
index 6d58e48..0e4dc3d 100644
--- a/crates/html-router/src/routes/auth/signup.rs
+++ b/crates/html-router/src/routes/auth/signup.rs
@@ -33,9 +33,9 @@ pub async fn show_signup_form(
true => Ok(TemplateResponse::new_partial(
"auth/signup_form.html",
"body",
- {},
+ (),
)),
- false => Ok(TemplateResponse::new_template("auth/signup_form.html", {})),
+ false => Ok(TemplateResponse::new_template("auth/signup_form.html", ())),
}
}
diff --git a/crates/html-router/src/routes/ingestion/handlers.rs b/crates/html-router/src/routes/ingestion/handlers.rs
index 41d5abb..026fb1f 100644
--- a/crates/html-router/src/routes/ingestion/handlers.rs
+++ b/crates/html-router/src/routes/ingestion/handlers.rs
@@ -92,7 +92,7 @@ pub async fn process_ingress_form(
input
.files
.into_iter()
- .map(|file| FileInfo::new(file, &state.db, &user.id).map_err(|e| AppError::from(e))),
+ .map(|file| FileInfo::new(file, &state.db, &user.id).map_err(AppError::from)),
)
.await?;
diff --git a/crates/html-router/src/routes/knowledge/handlers.rs b/crates/html-router/src/routes/knowledge/handlers.rs
index 18288e6..49c82ad 100644
--- a/crates/html-router/src/routes/knowledge/handlers.rs
+++ b/crates/html-router/src/routes/knowledge/handlers.rs
@@ -85,7 +85,7 @@ pub async fn show_knowledge_page(
let edge_trace = Scatter3D::new(edge_x, edge_y, edge_z)
.mode(Mode::Lines)
.line(Line::new().color("#888").width(2.0))
- .hover_template(&format!(
+ .hover_template(format!(
"Relationship: {}
",
rel.metadata.relationship_type
))
diff --git a/crates/ingestion-pipeline/src/types/mod.rs b/crates/ingestion-pipeline/src/types/mod.rs
index 98a7e4f..7880d46 100644
--- a/crates/ingestion-pipeline/src/types/mod.rs
+++ b/crates/ingestion-pipeline/src/types/mod.rs
@@ -6,18 +6,18 @@ use async_openai::types::{
ChatCompletionRequestSystemMessage, ChatCompletionRequestUserMessage,
CreateChatCompletionRequestArgs,
};
+use common::storage::db::SurrealDbClient;
use common::{
error::AppError,
storage::types::{
- file_info::FileInfo, ingestion_payload::IngestionPayload, text_content::TextContent,
- system_settings::SystemSettings,
+ file_info::FileInfo, ingestion_payload::IngestionPayload, system_settings::SystemSettings,
+ text_content::TextContent,
},
};
use reqwest;
use scraper::{Html, Selector};
use std::fmt::Write;
use tiktoken_rs::{o200k_base, CoreBPE};
-use common::storage::db::SurrealDbClient;
pub async fn to_text_content(
ingestion_payload: IngestionPayload,
@@ -34,11 +34,11 @@ pub async fn to_text_content(
let text = fetch_text_from_url(&url, openai_client, db_client).await?;
Ok(TextContent::new(
text,
- instructions.into(),
- category.into(),
+ instructions,
+ category,
None,
- Some(url.into()),
- user_id.into(),
+ Some(url),
+ user_id,
))
}
IngestionPayload::Text {
@@ -47,12 +47,12 @@ pub async fn to_text_content(
category,
user_id,
} => Ok(TextContent::new(
- text.into(),
- instructions.into(),
- category.into(),
+ text,
+ instructions,
+ category,
None,
None,
- user_id.into(),
+ user_id,
)),
IngestionPayload::File {
file_info,
@@ -63,11 +63,11 @@ pub async fn to_text_content(
let text = extract_text_from_file(&file_info).await?;
Ok(TextContent::new(
text,
- instructions.into(),
- category.into(),
- Some(file_info.to_owned()),
+ instructions,
+ category,
+ Some(file_info),
None,
- user_id.into(),
+ user_id,
))
}
}
@@ -124,7 +124,7 @@ async fn fetch_text_from_url(
.replace(|c: char| c.is_control(), " ")
.replace(" ", " ");
- process_web_content(content, openai_client, &db_client).await
+ process_web_content(content, openai_client, db_client).await
}
pub async fn process_web_content(
@@ -181,13 +181,15 @@ pub async fn process_web_content(
.build()?;
let response = openai_client.chat().create(request).await?;
-
+
// Extract and return the content
response
.choices
.first()
.and_then(|choice| choice.message.content.clone())
- .ok_or(AppError::LLMParsing("No content found in LLM response".into()))
+ .ok_or(AppError::LLMParsing(
+ "No content found in LLM response".into(),
+ ))
}
fn truncate_content(