Skip to content

Commit

Permalink
compat further with one api
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Dec 15, 2023
1 parent c5f1e4e commit 36e19d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion request_llms/bridge_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def decode_chunk(chunk):
chunkjson = json.loads(chunk_decoded[6:])
has_choices = 'choices' in chunkjson
if has_choices: choice_valid = (len(chunkjson['choices']) > 0)
if has_choices and choice_valid: has_content = "content" in chunkjson['choices'][0]["delta"]
if has_choices and choice_valid: has_content = ("content" in chunkjson['choices'][0]["delta"])
if has_content: has_content = (chunkjson['choices'][0]["delta"]["content"] is not None)
if has_choices and choice_valid: has_role = "role" in chunkjson['choices'][0]["delta"]
except:
pass
Expand Down

0 comments on commit 36e19d5

Please sign in to comment.