[changes] dashscope applies patches and modifies prompts

This commit is contained in:
lanceyq
2026-05-07 14:21:29 +08:00
parent 6419dcd932
commit d255f33f1f
12 changed files with 817 additions and 483 deletions

View File

@@ -13,6 +13,7 @@ from typing import Any, Dict, List, Optional
import redis
from redis.exceptions import RedisError
from fastapi.encoders import jsonable_encoder
# Import a unified Celery instance
from app.celery_app import celery_app
@@ -1339,12 +1340,18 @@ def write_message_task(
)
except Exception as _e:
logger.warning(f"[CELERY WRITE] 写入 last_done 时间戳失败(不影响主流程): {_e}")
# 将 result 转为 JSON 安全结构,避免 Celery JSON 序列化 pydantic BaseModel / UUID 失败
try:
safe_result = jsonable_encoder(result)
except Exception as _enc_e:
logger.warning(f"[CELERY WRITE] jsonable_encoder 失败,回退为字符串: {_enc_e}")
safe_result = str(result)
return {
"status": "SUCCESS",
"result": result,
"result": safe_result,
"start_at": task_start_time,
"end_user_id": end_user_id,
"config_id": config_id,
"config_id": str(config_id) if config_id is not None else None,
"elapsed_time": elapsed_time,
"task_id": self.request.id
}