Skip to content

Commit

Permalink
fix: log dalle3 images
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanssen0 committed Dec 21, 2023
1 parent 5d1eea5 commit 6b42912
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion QueueHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,15 @@ def _collect_data(self, request_response: RequestResponseContainer, log_request=
# Images
for image_url in request_response.response_images:
try:
response = base64.b64encode(requests.get(image_url, timeout=120).content).decode("utf-8")
response = None
if isinstance(image_url, str):
response = base64.b64encode(requests.get(image_url, timeout=120).content).decode("utf-8")
else:
img_type, img = image_url
if img_type == "base64":
response = img
else:
raise Exception(f"Unknown image type: {img_type}")
log_file.write(response_str_to_format.format(request_response.response_timestamp,
request_response.id,
request_response.user["user_name"],
Expand Down

0 comments on commit 6b42912

Please sign in to comment.