refactor: move GenAI parameters to Chat tab, simplify GenAI Config

Remove temperature, max_tokens, top_p, top_k, frequency/presence
penalty fields from the GenAI Config tab. That tab is now focused
on adding custom models not in the catalog.

Parameters are now managed exclusively in the Chat tab via the
collapsible gear panel, available for both direct models and saved
configs. Inline params override stored defaults when using presets.
This commit is contained in:
nogueiraguh
2026-03-03 20:22:47 -03:00
parent 13b98209d5
commit 749875a3cd
2 changed files with 22 additions and 21 deletions

View File

@@ -1577,7 +1577,16 @@ async def chat(msg: ChatMsg, u=Depends(current_user)):
genai_cfg = None
if msg.genai_config_id:
with db() as c:
genai_cfg = c.execute("SELECT * FROM genai_configs WHERE id=?", (msg.genai_config_id,)).fetchone()
row = c.execute("SELECT * FROM genai_configs WHERE id=?", (msg.genai_config_id,)).fetchone()
if row:
genai_cfg = dict(row)
# Override params from inline chat settings if provided
if msg.temperature is not None: genai_cfg["temperature"] = msg.temperature
if msg.max_tokens is not None: genai_cfg["max_tokens"] = msg.max_tokens
if msg.top_p is not None: genai_cfg["top_p"] = msg.top_p
if msg.top_k is not None: genai_cfg["top_k"] = msg.top_k
if msg.frequency_penalty is not None: genai_cfg["frequency_penalty"] = msg.frequency_penalty
if msg.presence_penalty is not None: genai_cfg["presence_penalty"] = msg.presence_penalty
elif msg.model_id and msg.oci_config_id:
# Direct model mode: build synthetic config dict
with db() as c: