refactor(chat): 统一事件触发器中的stream_id来源

将`cycle_processor`中事件触发的`stream_id`来源从`self.chat_stream.stream_id`更改为`self.context.stream_id`,以保持代码库中的一致性。

在`default_generator.py`中初始化了`llm_response`变量,以避免潜在的引用前赋值错误。
This commit is contained in:
tt-P607
2025-08-25 19:09:04 +08:00
committed by Windpicker-owo
parent f65049d1de
commit be9a926bcc
2 changed files with 2 additions and 1 deletions

View File

@@ -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

View File

@@ -325,6 +325,7 @@ class DefaultReplyer:
selected_expressions = None
if available_actions is None:
available_actions = {}
llm_response = None
try:
# 3. 构建 Prompt
with Timer("构建Prompt", {}): # 内部计时器,可选保留