fix: persist token counts and fix agentic insight_id mapping

- Add prompt_eval_count and eval_count columns to photo_insights so
  token usage from llama-swap/Ollama is stored and returned by the API
- Fix agentic generator return: was (prompt_eval_count, eval_count),
  handler destructured first element as insight_id — now returns
  (insight_id, prompt_eval_count, eval_count)
- Wire prompt_eval_count/eval_count from DB into PhotoInsightResponse
  instead of hardcoded None

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-05-27 13:47:57 -04:00
parent 449ce1fda1
commit 9654d256f4
6 changed files with 31 additions and 9 deletions
+6
View File
@@ -524,6 +524,8 @@ impl InsightChatService {
min_p: req.min_p,
system_prompt: req.system_prompt.clone(),
persona_id: req.persona_id.clone(),
prompt_eval_count: None,
eval_count: None,
};
let cx = opentelemetry::Context::new();
let mut dao = self.insight_dao.lock().expect("Unable to lock InsightDao");
@@ -878,6 +880,8 @@ impl InsightChatService {
min_p: req.min_p,
system_prompt: req.system_prompt.clone(),
persona_id: req.persona_id.clone(),
prompt_eval_count: None,
eval_count: None,
};
let cx = opentelemetry::Context::new();
let mut dao = self.insight_dao.lock().expect("Unable to lock InsightDao");
@@ -1073,6 +1077,8 @@ impl InsightChatService {
min_p: req.min_p,
system_prompt: req.system_prompt.clone(),
persona_id: req.persona_id.clone(),
prompt_eval_count: None,
eval_count: None,
};
let stored = {
let cx = opentelemetry::Context::new();