mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 17:47:06 +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
|
self.config
|
||||||
or self.model_dump(exclude={"source_id", "config"}, exclude_none=True)
|
or self.model_dump(exclude={"source_id", "config"}, exclude_none=True)
|
||||||
)
|
)
|
||||||
if fallback_id:
|
if not config.get("id"):
|
||||||
config["id"] = fallback_id
|
# 不覆盖已有 id;self.id(显式指定)优先于 fallback_id(旧值兜底)
|
||||||
elif self.id and "id" not in config:
|
if fallback := (self.id or fallback_id):
|
||||||
config["id"] = self.id
|
config["id"] = fallback
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user