mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-07 08:17:07 +00:00
fix: keep the selected model in sync when regenerating a response
Switching the model in the dropdown and regenerating a response left the chat's stored model list pointing at the model that was used when the user message was first sent. Leaving the chat and coming back restored that stale entry, so the dropdown kept snapping back to the original model (and could even show a model that is no longer used by any response in the chat, or one that no longer exists). The chat's model list is persisted from the user message's `models` field, which is written when the message is created and was never refreshed afterwards. Regeneration is the one send path that reuses an existing user message, so it now refreshes that field from the current selection. Side-by-side turns are left untouched: those regenerate the clicked column and keep their full model list, which is also what the column grouping in MultiResponseMessages relies on. Fixes #25052
This commit is contained in:
parent
29541cbb52
commit
15d09e21ca
1 changed files with 7 additions and 2 deletions
|
|
@ -3554,6 +3554,12 @@
|
|||
scrollToBottom();
|
||||
}
|
||||
|
||||
// Single-model turns follow the current selection; side-by-side turns regenerate the clicked column.
|
||||
const isSideBySideTurn = (userMessage.models ?? selectedModels).length > 1;
|
||||
if (!isSideBySideTurn) {
|
||||
userMessage.models = selectedModels;
|
||||
}
|
||||
|
||||
await sendMessage(history, userMessage.id, {
|
||||
...(suggestionPrompt
|
||||
? {
|
||||
|
|
@ -3561,9 +3567,8 @@
|
|||
regenerationPrompt: suggestionPrompt
|
||||
}
|
||||
: {}),
|
||||
...((userMessage?.models ?? [...selectedModels]).length > 1
|
||||
...(isSideBySideTurn
|
||||
? {
|
||||
// If multiple models are selected, use the model from the message
|
||||
modelId: message.model,
|
||||
modelIdx: message.modelIdx
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue