This commit is contained in:
parent
2af7a82fcc
commit
491ea47a9d
|
|
@ -139,7 +139,7 @@ class Part(BaseModel):
|
||||||
|
|
||||||
type: Literal["thinking", "text"] = Field(..., description="片段类型")
|
type: Literal["thinking", "text"] = Field(..., description="片段类型")
|
||||||
content: str = Field(..., description="片段内容")
|
content: str = Field(..., description="片段内容")
|
||||||
timer: Optional[Task] = Field(default=None, description="片段绑定的延时异步任务")
|
task: Optional[Task] = Field(default=None, description="片段绑定的异步任务")
|
||||||
|
|
||||||
|
|
||||||
class StreamEventsDebouncer:
|
class StreamEventsDebouncer:
|
||||||
|
|
@ -207,14 +207,14 @@ class StreamEventsDebouncer:
|
||||||
# 其余未匹配的所有事件原样透传
|
# 其余未匹配的所有事件原样透传
|
||||||
yield event
|
yield event
|
||||||
|
|
||||||
def _cancel_timer(self, index: int):
|
def _cancel_task(self, index: int):
|
||||||
"""
|
"""
|
||||||
取消指定索引片段的计时器
|
取消指定索引片段的异步任务
|
||||||
:param index: 片段索引
|
:param index: 片段索引
|
||||||
"""
|
"""
|
||||||
part = self.parts.get(index)
|
part = self.parts.get(index)
|
||||||
if part and part.timer is not None and not part.timer.done():
|
if part and part.task is not None and not part.task.done():
|
||||||
part.timer.cancel()
|
part.task.cancel()
|
||||||
|
|
||||||
|
|
||||||
class Agent:
|
class Agent:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue