This commit is contained in:
Timothy Jaeryang Baek
2026-08-30 23:46:02 -04:00
parent df495a7945
commit aeb126b95d
5 changed files with 78 additions and 33 deletions
+12 -2
View File
@@ -389,11 +389,16 @@ async def generate_image(
images = await image_generations(
request=__request__,
form_data=CreateImageForm(prompt=prompt),
metadata=(
{'channel_id': __chat_id__.removeprefix('channel:'), 'message_id': __message_id__}
if isinstance(__chat_id__, str) and __chat_id__.startswith('channel:')
else None
),
user=user,
)
# Prepare file entries for the images
image_files = [{'type': 'image', 'url': img['url']} for img in images]
image_files = [{'type': 'image', **img} for img in images]
# Persist files to DB if chat context is available
if is_saved_chat_id(__chat_id__) and __message_id__ and images:
@@ -457,11 +462,16 @@ async def edit_image(
images = await image_edits(
request=__request__,
form_data=EditImageForm(prompt=prompt, image=image_urls),
metadata=(
{'channel_id': __chat_id__.removeprefix('channel:'), 'message_id': __message_id__}
if isinstance(__chat_id__, str) and __chat_id__.startswith('channel:')
else None
),
user=user,
)
# Prepare file entries for the images
image_files = [{'type': 'image', 'url': img['url']} for img in images]
image_files = [{'type': 'image', **img} for img in images]
# Persist files to DB if chat context is available
if is_saved_chat_id(__chat_id__) and __message_id__ and images: