From fbc2bfb445c71985e9fc399d3fac2def2fc6854e Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sun, 22 Dec 2024 14:55:15 +0100 Subject: added image generation --- py/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'py/utils.py') diff --git a/py/utils.py b/py/utils.py index d118326..8cd204f 100644 --- a/py/utils.py +++ b/py/utils.py @@ -250,7 +250,7 @@ def openai_request(url, data, options): ) with urllib.request.urlopen(req, timeout=request_timeout) as response: - if not data['stream']: + if not data.get('stream', 0): yield json.loads(response.read().decode()) return for line_bytes in response: @@ -354,3 +354,8 @@ def read_role_files(): roles = configparser.ConfigParser() roles.read([default_roles_config_path, roles_config_path]) return roles + +def save_b64_to_file(path, b64_data): + f = open(path, "wb") + f.write(base64.b64decode(b64_data)) + f.close() -- cgit v1.2.3