diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2023-09-22 21:40:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 21:40:59 +0200 |
commit | ba287e89b55118965ff0e151e54636b1f50d3b38 (patch) | |
tree | dc69218fecae4971c90ae391ff6919c032b93540 /g4f/Provider/CodeLinkAva.py | |
parent | ~ | gpt-3.5-turbo-0613 (diff) | |
parent | Add RetryProvider (diff) | |
download | gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.gz gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.bz2 gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.lz gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.xz gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.zst gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.zip |
Diffstat (limited to 'g4f/Provider/CodeLinkAva.py')
-rw-r--r-- | g4f/Provider/CodeLinkAva.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/g4f/Provider/CodeLinkAva.py b/g4f/Provider/CodeLinkAva.py index 3ab4e264..e3b3eb3e 100644 --- a/g4f/Provider/CodeLinkAva.py +++ b/g4f/Provider/CodeLinkAva.py @@ -40,11 +40,12 @@ class CodeLinkAva(AsyncGeneratorProvider): } async with session.post("https://ava-alpha-api.codelink.io/api/chat", json=data) as response: response.raise_for_status() - start = "data: " async for line in response.content: line = line.decode() - if line.startswith("data: ") and not line.startswith("data: [DONE]"): - line = json.loads(line[len(start):-1]) + if line.startswith("data: "): + if line.startswith("data: [DONE]"): + break + line = json.loads(line[6:-1]) content = line["choices"][0]["delta"].get("content") if content: yield content |