mirror of https://github.com/Mai-with-u/MaiBot.git
import优化
# Conflicts: # src/plugins/chat_module/reasoning_chat/reasoning_chat.pypull/707/head^2
parent
3653e2b4ae
commit
d7aece01f1
|
|
@ -2,7 +2,6 @@ from src.common.logger import get_module_logger
|
|||
from src.plugins.chat.message import MessageRecv
|
||||
from src.plugins.storage.storage import MessageStorage
|
||||
from src.plugins.config.config import global_config
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
logger = get_module_logger("pfc_message_processor")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import time
|
||||
from random import random
|
||||
import re
|
||||
|
||||
from typing import List
|
||||
from ...memory_system.Hippocampus import HippocampusManager
|
||||
from ...moods.moods import MoodManager
|
||||
|
|
@ -59,10 +59,10 @@ class ReasoningChat:
|
|||
|
||||
return thinking_id
|
||||
|
||||
async def _send_response_messages(self,
|
||||
message,
|
||||
chat,
|
||||
response_set:List[str],
|
||||
async def _send_response_messages(self,
|
||||
message,
|
||||
chat,
|
||||
response_set:List[str],
|
||||
thinking_id) -> MessageSending:
|
||||
"""发送回复消息"""
|
||||
container = message_manager.get_container(chat.stream_id)
|
||||
|
|
@ -240,9 +240,9 @@ class ReasoningChat:
|
|||
thinking_id = await self._create_thinking_message(message, chat, userinfo, messageinfo)
|
||||
timer2 = time.time()
|
||||
timing_results["创建思考消息"] = timer2 - timer1
|
||||
|
||||
|
||||
logger.debug(f"创建捕捉器,thinking_id:{thinking_id}")
|
||||
|
||||
|
||||
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
|
||||
info_catcher.catch_decide_to_response(message)
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ class ReasoningChat:
|
|||
response_set = await self.gpt.generate_response(message,thinking_id)
|
||||
timer2 = time.time()
|
||||
timing_results["生成回复"] = timer2 - timer1
|
||||
|
||||
|
||||
info_catcher.catch_after_generate_response(timing_results["生成回复"])
|
||||
|
||||
if not response_set:
|
||||
|
|
@ -263,10 +263,10 @@ class ReasoningChat:
|
|||
first_bot_msg = await self._send_response_messages(message, chat, response_set, thinking_id)
|
||||
timer2 = time.time()
|
||||
timing_results["发送消息"] = timer2 - timer1
|
||||
|
||||
|
||||
info_catcher.catch_after_response(timing_results["发送消息"],response_set,first_bot_msg)
|
||||
|
||||
|
||||
|
||||
|
||||
info_catcher.done_catch()
|
||||
|
||||
# 处理表情包
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import random
|
||||
import re
|
||||
import time
|
||||
from typing import Optional, Union
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue