mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-24 00:51:27 +00:00
Chat search built each result row with ChatTitleIdResponse(**chat.model_dump(), ...), which recursively copies the entire chat blob per row only for the constructor to ignore everything except id, title and timestamps: a 60-row search page deep-copied up to 60 full conversations. The folder listing, archived and export endpoints and every single-chat response did the same dump-and-revalidate dance via ChatResponse(**chat.model_dump()). Search rows are now built from the five fields the response actually has (the snippet helper receives the blob by reference as before), and all 18 ChatResponse constructions use ChatResponse.model_validate(chat, from_attributes=True), which reads the fields off the already-validated ChatModel without copying the blob. Benchmark (~500 KB chat blob): | metric | before | after | | --- | --- | --- | | search result row | 0.05 ms | 0.003 ms | | ChatResponse construction | 0.05 ms | 0.003 ms | | per search page (60 rows) | 3 ms | 0.2 ms | Beyond CPU, each converted row also stops materializing a second full copy of the conversation in memory while the page is being built. Functionally verified: both construction styles produce identical model_dump() output for ChatResponse (including defaulted fields absent on ChatModel) and for search rows including the snippet. |
||
|---|---|---|
| .. | ||
| analytics.py | ||
| audio.py | ||
| auths.py | ||
| automations.py | ||
| calendar.py | ||
| channels.py | ||
| chats.py | ||
| configs.py | ||
| evaluations.py | ||
| files.py | ||
| folders.py | ||
| functions.py | ||
| groups.py | ||
| images.py | ||
| knowledge.py | ||
| memories.py | ||
| models.py | ||
| notes.py | ||
| notifications.py | ||
| ollama.py | ||
| openai.py | ||
| pipelines.py | ||
| prompts.py | ||
| retrieval.py | ||
| scim.py | ||
| skills.py | ||
| tasks.py | ||
| terminals.py | ||
| tools.py | ||
| users.py | ||
| utils.py | ||