mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-25 05:54:29 +00:00
Context compaction dropped the user's system prompt and replaced it with the summary. compact_messages_for_request() treated messages[0] (the chat system prompt, re-prepended in middleware) as ordinary history: _find_compaction_boundary always folded it into the compacted slice, and _apply_latest_summary_checkpoint's messages[summary_idx:] slice cut it off on every subsequent turn. The function then returned only recent_messages with no system role, so add_or_update_system_message(..., append=True) had nothing to append to and inserted a summary-only system message instead. The system_prompt argument was used purely for token estimation, never to exempt it from compaction. Pop a leading system message on entry and re-prepend it on every return path, so the summarizer never sees it and append=True appends the summary to the real system prompt as intended. Fixes #26710 |
||
|---|---|---|
| .. | ||
| data | ||
| internal | ||
| migrations | ||
| models | ||
| retrieval | ||
| routers | ||
| socket | ||
| static | ||
| storage | ||
| tools | ||
| utils | ||
| __init__.py | ||
| alembic.ini | ||
| config.py | ||
| constants.py | ||
| env.py | ||
| events.py | ||
| functions.py | ||
| main.py | ||
| tasks.py | ||