feat: per-chat model configuration override#1291
Open
cezarlugullo wants to merge 1 commit intoagent0ai:developmentfrom
Open
feat: per-chat model configuration override#1291cezarlugullo wants to merge 1 commit intoagent0ai:developmentfrom
cezarlugullo wants to merge 1 commit intoagent0ai:developmentfrom
Conversation
Allow users to set a custom model for individual chats without changing the global settings. - Add a 'tune' button next to each chat in the sidebar - Opens a modal where users can toggle custom model on/off - When enabled, the chat uses its own provider/model/params - Override is persisted and re-applied when chat is reloaded - Fallback to global settings when custom override is disabled New files: - helpers/chat_model_override.py - helper (get/set/apply) - api/chat_model_get.py - GET endpoint - api/chat_model_set.py - SET endpoint - webui/components/modals/chat-model/ - modal UI + Alpine.js store - tests/test_chat_model_per_chat_override.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the ability for users to set a custom model for individual chats without changing the global settings.
Problem
Currently, changing the chat model affects all conversations. Users who want to test different models or use a specific model for a particular task must change the global settings back and forth.
Solution
A per-chat model override that lets users toggle a custom model configuration on any chat:
How it works
Backend
helpers/chat_model_override.py— core logic:get_override(),set_override(),apply_override()api/chat_model_get.py— GET endpoint returning current model config (global or custom)api/chat_model_set.py— SET endpoint to enable/disable/update the overridehelpers/persist_chat.py— 4 lines added to re-apply override on chat deserializationFrontend
x-datastore, dynamic import)Tests
tests/test_chat_model_per_chat_override.py— unit tests covering:Screenshots
The modal follows the existing UI style. A small tune icon appears next to each chat name in the sidebar.
Checklist
development