From b5b56f35caf584ec92e50998979aa8bc065f67d5 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 17 Mar 2024 10:51:08 +0100 Subject: Fix abort in webview --- g4f/gui/server/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'g4f/gui/server') diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 966319e4..4dfc43d4 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -80,7 +80,8 @@ class Api(): self._prepare_conversation_kwargs(options, kwargs), options.get("conversation_id") ): - window.evaluate_js(f"this.add_message_chunk({json.dumps(message)})") + if not window.evaluate_js(f"if (!this.abort) this.add_message_chunk({json.dumps(message)}); !this.abort && !this.error;"): + break def _prepare_conversation_kwargs(self, json_data: dict, kwargs: dict): """ -- cgit v1.2.3