fix: add stream close check, recover regression test assertions, and secure credentials type check

This commit is contained in:
SmartUp Developer
2026-07-02 19:18:10 +08:00
parent ece11d66e6
commit c20c9cfd26
3 changed files with 82 additions and 6 deletions
+4 -2
View File
@@ -1397,9 +1397,11 @@ def _sync_upstream_models_generator(wid: int, db: Session):
continue
# 1. 先安全修复 base_url (不依赖同步模型结果)
# 在 remote_acc.get("credentials") 基础上过滤掉敏感字段,保留其他非敏感 credentials (例如 compact_model_mapping)
raw_creds = remote_acc.get("credentials")
if not isinstance(raw_creds, dict):
raw_creds = {}
current_creds = {
k: v for k, v in (remote_acc.get("credentials") or {}).items()
k: v for k, v in raw_creds.items()
if k not in SENSITIVE_CREDENTIAL_KEYS
}
current_creds["base_url"] = upstream_base_url