mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-08 03:08:02 +00:00
fix: handle non-dict history/messages in chat_message migration (#22588)
Some databases contain chat records where 'history' or 'messages' are
stored as lists instead of dicts. This causes an AttributeError
('list' object has no attribute 'items') during the
8452d01d26d7_add_chat_message_table migration.
Add isinstance checks to skip chat records with unexpected data shapes
gracefully, matching the existing pattern used for individual message
validation.
This commit is contained in:
parent
a407a7f1c0
commit
06657b8109
1 changed files with 5 additions and 0 deletions
|
|
@ -151,7 +151,12 @@ def upgrade() -> None:
|
|||
continue
|
||||
|
||||
history = chat_data.get("history", {})
|
||||
if not isinstance(history, dict):
|
||||
continue
|
||||
|
||||
messages = history.get("messages", {})
|
||||
if not isinstance(messages, dict):
|
||||
continue
|
||||
|
||||
for message_id, message in messages.items():
|
||||
if not isinstance(message, dict):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue