From 75b878d6921e61b548a36063fbce4afcb6e1b769 Mon Sep 17 00:00:00 2001 From: tt-P607 <68868379+tt-P607@users.noreply.github.com> Date: Mon, 25 Aug 2025 19:09:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor(chat):=20=E7=BB=9F=E4=B8=80=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E8=A7=A6=E5=8F=91=E5=99=A8=E4=B8=AD=E7=9A=84stream=5F?= =?UTF-8?q?id=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将`cycle_processor`中事件触发的`stream_id`来源从`self.chat_stream.stream_id`更改为`self.context.stream_id`,以保持代码库中的一致性。 在`default_generator.py`中初始化了`llm_response`变量,以避免潜在的引用前赋值错误。 --- src/chat/chat_loop/cycle_processor.py | 2 +- src/chat/replyer/default_generator.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chat/chat_loop/cycle_processor.py b/src/chat/chat_loop/cycle_processor.py index 927f45949..043282924 100644 --- a/src/chat/chat_loop/cycle_processor.py +++ b/src/chat/chat_loop/cycle_processor.py @@ -100,7 +100,7 @@ class CycleProcessor: from src.plugin_system.core.event_manager import event_manager from src.plugin_system.base.component_types import EventType # 触发 ON_PLAN 事件 - result = await event_manager.trigger_event(EventType.ON_PLAN, stream_id=self.chat_stream.stream_id) + result = await event_manager.trigger_event(EventType.ON_PLAN, stream_id=self.context.stream_id) if result and not result.all_continue_process(): return diff --git a/src/chat/replyer/default_generator.py b/src/chat/replyer/default_generator.py index 113689d45..10dca81c4 100644 --- a/src/chat/replyer/default_generator.py +++ b/src/chat/replyer/default_generator.py @@ -353,6 +353,7 @@ class DefaultReplyer: prompt = None if available_actions is None: available_actions = {} + llm_response = None try: # 3. 构建 Prompt with Timer("构建Prompt", {}): # 内部计时器,可选保留