This commit is contained in:
liubiren 2026-06-14 22:14:30 +08:00
parent 2af7a82fcc
commit 491ea47a9d
1 changed files with 5 additions and 5 deletions

View File

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