Skip to content

Commit

Permalink
fixed bug: Additional properties are not allowed ('stream' was unexpe…
Browse files Browse the repository at this point in the history
…cted)
  • Loading branch information
yym68686 committed Nov 14, 2023
1 parent 7a742a0 commit 40887d7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions chatgpt2api/chatgpt2api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def dall_e_3(
json_post = {
"model": os.environ.get("IMAGE_MODEL_NAME") or model or self.engine,
"prompt": prompt,
"stream": True,
"n": 1,
"size": "1024x1024",
}
Expand All @@ -96,10 +95,9 @@ def dall_e_3(
raise t.APIConnectionError(
f"{response.status_code} {response.reason} {response.text}",
)
for line in response.iter_lines():
json_data = json.loads(line.decode("utf-8"))
url = json_data["data"][0]["url"]
yield url
json_data = json.loads(response.text)
url = json_data["data"][0]["url"]
yield url

class Chatbot:
"""
Expand Down

0 comments on commit 40887d7

Please sign in to comment.