Files
open-webui/backend/open_webui
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
..
2026-03-06 20:12:37 -06:00
2026-03-06 20:12:37 -06:00
2025-08-10 00:02:58 +04:00
2026-02-11 16:24:11 -06:00
2026-02-21 14:19:28 -06:00
2026-03-07 17:13:19 -06:00
2026-03-07 17:29:24 -06:00
2025-04-15 09:55:35 +02:00
2026-03-06 20:12:37 -06:00
2026-02-11 16:24:11 -06:00
2026-02-12 15:29:34 -06:00