mirror of
https://github.com/perstarkse/minne.git
synced 2026-05-28 10:29:30 +02:00
chore: resolve remaining uninlined_format_args clippy warnings
This commit is contained in:
@@ -275,10 +275,9 @@ impl KnowledgeEntity {
|
|||||||
db_client: &SurrealDbClient,
|
db_client: &SurrealDbClient,
|
||||||
ai_client: &Client<OpenAIConfig>,
|
ai_client: &Client<OpenAIConfig>,
|
||||||
) -> Result<(), AppError> {
|
) -> Result<(), AppError> {
|
||||||
let embedding_input = format!(
|
let embedding_input = format!(
|
||||||
"name: {}, description: {}, type: {:?}",
|
"name: {name}, description: {description}, type: {entity_type:?}",
|
||||||
name, description, entity_type
|
);
|
||||||
);
|
|
||||||
let embedding = generate_embedding(ai_client, &embedding_input, db_client).await?;
|
let embedding = generate_embedding(ai_client, &embedding_input, db_client).await?;
|
||||||
let user_id = Self::get_user_id_by_id(id, db_client).await?;
|
let user_id = Self::get_user_id_by_id(id, db_client).await?;
|
||||||
let emb = KnowledgeEntityEmbedding::new(id, embedding, user_id);
|
let emb = KnowledgeEntityEmbedding::new(id, embedding, user_id);
|
||||||
@@ -398,7 +397,7 @@ impl KnowledgeEntity {
|
|||||||
|
|
||||||
// Add all update statements to the embedding table
|
// Add all update statements to the embedding table
|
||||||
for (id, (embedding, user_id)) in new_embeddings {
|
for (id, (embedding, user_id)) in new_embeddings {
|
||||||
let embedding_str = serde_json::to_string(&embedding)
|
let embedding = serde_json::to_string(&embedding)
|
||||||
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
||||||
write!(
|
write!(
|
||||||
transaction_query,
|
transaction_query,
|
||||||
@@ -408,9 +407,6 @@ impl KnowledgeEntity {
|
|||||||
user_id = '{user_id}', \
|
user_id = '{user_id}', \
|
||||||
created_at = IF created_at != NONE THEN created_at ELSE time::now() END, \
|
created_at = IF created_at != NONE THEN created_at ELSE time::now() END, \
|
||||||
updated_at = time::now();",
|
updated_at = time::now();",
|
||||||
id = id,
|
|
||||||
embedding = embedding_str,
|
|
||||||
user_id = user_id,
|
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
||||||
}
|
}
|
||||||
@@ -521,7 +517,7 @@ impl KnowledgeEntity {
|
|||||||
let mut transaction_query = String::from("BEGIN TRANSACTION;");
|
let mut transaction_query = String::from("BEGIN TRANSACTION;");
|
||||||
|
|
||||||
for (id, (embedding, user_id)) in new_embeddings {
|
for (id, (embedding, user_id)) in new_embeddings {
|
||||||
let embedding_str = serde_json::to_string(&embedding)
|
let embedding = serde_json::to_string(&embedding)
|
||||||
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
||||||
write!(
|
write!(
|
||||||
transaction_query,
|
transaction_query,
|
||||||
@@ -531,9 +527,6 @@ impl KnowledgeEntity {
|
|||||||
user_id = '{user_id}', \
|
user_id = '{user_id}', \
|
||||||
created_at = time::now(), \
|
created_at = time::now(), \
|
||||||
updated_at = time::now();",
|
updated_at = time::now();",
|
||||||
id = id,
|
|
||||||
embedding = embedding_str,
|
|
||||||
user_id = user_id,
|
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ impl TextChunk {
|
|||||||
let mut transaction_query = String::from("BEGIN TRANSACTION;");
|
let mut transaction_query = String::from("BEGIN TRANSACTION;");
|
||||||
|
|
||||||
for (id, (embedding, user_id, source_id)) in new_embeddings {
|
for (id, (embedding, user_id, source_id)) in new_embeddings {
|
||||||
let embedding_str = serde_json::to_string(&embedding)
|
let embedding = serde_json::to_string(&embedding)
|
||||||
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
||||||
write!(
|
write!(
|
||||||
&mut transaction_query,
|
&mut transaction_query,
|
||||||
@@ -302,10 +302,6 @@ impl TextChunk {
|
|||||||
user_id = '{user_id}', \
|
user_id = '{user_id}', \
|
||||||
created_at = IF created_at != NONE THEN created_at ELSE time::now() END, \
|
created_at = IF created_at != NONE THEN created_at ELSE time::now() END, \
|
||||||
updated_at = time::now();",
|
updated_at = time::now();",
|
||||||
id = id,
|
|
||||||
embedding = embedding_str,
|
|
||||||
source_id = source_id,
|
|
||||||
user_id = user_id,
|
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
||||||
}
|
}
|
||||||
@@ -406,7 +402,7 @@ impl TextChunk {
|
|||||||
let mut transaction_query = String::from("BEGIN TRANSACTION;");
|
let mut transaction_query = String::from("BEGIN TRANSACTION;");
|
||||||
|
|
||||||
for (id, (embedding, user_id, source_id)) in new_embeddings {
|
for (id, (embedding, user_id, source_id)) in new_embeddings {
|
||||||
let embedding_str = serde_json::to_string(&embedding)
|
let embedding = serde_json::to_string(&embedding)
|
||||||
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
.map_err(|e| AppError::InternalError(format!("embedding serialization failed: {e}")))?;
|
||||||
write!(
|
write!(
|
||||||
&mut transaction_query,
|
&mut transaction_query,
|
||||||
@@ -417,10 +413,6 @@ impl TextChunk {
|
|||||||
user_id = '{user_id}', \
|
user_id = '{user_id}', \
|
||||||
created_at = time::now(), \
|
created_at = time::now(), \
|
||||||
updated_at = time::now();",
|
updated_at = time::now();",
|
||||||
id = id,
|
|
||||||
embedding = embedding_str,
|
|
||||||
source_id = source_id,
|
|
||||||
user_id = user_id,
|
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user