feat: add stateful responses API
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user