fmt: cargo fmt sweep
No logic changes - line reflow, brace placement, and method-chain splits across handlers / personas / state / faces / knowledge / insights_dao / knowledge_dao / populate_knowledge. Picked up incidentally while running fmt for the sms-search work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -384,13 +384,9 @@ where
|
||||
.route(web::delete().to(delete_fact::<D>)),
|
||||
)
|
||||
.service(
|
||||
web::resource("/facts/{id}/supersede")
|
||||
.route(web::post().to(supersede_fact::<D>)),
|
||||
)
|
||||
.service(
|
||||
web::resource("/facts/{id}/restore")
|
||||
.route(web::post().to(restore_fact::<D>)),
|
||||
web::resource("/facts/{id}/supersede").route(web::post().to(supersede_fact::<D>)),
|
||||
)
|
||||
.service(web::resource("/facts/{id}/restore").route(web::post().to(restore_fact::<D>)))
|
||||
.service(web::resource("/recent").route(web::get().to(get_recent::<D>)))
|
||||
.service(
|
||||
web::resource("/consolidation-proposals")
|
||||
@@ -546,10 +542,7 @@ async fn get_entity<D: KnowledgeDao + 'static>(
|
||||
// either bound treats that side as unbounded — a fact with no
|
||||
// valid-time data still flags against any time period (worst case
|
||||
// for legacy data; user adds dates to suppress).
|
||||
fn intervals_overlap(
|
||||
a: (Option<i64>, Option<i64>),
|
||||
b: (Option<i64>, Option<i64>),
|
||||
) -> bool {
|
||||
fn intervals_overlap(a: (Option<i64>, Option<i64>), b: (Option<i64>, Option<i64>)) -> bool {
|
||||
let a_lo = a.0.unwrap_or(i64::MIN);
|
||||
let a_hi = a.1.unwrap_or(i64::MAX);
|
||||
let b_lo = b.0.unwrap_or(i64::MIN);
|
||||
@@ -574,8 +567,7 @@ async fn get_entity<D: KnowledgeDao + 'static>(
|
||||
}
|
||||
for (a_pos, &i) in indices.iter().enumerate() {
|
||||
for &j in &indices[a_pos + 1..] {
|
||||
let same_object = facts[i].object_entity_id
|
||||
== facts[j].object_entity_id
|
||||
let same_object = facts[i].object_entity_id == facts[j].object_entity_id
|
||||
&& facts[i].object_value == facts[j].object_value;
|
||||
if same_object {
|
||||
continue;
|
||||
@@ -806,8 +798,7 @@ async fn synthesize_merge<D: KnowledgeDao + 'static>(
|
||||
preamble, no labels, no quotes.";
|
||||
let prompt = format!(
|
||||
"Entity A: {} [{}]\nDescription: {}\n\nEntity B: {} [{}]\nDescription: {}\n\nMerged description:",
|
||||
source.name, source.entity_type, source_desc,
|
||||
target.name, target.entity_type, target_desc,
|
||||
source.name, source.entity_type, source_desc, target.name, target.entity_type, target_desc,
|
||||
);
|
||||
|
||||
let ollama = app_state.ollama.clone();
|
||||
@@ -843,16 +834,12 @@ async fn synthesize_merge<D: KnowledgeDao + 'static>(
|
||||
s = stripped.trim_start().to_string();
|
||||
}
|
||||
// Wrapping quotes
|
||||
s = s
|
||||
.trim_matches(|c| c == '"' || c == '\'')
|
||||
.to_string();
|
||||
s = s.trim_matches(|c| c == '"' || c == '\'').to_string();
|
||||
// Inline emphasis: drop standalone `**` / `*` / `__` /
|
||||
// `_` markers without trying to parse markdown — just
|
||||
// remove the punctuation. Rare enough that this naive
|
||||
// replace is fine.
|
||||
s = s
|
||||
.replace("**", "")
|
||||
.replace("__", "");
|
||||
s = s.replace("**", "").replace("__", "");
|
||||
s
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -965,7 +952,10 @@ async fn create_fact<D: KnowledgeDao + 'static>(
|
||||
// pin a specific persona for writes via X-Persona-Id.
|
||||
let persona = resolve_persona_filter(&req, &claims, &persona_dao);
|
||||
let (user_id, persona_id) = match &persona {
|
||||
PersonaFilter::Single { user_id, persona_id } => (*user_id, persona_id.clone()),
|
||||
PersonaFilter::Single {
|
||||
user_id,
|
||||
persona_id,
|
||||
} => (*user_id, persona_id.clone()),
|
||||
PersonaFilter::All { user_id } => (*user_id, "default".to_string()),
|
||||
};
|
||||
|
||||
@@ -1113,8 +1103,9 @@ async fn supersede_fact<D: KnowledgeDao + 'static>(
|
||||
// the PATCH path.
|
||||
match dao.supersede_fact(&cx, old_id, body.by_fact_id, Some(("manual", "manual"))) {
|
||||
Ok(Some(fact)) => HttpResponse::Ok().json(fact),
|
||||
Ok(None) => HttpResponse::NotFound()
|
||||
.json(serde_json::json!({"error": "Old or new fact not found"})),
|
||||
Ok(None) => {
|
||||
HttpResponse::NotFound().json(serde_json::json!({"error": "Old or new fact not found"}))
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("supersede_fact error: {:?}", e);
|
||||
HttpResponse::InternalServerError().json(serde_json::json!({"error": "Database error"}))
|
||||
@@ -1132,8 +1123,7 @@ async fn restore_fact<D: KnowledgeDao + 'static>(
|
||||
let mut dao = dao.lock().expect("Unable to lock KnowledgeDao");
|
||||
match dao.revert_supersession(&cx, fact_id, Some(("manual", "manual"))) {
|
||||
Ok(Some(fact)) => HttpResponse::Ok().json(fact),
|
||||
Ok(None) => HttpResponse::NotFound()
|
||||
.json(serde_json::json!({"error": "Fact not found"})),
|
||||
Ok(None) => HttpResponse::NotFound().json(serde_json::json!({"error": "Fact not found"})),
|
||||
Err(e) => {
|
||||
log::error!("restore_fact error: {:?}", e);
|
||||
HttpResponse::InternalServerError().json(serde_json::json!({"error": "Database error"}))
|
||||
|
||||
Reference in New Issue
Block a user