diff --git a/private_gpt/settings/settings.py b/private_gpt/settings/settings.py index 4cf192a3e..875ab171d 100644 --- a/private_gpt/settings/settings.py +++ b/private_gpt/settings/settings.py @@ -350,6 +350,10 @@ class AzureOpenAISettings(BaseModel): class UISettings(BaseModel): enabled: bool path: str + default_mode: str = Field( + "RAG", + description="The default mode.", + ) default_chat_system_prompt: str = Field( None, description="The default system prompt to use for the chat mode.", diff --git a/private_gpt/ui/ui.py b/private_gpt/ui/ui.py index 2c1dcd3e2..1e3804ad4 100644 --- a/private_gpt/ui/ui.py +++ b/private_gpt/ui/ui.py @@ -98,10 +98,12 @@ def __init__( self._selected_filename = None + self._default_mode = settings().ui.default_mode # Initialize system prompt based on default mode - self.mode = MODES[0] + self.mode = self._default_mode self._system_prompt = self._get_default_system_prompt(self.mode) + def _chat( self, message: str, history: list[list[str]], mode: Modes, *_: Any ) -> Any: @@ -390,7 +392,7 @@ def _build_ui_blocks(self) -> gr.Blocks: with gr.Row(equal_height=False): with gr.Column(scale=3): - default_mode = MODES[0] + default_mode = self._default_mode mode = gr.Radio( [mode.value for mode in MODES], label="Mode",