Spaces:
Paused
Paused
Upload 2 files
Browse files
app.py
CHANGED
|
@@ -505,6 +505,7 @@ def chat_completions():
|
|
| 505 |
"details": []
|
| 506 |
}
|
| 507 |
}
|
|
|
|
| 508 |
yield f"data: {json.dumps(error_message)}\n\n"
|
| 509 |
break
|
| 510 |
|
|
@@ -519,6 +520,7 @@ def chat_completions():
|
|
| 519 |
"details": [rating]
|
| 520 |
}
|
| 521 |
}
|
|
|
|
| 522 |
yield f"data: {json.dumps(error_message)}\n\n"
|
| 523 |
break
|
| 524 |
else:
|
|
@@ -530,7 +532,7 @@ def chat_completions():
|
|
| 530 |
continue
|
| 531 |
|
| 532 |
except Exception as e:
|
| 533 |
-
logger.error(f"流式处理期间发生错误: {e},
|
| 534 |
yield f"data: {json.dumps({'error': str(e)})}\n\n"
|
| 535 |
|
| 536 |
else:
|
|
|
|
| 505 |
"details": []
|
| 506 |
}
|
| 507 |
}
|
| 508 |
+
logger.warning(f"模型的响应因违反内容政策而被标记: {candidate.get('finishReason')}")
|
| 509 |
yield f"data: {json.dumps(error_message)}\n\n"
|
| 510 |
break
|
| 511 |
|
|
|
|
| 520 |
"details": [rating]
|
| 521 |
}
|
| 522 |
}
|
| 523 |
+
logger.warning(f"模型的响应因高概率被标记为 {rating['category']}")
|
| 524 |
yield f"data: {json.dumps(error_message)}\n\n"
|
| 525 |
break
|
| 526 |
else:
|
|
|
|
| 532 |
continue
|
| 533 |
|
| 534 |
except Exception as e:
|
| 535 |
+
logger.error(f"流式处理期间发生错误: {e}, 原始数据行↙\n{line}")
|
| 536 |
yield f"data: {json.dumps({'error': str(e)})}\n\n"
|
| 537 |
|
| 538 |
else:
|