fix: 修复多个问题

- JSON解析器字符串状态追踪修复
- AI客户端流式响应异常处理
- 写作风格MultipleResultsFound错误
- 职业stages字段类型处理
- 章节分析任务状态同步
- 后台任务返回值修复
This commit is contained in:
xiamuceer
2025-12-31 12:02:36 +08:00
parent 30c044394f
commit fba6922a5c
10 changed files with 155 additions and 82 deletions
+6 -1
View File
@@ -483,7 +483,12 @@ async def update_career(
for field, value in update_data.items():
if field == "stages" and value is not None:
# 转换为JSON字符串
setattr(career, field, json.dumps([stage.model_dump() for stage in value], ensure_ascii=False))
# model_dump() 已经将嵌套模型转换为字典,所以 value 中的元素已经是 dict
stages_list = [
stage if isinstance(stage, dict) else stage.model_dump()
for stage in value
]
setattr(career, field, json.dumps(stages_list, ensure_ascii=False))
elif field == "attribute_bonuses" and value is not None:
# 转换为JSON字符串
setattr(career, field, json.dumps(value, ensure_ascii=False))