[fix] (debug) 纠正日志等级情况,纠正不能适配低版本的的 async timeout 方法

This commit is contained in:
SXP-Simon
2025-09-23 23:26:12 +08:00
parent b6f0d99a61
commit 9602b31014
3 changed files with 6 additions and 7 deletions
+3 -3
View File
@@ -253,7 +253,7 @@ class LLMAnalyzer:
else:
logger.warning(f"话题分析响应中未找到JSON格式,响应内容: {result_text[:200]}...")
except json.JSONDecodeError as e:
logger.error(f"话题分析JSON解析失败: {e}")
logger.debug(f"话题分析JSON解析失败: {e}")
logger.debug(f"修复后的JSON: {json_text if 'json_text' in locals() else 'N/A'}")
logger.debug(f"原始响应: {result_text}")
@@ -467,7 +467,7 @@ class LLMAnalyzer:
titles_data = json.loads(json_match.group())
return [UserTitle(**title) for title in titles_data], token_usage
except Exception as e:
logger.error(f"用户称号分析JSON解析失败: {e}")
logger.debug(f"用户称号分析JSON解析失败: {e}")
logger.debug(f"原始响应: {result_text}")
return [], token_usage
@@ -570,7 +570,7 @@ class LLMAnalyzer:
quotes_data = json.loads(json_match.group())
return [GoldenQuote(**quote) for quote in quotes_data[:max_golden_quotes]], token_usage
except Exception as e:
logger.error(f"金句分析JSON解析失败: {e}")
logger.debug(f"金句分析JSON解析失败: {e}")
logger.debug(f"原始响应: {result_text}")
return [], token_usage
+2 -3
View File
@@ -157,9 +157,8 @@ class AutoScheduler:
async def _perform_auto_analysis_for_group_with_timeout(self, group_id: str):
"""为指定群执行自动分析(带超时控制)"""
try:
# 为每个群聊设置独立的超时时间(20分钟)
async with asyncio.timeout(1200):
await self._perform_auto_analysis_for_group(group_id)
# 为每个群聊设置独立的超时时间(20分钟)- 使用 asyncio.wait_for 兼容所有 Python 版本
await asyncio.wait_for(self._perform_auto_analysis_for_group(group_id), timeout=1200)
except asyncio.TimeoutError:
logger.error(f"{group_id} 分析超时(20分钟),跳过该群分析")
except Exception as e: