feat: 接入模型动态 Fallback 与调用审计
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
from django.apps import AppConfig
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
class AiConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "apps.ai"
|
||||
|
||||
def ready(self) -> None:
|
||||
# API 与 Celery Worker 都会在 Django 启动时经过这里。路由策略一旦配置错误就立即失败,
|
||||
# 避免两端带着不同或不可控的超时、重试规则继续运行。
|
||||
from .routing_policy import RoutingPolicyConfigurationError, load_model_routing_policy
|
||||
|
||||
try:
|
||||
load_model_routing_policy()
|
||||
except RoutingPolicyConfigurationError as exc:
|
||||
raise ImproperlyConfigured(f"模型路由策略配置错误:{exc}") from exc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user