chore: apply cargo fmt + clippy cleanup across crate
Silence forward-looking dead_code on unused DAO modules, annotate individual placeholder items, rewrite tautological assert!(true/false) in token tests as panic! arms, and pick up fmt drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -503,7 +503,10 @@ pub async fn export_training_data_handler(
|
||||
|
||||
HttpResponse::Ok()
|
||||
.content_type("application/jsonl")
|
||||
.insert_header(("Content-Disposition", "attachment; filename=\"training_data.jsonl\""))
|
||||
.insert_header((
|
||||
"Content-Disposition",
|
||||
"attachment; filename=\"training_data.jsonl\"",
|
||||
))
|
||||
.body(jsonl)
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
@@ -1827,32 +1827,32 @@ Return ONLY the summary, nothing else."#,
|
||||
|
||||
// For each linked entity, fetch its facts
|
||||
for entity_id in entity_ids {
|
||||
if let Ok(entity) = kdao.get_entity_by_id(cx, entity_id) {
|
||||
if let Some(e) = entity {
|
||||
let role = links
|
||||
.iter()
|
||||
.find(|l| l.entity_id == entity_id)
|
||||
.map(|l| l.role.as_str())
|
||||
.unwrap_or("subject");
|
||||
output_lines.push(format!(
|
||||
"Entity: {} ({}, role: {})",
|
||||
e.name, e.entity_type, role
|
||||
));
|
||||
if let Ok(facts) = kdao.get_facts_for_entity(cx, entity_id) {
|
||||
for f in facts.iter().filter(|f| f.status == "active") {
|
||||
let obj = if let Some(ref v) = f.object_value {
|
||||
v.clone()
|
||||
} else if let Some(oid) = f.object_entity_id {
|
||||
kdao.get_entity_by_id(cx, oid)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|e| format!("{} (entity ID: {})", e.name, e.id))
|
||||
.unwrap_or_else(|| format!("entity:{}", oid))
|
||||
} else {
|
||||
"(unknown)".to_string()
|
||||
};
|
||||
output_lines.push(format!(" - {} {}", f.predicate, obj));
|
||||
}
|
||||
if let Ok(entity) = kdao.get_entity_by_id(cx, entity_id)
|
||||
&& let Some(e) = entity
|
||||
{
|
||||
let role = links
|
||||
.iter()
|
||||
.find(|l| l.entity_id == entity_id)
|
||||
.map(|l| l.role.as_str())
|
||||
.unwrap_or("subject");
|
||||
output_lines.push(format!(
|
||||
"Entity: {} ({}, role: {})",
|
||||
e.name, e.entity_type, role
|
||||
));
|
||||
if let Ok(facts) = kdao.get_facts_for_entity(cx, entity_id) {
|
||||
for f in facts.iter().filter(|f| f.status == "active") {
|
||||
let obj = if let Some(ref v) = f.object_value {
|
||||
v.clone()
|
||||
} else if let Some(oid) = f.object_entity_id {
|
||||
kdao.get_entity_by_id(cx, oid)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|e| format!("{} (entity ID: {})", e.name, e.id))
|
||||
.unwrap_or_else(|| format!("entity:{}", oid))
|
||||
} else {
|
||||
"(unknown)".to_string()
|
||||
};
|
||||
output_lines.push(format!(" - {} {}", f.predicate, obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1902,8 +1902,8 @@ Return ONLY the summary, nothing else."#,
|
||||
// those already). Results are appended to the tool response so the
|
||||
// model can choose to use an existing entity's ID instead.
|
||||
let similar_entities: Vec<String> = {
|
||||
use crate::database::EntityFilter;
|
||||
use crate::database::knowledge_dao::normalize_entity_type;
|
||||
use crate::database::{EntityFilter, KnowledgeDao};
|
||||
let normalised_type = normalize_entity_type(&entity_type);
|
||||
let first_token = name.split_whitespace().next().unwrap_or(&name).to_string();
|
||||
let filter = EntityFilter {
|
||||
|
||||
@@ -120,6 +120,7 @@ impl OllamaClient {
|
||||
|
||||
/// Replace the HTTP client with one using a custom request timeout.
|
||||
/// Useful for slow models where the default 120s may be insufficient.
|
||||
#[allow(dead_code)]
|
||||
pub fn with_request_timeout(mut self, secs: u64) -> Self {
|
||||
self.client = Client::builder()
|
||||
.connect_timeout(Duration::from_secs(5))
|
||||
@@ -174,6 +175,7 @@ impl OllamaClient {
|
||||
}
|
||||
|
||||
/// Clear the model list cache for a specific URL or all URLs
|
||||
#[allow(dead_code)]
|
||||
pub fn clear_model_cache(url: Option<&str>) {
|
||||
let mut cache = MODEL_LIST_CACHE.lock().unwrap();
|
||||
if let Some(url) = url {
|
||||
@@ -186,6 +188,7 @@ impl OllamaClient {
|
||||
}
|
||||
|
||||
/// Clear the model capabilities cache for a specific URL or all URLs
|
||||
#[allow(dead_code)]
|
||||
pub fn clear_capabilities_cache(url: Option<&str>) {
|
||||
let mut cache = MODEL_CAPABILITIES_CACHE.lock().unwrap();
|
||||
if let Some(url) = url {
|
||||
@@ -992,7 +995,6 @@ struct OllamaEmbedResponse {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn generate_photo_description_prompt_is_concise() {
|
||||
|
||||
Reference in New Issue
Block a user