expose tunings.
This commit is contained in:
15
gui.py
15
gui.py
@@ -374,7 +374,9 @@ class App:
|
||||
# ---- global settings from config.toml ----
|
||||
ai_cfg = self.config.get("ai", {})
|
||||
self.current_provider: str = ai_cfg.get("provider", "gemini")
|
||||
self.current_model: str = ai_cfg.get("model", "gemini-2.0-flash")
|
||||
self.current_model: str = ai_cfg.get("model", "gemini-2.5-flash")
|
||||
self.temperature: float = ai_cfg.get("temperature", 0.0)
|
||||
self.max_tokens: int = ai_cfg.get("max_tokens", 8192)
|
||||
self.available_models: list[str] = []
|
||||
|
||||
# ---- project management ----
|
||||
@@ -841,6 +843,8 @@ class App:
|
||||
self.config["ai"] = {
|
||||
"provider": self.current_provider,
|
||||
"model": self.current_model,
|
||||
"temperature": dpg.get_value("ai_temperature") if dpg.does_item_exist("ai_temperature") else self.temperature,
|
||||
"max_tokens": dpg.get_value("ai_max_tokens") if dpg.does_item_exist("ai_max_tokens") else self.max_tokens,
|
||||
}
|
||||
if dpg.does_item_exist("global_system_prompt"):
|
||||
self.config["ai"]["system_prompt"] = dpg.get_value("global_system_prompt")
|
||||
@@ -1147,6 +1151,9 @@ class App:
|
||||
if global_sp: combined_sp.append(global_sp.strip())
|
||||
if project_sp: combined_sp.append(project_sp.strip())
|
||||
ai_client.set_custom_system_prompt("\n\n".join(combined_sp))
|
||||
temp = dpg.get_value("ai_temperature") if dpg.does_item_exist("ai_temperature") else 0.0
|
||||
max_tok = dpg.get_value("ai_max_tokens") if dpg.does_item_exist("ai_max_tokens") else 8192
|
||||
ai_client.set_model_params(temp, max_tok)
|
||||
|
||||
def do_send():
|
||||
auto_add = dpg.get_value("auto_add_history") if dpg.does_item_exist("auto_add_history") else False
|
||||
@@ -1771,9 +1778,13 @@ class App:
|
||||
items=self.available_models,
|
||||
default_value=self.current_model,
|
||||
width=-1,
|
||||
num_items=6,
|
||||
num_items=5,
|
||||
callback=self.cb_model_changed,
|
||||
)
|
||||
dpg.add_separator()
|
||||
dpg.add_text("Parameters")
|
||||
dpg.add_input_float(tag="ai_temperature", label="Temperature", default_value=self.temperature, min_value=0.0, max_value=2.0)
|
||||
dpg.add_input_int(tag="ai_max_tokens", label="Max Tokens (Output)", default_value=self.max_tokens, step=1024)
|
||||
|
||||
# ---- Message panel ----
|
||||
with dpg.window(
|
||||
|
||||
Reference in New Issue
Block a user