feat: add stateful responses API

This commit is contained in:
Xin Wang
2026-09-07 00:15:32 +08:00
parent ab409ba9c0
commit 43f2cc445e
22 changed files with 2461 additions and 5 deletions
+8
View File
@@ -66,3 +66,11 @@ class FastGPTBrain(BaseBrain):
def build_llm(self, cfg: AssistantConfig, context: LLMContext) -> FrameProcessor:
return FastGPTLLMService(cfg, chat_id=self._chat_id)
def restore_text_state(self, snapshot: dict) -> None:
if snapshot.get("type") != "fastgpt":
raise ValueError("Responses runtime state does not belong to FastGPT")
self._chat_id = str(snapshot.get("chat_id") or self._chat_id)
def text_state_snapshot(self) -> dict:
return {"type": "fastgpt", "chat_id": self._chat_id}