可选预热上游适配器,提前初始化动态依赖。
()
| 23 | |
| 24 | |
| 25 | async def warmup_upstream_client(): |
| 26 | """可选预热上游适配器,提前初始化动态依赖。""" |
| 27 | try: |
| 28 | client = UpstreamClient() |
| 29 | logger.info( |
| 30 | f"✅ 上游适配器已就绪,支持 {len(client.get_supported_models())} 个模型" |
| 31 | ) |
| 32 | except Exception as exc: |
| 33 | logger.warning(f"⚠️ 上游适配器预热失败: {exc}") |
| 34 | |
| 35 | |
| 36 | @asynccontextmanager |
no test coverage detected