From 491ea47a9d27123f9ac7bc8a768e6f58246d8244 Mon Sep 17 00:00:00 2001 From: liubiren Date: Sun, 14 Jun 2026 22:14:30 +0800 Subject: [PATCH] 1 --- utils/agent.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/agent.py b/utils/agent.py index ead6312..855290a 100644 --- a/utils/agent.py +++ b/utils/agent.py @@ -139,7 +139,7 @@ class Part(BaseModel): type: Literal["thinking", "text"] = Field(..., description="片段类型") content: str = Field(..., description="片段内容") - timer: Optional[Task] = Field(default=None, description="片段绑定的延时异步任务") + task: Optional[Task] = Field(default=None, description="片段绑定的异步任务") class StreamEventsDebouncer: @@ -207,14 +207,14 @@ class StreamEventsDebouncer: # 其余未匹配的所有事件原样透传 yield event - def _cancel_timer(self, index: int): + def _cancel_task(self, index: int): """ - 取消指定索引片段的计时器 + 取消指定索引片段的异步任务 :param index: 片段索引 """ part = self.parts.get(index) - if part and part.timer is not None and not part.timer.done(): - part.timer.cancel() + if part and part.task is not None and not part.task.done(): + part.task.cancel() class Agent: