refactor(chat): 优化异步任务处理和消息管理逻辑
- 使用asyncio.create_task替代await调用,提升并发性能 - 简化流管理器的槽位获取逻辑,移除回退方案 - 重构上下文管理器的消息添加和更新机制 - 移除StreamContext中的冗余方法,保持数据模型的简洁性 - 优化兴趣度评分系统的更新流程,减少阻塞操作 这些改动主要关注性能优化和代码结构简化,不涉及功能变更。
This commit is contained in:
@@ -303,14 +303,14 @@ class DefaultReplyer:
|
||||
try:
|
||||
# 构建 Prompt
|
||||
with Timer("构建Prompt", {}): # 内部计时器,可选保留
|
||||
prompt = await asyncio.create_task(self.build_prompt_reply_context(
|
||||
prompt = await self.build_prompt_reply_context(
|
||||
reply_to=reply_to,
|
||||
extra_info=extra_info,
|
||||
available_actions=available_actions,
|
||||
choosen_actions=choosen_actions,
|
||||
enable_tool=enable_tool,
|
||||
reply_message=reply_message,
|
||||
))
|
||||
)
|
||||
|
||||
if not prompt:
|
||||
logger.warning("构建prompt失败,跳过回复生成")
|
||||
|
||||
Reference in New Issue
Block a user