mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
Compare commits
3 Commits
19b50f9558
...
0ece502a56
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ece502a56 | ||
|
|
062ee545b1 | ||
|
|
ddbe75704d |
@ -49,7 +49,9 @@ async def _():
|
|||||||
async def _prune_stale_tags():
|
async def _prune_stale_tags():
|
||||||
deleted_count = await tag_manager.prune_stale_group_links()
|
deleted_count = await tag_manager.prune_stale_group_links()
|
||||||
if deleted_count > 0:
|
if deleted_count > 0:
|
||||||
logger.info(f"定时任务:成功清理了 {deleted_count} 个无效的群组标签"
|
logger.info(
|
||||||
f"关联。", "群组标签管理")
|
f"定时任务:成功清理了 {deleted_count} 个无效的群组标签" f"关联。",
|
||||||
|
"群组标签管理",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
logger.debug("定时任务:未发现无效的群组标签关联。", "群组标签管理")
|
logger.debug("定时任务:未发现无效的群组标签关联。", "群组标签管理")
|
||||||
|
|||||||
@ -354,6 +354,24 @@ class GeminiAdapter(BaseAdapter):
|
|||||||
|
|
||||||
return safety_settings if safety_settings else None
|
return safety_settings if safety_settings else None
|
||||||
|
|
||||||
|
def validate_response(self, response_json: dict[str, Any]) -> None:
|
||||||
|
"""验证 Gemini API 响应,增加对 promptFeedback 的检查"""
|
||||||
|
super().validate_response(response_json)
|
||||||
|
|
||||||
|
if prompt_feedback := response_json.get("promptFeedback"):
|
||||||
|
if block_reason := prompt_feedback.get("blockReason"):
|
||||||
|
logger.warning(
|
||||||
|
f"Gemini 内容因 promptFeedback 被安全过滤: {block_reason}"
|
||||||
|
)
|
||||||
|
raise LLMException(
|
||||||
|
f"内容被安全过滤: {block_reason}",
|
||||||
|
code=LLMErrorCode.CONTENT_FILTERED,
|
||||||
|
details={
|
||||||
|
"block_reason": block_reason,
|
||||||
|
"safety_ratings": prompt_feedback.get("safetyRatings"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
def parse_response(
|
def parse_response(
|
||||||
self,
|
self,
|
||||||
model: "LLMModel",
|
model: "LLMModel",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user