mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-31 15:47:05 +00:00
fix(llmproxy): fix openai chatgpt api response error (#871)
This commit is contained in:
parent
1a8616dab8
commit
711032c480
@ -175,7 +175,7 @@ def chatgpt_generate_stream(
|
||||
# logger.info(str(r))
|
||||
# Azure Openai reponse may have empty choices body in the first chunk
|
||||
# to avoid index out of range error
|
||||
if not r.get("choices"):
|
||||
if len(r.choices) == 0:
|
||||
continue
|
||||
if r.choices[0].delta.content is not None:
|
||||
content = r.choices[0].delta.content
|
||||
@ -191,7 +191,7 @@ def chatgpt_generate_stream(
|
||||
|
||||
text = ""
|
||||
for r in res:
|
||||
if not r.get("choices"):
|
||||
if len(r.choices) == 0:
|
||||
continue
|
||||
if r["choices"][0]["delta"].get("content") is not None:
|
||||
content = r["choices"][0]["delta"]["content"]
|
||||
|
Loading…
Reference in New Issue
Block a user