Spaces:
Running
Running
mike boone commited on
Commit ·
fa01ae7
1
Parent(s): d2b131a
Reapply "fix: temporarily force sonnet model failover"
Browse filesThis reverts commit 3d955ee6f0ab66f2b42ccf8d65faa3646db9bcab.
- chat_interface.py +10 -4
- llm_config.py +8 -10
chat_interface.py
CHANGED
|
@@ -152,6 +152,8 @@ def load_settings_values(settings_dict: dict, user_email: str = "") -> list:
|
|
| 152 |
else:
|
| 153 |
raw_value = settings_dict.get(storage_key, default)
|
| 154 |
try:
|
|
|
|
|
|
|
| 155 |
if converter == bool:
|
| 156 |
# Special handling: bool("False") returns True (non-empty string)
|
| 157 |
# We need to check the actual string value
|
|
@@ -335,7 +337,8 @@ class ChatDemoInterface:
|
|
| 335 |
if use_case and use_case not in ['analytics', '']:
|
| 336 |
defaults['use_case'] = use_case
|
| 337 |
if settings.get('default_llm'):
|
| 338 |
-
|
|
|
|
| 339 |
if settings.get('fact_table_size'):
|
| 340 |
defaults['fact_table_size'] = settings.get('fact_table_size')
|
| 341 |
if settings.get('dim_table_size'):
|
|
@@ -5596,6 +5599,8 @@ def create_chat_interface():
|
|
| 5596 |
settings = load_gradio_settings(user_email)
|
| 5597 |
|
| 5598 |
model = (str(settings.get("default_llm", "")).strip() or DEFAULT_LLM_MODEL)
|
|
|
|
|
|
|
| 5599 |
liveboard_name = str(settings.get("liveboard_name", "")).strip()
|
| 5600 |
|
| 5601 |
# Data Size — prefer new field, fall back to legacy fact_table_size
|
|
@@ -5808,7 +5813,8 @@ def create_chat_tab(chat_controller_state, settings, current_stage, current_mode
|
|
| 5808 |
choices=list(UI_MODEL_CHOICES),
|
| 5809 |
value=settings['model'],
|
| 5810 |
interactive=True,
|
| 5811 |
-
allow_custom_value=
|
|
|
|
| 5812 |
)
|
| 5813 |
|
| 5814 |
# Run-time settings — collapsible, all pipeline knobs here
|
|
@@ -6403,8 +6409,8 @@ def create_settings_tab():
|
|
| 6403 |
label="Default AI Model",
|
| 6404 |
choices=list(UI_MODEL_CHOICES),
|
| 6405 |
value=DEFAULT_LLM_MODEL,
|
| 6406 |
-
info="
|
| 6407 |
-
allow_custom_value=
|
| 6408 |
)
|
| 6409 |
_ts_env_choices = get_ts_environments()
|
| 6410 |
default_ts_env = gr.Dropdown(
|
|
|
|
| 152 |
else:
|
| 153 |
raw_value = settings_dict.get(storage_key, default)
|
| 154 |
try:
|
| 155 |
+
if storage_key == 'default_llm' and raw_value not in UI_MODEL_CHOICES:
|
| 156 |
+
raw_value = default
|
| 157 |
if converter == bool:
|
| 158 |
# Special handling: bool("False") returns True (non-empty string)
|
| 159 |
# We need to check the actual string value
|
|
|
|
| 337 |
if use_case and use_case not in ['analytics', '']:
|
| 338 |
defaults['use_case'] = use_case
|
| 339 |
if settings.get('default_llm'):
|
| 340 |
+
saved_model = settings.get('default_llm')
|
| 341 |
+
defaults['model'] = saved_model if saved_model in UI_MODEL_CHOICES else DEFAULT_LLM_MODEL
|
| 342 |
if settings.get('fact_table_size'):
|
| 343 |
defaults['fact_table_size'] = settings.get('fact_table_size')
|
| 344 |
if settings.get('dim_table_size'):
|
|
|
|
| 5599 |
settings = load_gradio_settings(user_email)
|
| 5600 |
|
| 5601 |
model = (str(settings.get("default_llm", "")).strip() or DEFAULT_LLM_MODEL)
|
| 5602 |
+
if model not in UI_MODEL_CHOICES:
|
| 5603 |
+
model = DEFAULT_LLM_MODEL
|
| 5604 |
liveboard_name = str(settings.get("liveboard_name", "")).strip()
|
| 5605 |
|
| 5606 |
# Data Size — prefer new field, fall back to legacy fact_table_size
|
|
|
|
| 5813 |
choices=list(UI_MODEL_CHOICES),
|
| 5814 |
value=settings['model'],
|
| 5815 |
interactive=True,
|
| 5816 |
+
allow_custom_value=False,
|
| 5817 |
+
info="Temporary model failover active: using claude-sonnet-4-6."
|
| 5818 |
)
|
| 5819 |
|
| 5820 |
# Run-time settings — collapsible, all pipeline knobs here
|
|
|
|
| 6409 |
label="Default AI Model",
|
| 6410 |
choices=list(UI_MODEL_CHOICES),
|
| 6411 |
value=DEFAULT_LLM_MODEL,
|
| 6412 |
+
info="Temporary model failover active: using claude-sonnet-4-6.",
|
| 6413 |
+
allow_custom_value=False,
|
| 6414 |
)
|
| 6415 |
_ts_env_choices = get_ts_environments()
|
| 6416 |
default_ts_env = gr.Dropdown(
|
llm_config.py
CHANGED
|
@@ -10,18 +10,14 @@ from __future__ import annotations
|
|
| 10 |
import os
|
| 11 |
from typing import Tuple
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Chat-capable models we expose in app dropdowns.
|
| 14 |
-
DEFAULT_LLM_MODEL =
|
| 15 |
UI_MODEL_CHOICES = (
|
| 16 |
-
|
| 17 |
-
"claude-opus-4-6",
|
| 18 |
-
"claude-sonnet-4-6",
|
| 19 |
-
"claude-haiku-4-5-20251001",
|
| 20 |
-
"gpt-5.5-pro",
|
| 21 |
-
"gpt-5.5",
|
| 22 |
-
"gpt-5.4",
|
| 23 |
-
"gpt-5.2",
|
| 24 |
-
"gpt-5",
|
| 25 |
)
|
| 26 |
|
| 27 |
# Preserve compatibility with older saved values.
|
|
@@ -43,6 +39,8 @@ GOOGLE_MODEL_MAP = {
|
|
| 43 |
|
| 44 |
def resolve_model_name(model_name: str | None) -> str:
|
| 45 |
"""Normalize user/config model names into canonical runtime model IDs."""
|
|
|
|
|
|
|
| 46 |
raw = (model_name or "").strip()
|
| 47 |
if not raw:
|
| 48 |
return DEFAULT_LLM_MODEL
|
|
|
|
| 10 |
import os
|
| 11 |
from typing import Tuple
|
| 12 |
|
| 13 |
+
# Temporary emergency failover while OpenAI quota and Anthropic Opus limits are unavailable.
|
| 14 |
+
# Do not rewrite saved user settings; route runtime/UI to the one currently working model.
|
| 15 |
+
TEMPORARY_MODEL_OVERRIDE = "claude-sonnet-4-6"
|
| 16 |
+
|
| 17 |
# Chat-capable models we expose in app dropdowns.
|
| 18 |
+
DEFAULT_LLM_MODEL = TEMPORARY_MODEL_OVERRIDE
|
| 19 |
UI_MODEL_CHOICES = (
|
| 20 |
+
TEMPORARY_MODEL_OVERRIDE,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
# Preserve compatibility with older saved values.
|
|
|
|
| 39 |
|
| 40 |
def resolve_model_name(model_name: str | None) -> str:
|
| 41 |
"""Normalize user/config model names into canonical runtime model IDs."""
|
| 42 |
+
if TEMPORARY_MODEL_OVERRIDE:
|
| 43 |
+
return TEMPORARY_MODEL_OVERRIDE
|
| 44 |
raw = (model_name or "").strip()
|
| 45 |
if not raw:
|
| 46 |
return DEFAULT_LLM_MODEL
|