insight-chat: code-review polish on the system-prompt split

- Use Option::map instead of manual match-on-Option (drops clippy::manual_map).
- Drop redundant `max_iterations = max_iterations` from the format! call.
- Use captured identifiers consistently in the user_content format!.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-05-07 14:27:59 -04:00
parent 8ae4099d46
commit 177187f6a2

View File

@@ -2980,7 +2980,6 @@ Return ONLY the summary, nothing else."#,
- Use recall_facts_for_photo + recall_entities to load any prior knowledge about subjects in the photo.\n\
- When you identify people / places / events / things, use store_entity + store_fact to grow the persistent memory.\n\
- A tool returning no results is informative; continue with the others.",
max_iterations = max_iterations
);
let mut out = identity;
@@ -3344,8 +3343,8 @@ Return ONLY the summary, nothing else."#,
// (when supplied) is the authoritative identity — the framework
// never appends a competing "you are a personal photo memory
// assistant" line. The procedural block stays identity-free.
let owner_id_note = match owner_entity_id {
Some(id) => Some(format!(
let owner_id_note = owner_entity_id.map(|id| {
format!(
"\n\nYour identity in the knowledge store: {name} (entity ID: {id}). \
When storing facts where you ({name}) are the object — for example, someone is your friend, \
sibling, or colleague — use subject_entity_id for the other person and set object_value to \
@@ -3353,9 +3352,8 @@ Return ONLY the summary, nothing else."#,
{name} directly, use {id} as the subject_entity_id.",
name = owner_name,
id = id
)),
None => None,
};
)
});
let fewshot_block = Self::render_fewshot_examples(&fewshot_examples);
let system_content = Self::build_system_content(
custom_system_prompt.as_deref(),
@@ -3397,18 +3395,13 @@ Return ONLY the summary, nothing else."#,
// and summary" claim that used to live here was unused (the title is
// regenerated post-hoc from the summary by generate_photo_title).
let user_content = format!(
"{visual_block}Photo file path: {}\n\
Date taken: {}\n\
{}\n\
{}\n\
{}\n\n\
"{visual_block}Photo file path: {file_path}\n\
Date taken: {date}\n\
{contact_info}\n\
{gps_info}\n\
{tags_info}\n\n\
Gather context with the available tools, then respond.",
file_path,
date_taken.format("%B %d, %Y"),
contact_info,
gps_info,
tags_info,
visual_block = visual_block,
date = date_taken.format("%B %d, %Y"),
);
// 10. Define tools. Hybrid mode omits `describe_photo` since the