gain reordering

parent fe509751
...@@ -463,30 +463,20 @@ async def dashboard_providers(request: Request): ...@@ -463,30 +463,20 @@ async def dashboard_providers(request: Request):
broker_status_map = await _load_coderai_broker_status_map() broker_status_map = await _load_coderai_broker_status_map()
if is_config_admin: if is_config_admin:
# Config admin: prefer live in-memory config when available # Config admin: read provider order from the saved JSON file
live_config = _config config_path = Path.home() / '.aisbf' / 'providers.json'
if live_config is None: if not config_path.exists():
from aisbf.config import config as global_config config_path = Path(__file__).parent / 'config' / 'providers.json'
live_config = global_config
if live_config and getattr(live_config, 'providers', None): with open(config_path) as f:
providers_data = { full_config = json.load(f)
provider_id: (provider.model_dump() if hasattr(provider, 'model_dump') else dict(provider))
for provider_id, provider in live_config.providers.items() # Extract just the providers object (handle both nested and flat structures)
} if 'providers' in full_config and isinstance(full_config['providers'], dict):
providers_data = full_config['providers']
else: else:
config_path = Path.home() / '.aisbf' / 'providers.json' # Fallback for flat structure (backward compatibility)
if not config_path.exists(): providers_data = {k: v for k, v in full_config.items() if k != 'condensation'}
config_path = Path(__file__).parent / 'config' / 'providers.json'
with open(config_path) as f:
full_config = json.load(f)
# Extract just the providers object (handle both nested and flat structures)
if 'providers' in full_config and isinstance(full_config['providers'], dict):
providers_data = full_config['providers']
else:
# Fallback for flat structure (backward compatibility)
providers_data = {k: v for k, v in full_config.items() if k != 'condensation'}
providers_data = { providers_data = {
provider_id: _augment_provider_broker_status(provider_id, _ensure_coderai_token(provider_config), broker_status_map) provider_id: _augment_provider_broker_status(provider_id, _ensure_coderai_token(provider_config), broker_status_map)
for provider_id, provider_config in providers_data.items() for provider_id, provider_config in providers_data.items()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment