Spaces:
Running
Running
File size: 337 Bytes
0c39aac 31cca84 0c39aac 4a410d7 31cca84 0c39aac 31cca84 |
1 2 3 4 5 6 7 8 9 |
from fastapi import HTTPException
def handle_generation_error(error: Exception, user_input: str):
error_msg = f"推理失败(输入:{user_input}),错误原因:{str(error)[:100]}"
print(error_msg)
raise HTTPException(
status_code=500,
detail={"error": "AI回复生成失败", "msg": error_msg}
) |