mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #21542] [MERGED] fix: migration streaming/batching #49179
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21542
Author: @Classic298
Created: 2/17/2026
Status: ✅ Merged
Merged: 3/8/2026
Merged by: @tjbck
Base:
dev← Head:fix-analytics-usage-v2📝 Commits (4)
caed925fix: normalize usage tokens + migration streaming/batchingbdccf02fix: restore defensive timestamp conversion in migration64520d2Merge branch 'dev' into fix-analytics-usage-v2fb65a25revert: remove changes to chat_messages.py📊 Changes
1 file changed (+78 additions, -38 deletions)
View changed files
📝
backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py(+78 -38)📄 Description
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
https://github.com/open-webui/open-webui/issues/21347
https://github.com/open-webui/open-webui/discussions/21539
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.