Skip to content

Commit

Permalink
Add default mode option to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason committed Sep 10, 2024
1 parent 4262859 commit a5e796f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions private_gpt/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
6 changes: 4 additions & 2 deletions private_gpt/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit a5e796f

Please sign in to comment.