mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 07:09:20 +08:00
feat: 发布页前端工具改为等待浏览器回执后再继续模型
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, AsyncIterator
|
||||
from typing import Any, AsyncIterator, Protocol
|
||||
|
||||
from domain.models import (
|
||||
ChatMessage,
|
||||
@@ -144,6 +144,14 @@ class LlmProtocolCapabilityCache(ABC):
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class ClientToolTurn(Protocol):
|
||||
"""一轮聊天里前端工具的回执等待:先 arm 再推 SSE,再 wait_result。"""
|
||||
|
||||
def arm(self, tool_call_id: str) -> None: ...
|
||||
|
||||
async def wait_result(self, tool_call_id: str) -> str: ...
|
||||
|
||||
|
||||
class ChatStreamer(ABC):
|
||||
"""流式生成助手回复。"""
|
||||
|
||||
@@ -158,4 +166,5 @@ class ChatStreamer(ABC):
|
||||
tools: list[Any] | None = None,
|
||||
max_tool_result_chars: int = 4000,
|
||||
previous_response_id: str | None = None,
|
||||
client_tool_turn: ClientToolTurn | None = None,
|
||||
) -> AsyncIterator[StreamEvent]: ...
|
||||
|
||||
Reference in New Issue
Block a user