Files
open-webui-ai4me/backend/open_webui/migrations/versions
Classic298 b4f340806a fix: migration streaming/batching (#21542)
* fix: normalize usage tokens + migration streaming/batching

- Migration: replace .fetchall() with yield_per streaming, replace per-message INSERT+SAVEPOINT with batched inserts (5k/batch) with fallback to row-by-row on error, add progress logging

- Write path: call normalize_usage() in upsert_message() before saving to ensure input_tokens/output_tokens always present

- Read path: analytics queries now COALESCE across input_tokens/prompt_tokens and output_tokens/completion_tokens so historical data with OpenAI-format keys is visible

* fix: restore defensive timestamp conversion in migration

Re-add try/except around int(float(timestamp)) that was accidentally dropped. Without this, a non-numeric timestamp string would cause a TypeError on the subsequent comparison, breaking the entire upgrade.

* revert: remove changes to chat_messages.py
2026-03-07 19:08:11 -05:00
..
2024-10-14 13:45:09 -07:00
2025-12-02 11:00:34 -05:00
wip
2024-12-10 00:54:13 -08:00
2025-05-03 18:16:32 +04:00
2024-12-22 22:08:27 -07:00
2026-02-11 14:26:56 -06:00
2024-10-02 21:14:58 -07:00