models: align translation column naming + add token counts
Three recently-added tables (strategic_log_translations, indicator_summary_translations, csv_format_templates) drifted from the codebase's existing naming convention: - llm_model -> model - llm_cost_usd -> cost_usd - content_md -> content (on the two translation tables; csv_format doesn't have a content field) Also added prompt_tokens and completion_tokens to the three tables; they were silently dropped at write time despite LogResult exposing them. All writer call sites (ai_log_job, indicator_summary_job, llm_csv_parser) and reader call sites (api.py localized helpers) updated to match. Tests realigned. Migration 0025 uses batch_alter_table for SQLite compatibility. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
e4dc6d0071
commit
a6d686324c
8 changed files with 125 additions and 32 deletions
|
|
@ -74,10 +74,12 @@ async def translate_log_for_active_languages(session, log_id: int) -> None:
|
|||
translated_md, llm_result = result
|
||||
session.add(StrategicLogTranslation(
|
||||
log_id=log_id, lang=lang,
|
||||
content_md=translated_md,
|
||||
content=translated_md,
|
||||
generated_at=utcnow(),
|
||||
llm_model=llm_result.model,
|
||||
llm_cost_usd=llm_result.cost_usd,
|
||||
model=llm_result.model,
|
||||
prompt_tokens=llm_result.prompt_tokens,
|
||||
completion_tokens=llm_result.completion_tokens,
|
||||
cost_usd=llm_result.cost_usd,
|
||||
))
|
||||
await session.commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -77,10 +77,12 @@ async def translate_summary_for_active_languages(session, summary_id: int) -> No
|
|||
translated_md, llm_result = result
|
||||
session.add(IndicatorSummaryTranslation(
|
||||
summary_id=summary_id, lang=lang,
|
||||
content_md=translated_md,
|
||||
content=translated_md,
|
||||
generated_at=utcnow(),
|
||||
llm_model=llm_result.model,
|
||||
llm_cost_usd=llm_result.cost_usd,
|
||||
model=llm_result.model,
|
||||
prompt_tokens=llm_result.prompt_tokens,
|
||||
completion_tokens=llm_result.completion_tokens,
|
||||
cost_usd=llm_result.cost_usd,
|
||||
))
|
||||
await session.commit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue