mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 09:40:30 +08:00
fix: 修复提供商源修改 ID 后保存被静默还原的问题 (#8915)
* Update schemas.py * Update schemas.py
This commit is contained in:
@@ -418,10 +418,10 @@ class ProviderSourceRequest(OpenModel):
|
||||
self.config
|
||||
or self.model_dump(exclude={"source_id", "config"}, exclude_none=True)
|
||||
)
|
||||
if fallback_id:
|
||||
config["id"] = fallback_id
|
||||
elif self.id and "id" not in config:
|
||||
config["id"] = self.id
|
||||
if not config.get("id"):
|
||||
# 不覆盖已有 id;self.id(显式指定)优先于 fallback_id(旧值兜底)
|
||||
if fallback := (self.id or fallback_id):
|
||||
config["id"] = fallback
|
||||
return config
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user