修复PFC最大重试次数,使其重新启用

修复checker的最大重试次数,使其重新启用(似乎在之前所有版本中从来没有启用过?)达到最大重试次数自动wait,并且加入了更详细的reply_checker报错日志
This commit is contained in:
114514
2025-04-25 12:21:43 +08:00
parent 64be68d53a
commit b7938f016f
2 changed files with 75 additions and 53 deletions

View File

@@ -15,11 +15,11 @@ class ReplyChecker:
def __init__(self, stream_id: str):
self.llm = LLMRequest(
model=global_config.llm_PFC_reply_checker, temperature=0.55, max_tokens=1000, request_type="reply_check"
model=global_config.llm_PFC_reply_checker, temperature=0.50, max_tokens=1000, request_type="reply_check"
)
self.name = global_config.BOT_NICKNAME
self.chat_observer = ChatObserver.get_instance(stream_id)
self.max_retries = 2 # 最大重试次数
self.max_retries = 3 # 最大重试次数
async def check(
self, reply: str, goal: str, chat_history: List[Dict[str, Any]], retry_count: int = 0
@@ -76,8 +76,10 @@ class ReplyChecker:
False,
)
except Exception as self_check_err:
logger.error(f"检查自身重复发言时出错: {self_check_err}")
except Exception as e:
import traceback
logger.error(f"检查回复时出错: 类型={type(e)}, 值={e}")
logger.error(traceback.format_exc()) # 打印详细的回溯信息
for msg in chat_history[-20:]:
time_str = datetime.datetime.fromtimestamp(msg["time"]).strftime("%H:%M:%S")