fix: NameError on logger in custom endpoint model discovery
get_available_models() references 'logger' in the except block of the custom endpoint fetch (added in PR #18), but 'logger' is never imported or defined in api/config.py. When the custom endpoint is unreachable (the normal case -- most users don't have a local LLM), the except handler raises NameError: name 'logger' is not defined, which propagates as a 500 on every GET /api/models request. This broke 7 test_sprint11 tests and caused the model dropdown to fail for all users regardless of whether they have a custom endpoint. Fix: replace logger.debug() with a silent pass -- the exception is expected when no local LLM is configured and needs no logging. Tests: 237 passed, 0 failed.
This commit is contained in:
@@ -510,8 +510,8 @@ def get_available_models() -> dict:
|
|||||||
if model_id and model_name:
|
if model_id and model_name:
|
||||||
auto_detected_models.append({'id': model_id, 'label': model_name})
|
auto_detected_models.append({'id': model_id, 'label': model_name})
|
||||||
detected_providers.add(provider.lower())
|
detected_providers.add(provider.lower())
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logger.debug(f"Failed to fetch models from custom endpoint: {e}")
|
pass # custom endpoint unreachable or misconfigured -- fail silently
|
||||||
|
|
||||||
# 5. Build model groups
|
# 5. Build model groups
|
||||||
if detected_providers:
|
if detected_providers:
|
||||||
|
|||||||
Reference in New Issue
Block a user