diff options
| author | Martin Bielik <martin.bielik@instea.sk> | 2024-12-22 14:55:15 +0100 |
|---|---|---|
| committer | Martin Bielik <martin.bielik@instea.sk> | 2024-12-22 14:55:15 +0100 |
| commit | fbc2bfb445c71985e9fc399d3fac2def2fc6854e (patch) | |
| tree | e93db9bf177d8790c608e3871d9f55d259510855 /py/utils.py | |
| parent | 4f1c95386437c8fa6e189c136681950a91fb25c9 (diff) | |
| download | vim-ai-fbc2bfb445c71985e9fc399d3fac2def2fc6854e.tar.gz | |
added image generation
Diffstat (limited to '')
| -rw-r--r-- | py/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
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() |