From d4c8f3e8d595c50890aafd3911a1da54a8080287 Mon Sep 17 00:00:00 2001 From: abc <98614666+xtekky@users.noreply.github.com> Date: Sun, 19 Nov 2023 23:14:30 +0000 Subject: ~ | trying to improve compability with python versions < 3.8 --- g4f/Provider/deprecated/Ails.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'g4f/Provider/deprecated/Ails.py') diff --git a/g4f/Provider/deprecated/Ails.py b/g4f/Provider/deprecated/Ails.py index 93c63a69..5244fd75 100644 --- a/g4f/Provider/deprecated/Ails.py +++ b/g4f/Provider/deprecated/Ails.py @@ -69,7 +69,9 @@ class Ails(AsyncGeneratorProvider): if line.startswith(start) and line != "data: [DONE]": line = line[len(start):-1] line = json.loads(line) - if token := line["choices"][0]["delta"].get("content"): + token = line["choices"][0]["delta"].get("content") + + if token: if "ai.ls" in token or "ai.ci" in token: raise Exception(f"Response Error: {token}") yield token -- cgit v1.2.3