feat: add disable_models_service configuration to manage model service availability and update related components

This commit is contained in:
Junyan Qin
2026-01-01 15:40:39 +08:00
parent 75c2a063cc
commit 61f08f3218
15 changed files with 194 additions and 113 deletions

View File

@@ -22,6 +22,9 @@ class SystemRouterGroup(group.RouterGroup):
'allow_modify_login_info': self.ap.instance_config.data.get('system', {}).get(
'allow_modify_login_info', True
),
'disable_models_service': self.ap.instance_config.data.get('space', {}).get(
'disable_models_service', False
),
}
)

View File

@@ -45,6 +45,12 @@ class ModelManager:
await self.load_models_from_db()
# Check if space models service is disabled
space_config = self.ap.instance_config.data.get('space', {})
if space_config.get('disable_models_service', False):
self.ap.logger.info('LangBot Space Models service is disabled, skipping sync.')
return
try:
await self.sync_new_models_from_space()
except Exception as e:

View File

@@ -78,3 +78,4 @@ space:
models_gateway_api_url: 'https://api.langbot.cloud'
# OAuth authorization page URL (user will be redirected here)
oauth_authorize_url: 'https://space.langbot.app/auth/authorize'
disable_models_service: false