feat: 发布页前端工具改为等待浏览器回执后再继续模型

This commit is contained in:
2026-10-19 15:16:08 +08:00
parent 26f438eb6a
commit 216a2516b8
13 changed files with 435 additions and 166 deletions
+10 -1
View File
@@ -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]: ...