фото исправить брат
This commit is contained in:
1 parent
a2c92651ce
commit
c961086f9e
1 file changed
+5
-2
+5
-2
@@ -4,6 +4,7 @@ import shelve
|
||||
import time
|
||||
import ai
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from configparser import DEFAULTSECT
|
||||
|
||||
@@ -106,11 +107,11 @@ async def generate(
|
||||
if images:
|
||||
if settings.get("vision"):
|
||||
for image in images:
|
||||
content += [{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image}"}}]
|
||||
content += [{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image['data']}"}}]
|
||||
else:
|
||||
for image in images:
|
||||
try:
|
||||
image_text = await image2text(image)
|
||||
image_text = await image2text(image["data"])
|
||||
prompt = f"<фото>{image_text}</фото>\n{prompt}"
|
||||
except Exception as e:
|
||||
print(f"{RED} -- err photo - {e} : {model}{RESET}")
|
||||
@@ -291,10 +292,12 @@ async def openai_generate_text(
|
||||
else:
|
||||
async for completion in ai.completions(**alo):
|
||||
pass
|
||||
print(completion)
|
||||
text = completion["choices"][0]["message"]["content"]
|
||||
except Exception as e:
|
||||
error = parse_response(str(e).lower())
|
||||
print(f"{RED} -- {error['type']} - {e}{RESET}")
|
||||
traceback.print_exc()
|
||||
return error["message"]
|
||||
else:
|
||||
text, s = clean_tail_repeats(text)
|
||||
|
||||
Reference in new issue
Block a user