Skip to content

Commit 956af05

Browse files
committed
remove:移除info_catcher
1 parent 97ffbe5 commit 956af05

13 files changed

Lines changed: 401 additions & 280 deletions

File tree

docs/develop/plugin_develop/index.md

Lines changed: 373 additions & 23 deletions
Large diffs are not rendered by default.

src/chat/focus_chat/expressors/default_expressor.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from src.chat.emoji_system.emoji_manager import emoji_manager
1313
from src.chat.focus_chat.heartFC_sender import HeartFCSender
1414
from src.chat.utils.utils import process_llm_response
15-
from src.chat.utils.info_catcher import info_catcher_manager
1615
from src.chat.heart_flow.utils_chat import get_chat_type_and_target_info
1716
from src.chat.message_receive.chat_stream import ChatStream
1817
from src.chat.focus_chat.hfc_utils import parse_thinking_id_to_timestamp
@@ -186,9 +185,6 @@ async def express(
186185
# current_temp = float(global_config.model.normal["temp"]) * arousal_multiplier
187186
# self.express_model.params["temperature"] = current_temp # 动态调整温度
188187

189-
# 2. 获取信息捕捉器
190-
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
191-
192188
# --- Determine sender_name for private chat ---
193189
sender_name_for_prompt = "某人" # Default for group or if info unavailable
194190
if not self.is_group_chat and self.chat_target_info:
@@ -227,14 +223,10 @@ async def express(
227223
# logger.info(f"{self.log_prefix}[Replier-{thinking_id}]\nPrompt:\n{prompt}\n")
228224
content, (reasoning_content, model_name) = await self.express_model.generate_response_async(prompt)
229225

230-
# logger.info(f"{self.log_prefix}\nPrompt:\n{prompt}\n---------------------------\n")
231-
232226
logger.info(f"想要表达:{in_mind_reply}||理由:{reason}")
233227
logger.info(f"最终回复: {content}\n")
234228

235-
info_catcher.catch_after_llm_generated(
236-
prompt=prompt, response=content, reasoning_content=reasoning_content, model_name=model_name
237-
)
229+
238230

239231
except Exception as llm_e:
240232
# 精简报错信息

src/chat/focus_chat/heartFC_sender.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ async def send_message(self, message: MessageSending, has_thinking=False, typing
110110
message.set_reply()
111111
logger.debug(f"[{chat_id}] 应用 set_reply 逻辑: {message.processed_plain_text[:20]}...")
112112

113+
# print(f"message.display_message: {message.display_message}")
113114
await message.process()
115+
# print(f"message.display_message: {message.display_message}")
114116

115117
if typing:
116118
if has_thinking:

src/chat/focus_chat/replyer/default_replyer.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from src.chat.emoji_system.emoji_manager import emoji_manager
1313
from src.chat.focus_chat.heartFC_sender import HeartFCSender
1414
from src.chat.utils.utils import process_llm_response
15-
from src.chat.utils.info_catcher import info_catcher_manager
1615
from src.chat.heart_flow.utils_chat import get_chat_type_and_target_info
1716
from src.chat.message_receive.chat_stream import ChatStream
1817
from src.chat.focus_chat.hfc_utils import parse_thinking_id_to_timestamp
@@ -238,8 +237,6 @@ async def reply(
238237
# current_temp = float(global_config.model.normal["temp"]) * arousal_multiplier
239238
# self.express_model.params["temperature"] = current_temp # 动态调整温度
240239

241-
# 2. 获取信息捕捉器
242-
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
243240

244241
reply_to = action_data.get("reply_to", "none")
245242

@@ -286,10 +283,6 @@ async def reply(
286283
# logger.info(f"prompt: {prompt}")
287284
logger.info(f"最终回复: {content}")
288285

289-
info_catcher.catch_after_llm_generated(
290-
prompt=prompt, response=content, reasoning_content=reasoning_content, model_name=model_name
291-
)
292-
293286
except Exception as llm_e:
294287
# 精简报错信息
295288
logger.error(f"{self.log_prefix}LLM 生成失败: {llm_e}")

src/chat/message_receive/storage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ async def store_message(message: Union[MessageSending, MessageRecv], chat_stream
2424
else:
2525
filtered_processed_plain_text = ""
2626

27+
2728
if isinstance(message, MessageSending):
2829
display_message = message.display_message
2930
if display_message:

src/chat/normal_chat/normal_chat.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from src.chat.heart_flow.utils_chat import get_chat_type_and_target_info
99
from src.manager.mood_manager import mood_manager
1010
from src.chat.message_receive.chat_stream import ChatStream, chat_manager
11-
from src.chat.utils.info_catcher import info_catcher_manager
1211
from src.chat.utils.timer_calculator import Timer
1312
from src.chat.utils.prompt_builder import global_prompt_manager
1413
from .normal_chat_generator import NormalChatGenerator
@@ -277,9 +276,6 @@ async def normal_response(self, message: MessageRecv, is_mentioned: bool, intere
277276

278277
logger.debug(f"[{self.stream_name}] 创建捕捉器,thinking_id:{thinking_id}")
279278

280-
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
281-
info_catcher.catch_decide_to_response(message)
282-
283279
# 如果启用planner,预先修改可用actions(避免在并行任务中重复调用)
284280
available_actions = None
285281
if self.enable_planner:
@@ -373,8 +369,6 @@ async def plan_and_execute_actions():
373369
if isinstance(response_set, Exception):
374370
logger.error(f"[{self.stream_name}] 回复生成异常: {response_set}")
375371
response_set = None
376-
elif response_set:
377-
info_catcher.catch_after_generate_response(timing_results["并行生成回复和规划"])
378372

379373
# 处理规划结果(可选,不影响回复)
380374
if isinstance(plan_result, Exception):
@@ -414,7 +408,6 @@ async def plan_and_execute_actions():
414408

415409
# 检查 first_bot_msg 是否为 None (例如思考消息已被移除的情况)
416410
if first_bot_msg:
417-
info_catcher.catch_after_response(timing_results["消息发送"], response_set, first_bot_msg)
418411

419412
# 记录回复信息到最近回复列表中
420413
reply_info = {
@@ -447,8 +440,6 @@ async def plan_and_execute_actions():
447440
# await self._check_switch_to_focus()
448441
pass
449442

450-
info_catcher.done_catch()
451-
452443
with Timer("处理表情包", timing_results):
453444
await self._handle_emoji(message, response_set[0])
454445

src/chat/normal_chat/normal_chat_expressor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ async def send_response_messages(
133133
thinking_start_time=time.time(),
134134
reply_to=mark_head,
135135
is_emoji=is_emoji,
136+
display_message=display_message,
136137
)
137138
logger.debug(f"{self.log_prefix} 添加{response_type}类型消息: {content}")
138139

@@ -167,6 +168,7 @@ async def _build_sending_message(
167168
thinking_start_time: float,
168169
reply_to: bool = False,
169170
is_emoji: bool = False,
171+
display_message: str = "",
170172
) -> MessageSending:
171173
"""构建发送消息
172174
@@ -197,6 +199,7 @@ async def _build_sending_message(
197199
reply=anchor_message if reply_to else None,
198200
thinking_start_time=thinking_start_time,
199201
is_emoji=is_emoji,
202+
display_message=display_message,
200203
)
201204

202205
return message_sending

src/chat/normal_chat/normal_chat_generator.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from src.chat.normal_chat.normal_prompt import prompt_builder
77
from src.chat.utils.timer_calculator import Timer
88
from src.common.logger_manager import get_logger
9-
from src.chat.utils.info_catcher import info_catcher_manager
109
from src.person_info.person_info import person_info_manager
1110
from src.chat.utils.utils import process_llm_response
1211

@@ -69,7 +68,6 @@ async def _generate_response_with_model(
6968
enable_planner: bool = False,
7069
available_actions=None,
7170
):
72-
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
7371

7472
person_id = person_info_manager.get_person_id(
7573
message.chat_stream.user_info.platform, message.chat_stream.user_info.user_id
@@ -105,9 +103,6 @@ async def _generate_response_with_model(
105103

106104
logger.info(f"对 {message.processed_plain_text} 的回复:{content}")
107105

108-
info_catcher.catch_after_llm_generated(
109-
prompt=prompt, response=content, reasoning_content=reasoning_content, model_name=self.current_model_name
110-
)
111106

112107
except Exception:
113108
logger.exception("生成回复时出错")

src/chat/normal_chat/normal_chat_planner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async def plan(self, message: MessageThinking, sender_name: str = "某人") -> D
150150
try:
151151
content, (reasoning_content, model_name) = await self.planner_llm.generate_response_async(prompt)
152152

153-
logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}")
153+
# logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}")
154154
logger.info(f"{self.log_prefix}规划器原始响应: {content}")
155155
logger.info(f"{self.log_prefix}规划器推理: {reasoning_content}")
156156
logger.info(f"{self.log_prefix}规划器模型: {model_name}")

0 commit comments

Comments
 (0)