Update middleware.py

This commit is contained in:
Classic298 2025-11-29 11:11:21 +01:00 committed by GitHub
parent 20340c3e4e
commit bb4b547574
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -848,7 +848,7 @@ async def chat_image_generation_handler(
} }
) )
system_message_content = f"<context>Image generation was attempted but failed. The system is currently unable to generate the image. Tell the user that an error occurred: {error_message}</context>" system_message_content = f"<context>Image generation was attempted but failed. The system is currently unable to generate the image. Tell the user that the following error occurred: {error_message}</context>"
else: else:
# Create image(s) # Create image(s)
@ -911,7 +911,7 @@ async def chat_image_generation_handler(
} }
) )
system_message_content = "<context>The requested image has been created and is now being shown to the user. Let them know that it has been generated.</context>" system_message_content = "<context>The requested image has been created by the system successfully and is now being shown to the user. Let the user know that the image they requested has been generated and is now shown in the chat.</context>"
except Exception as e: except Exception as e:
log.debug(e) log.debug(e)
@ -932,7 +932,7 @@ async def chat_image_generation_handler(
} }
) )
system_message_content = f"<context>Image generation was attempted but failed. The system is currently unable to generate the image. Tell the user that an error occurred: {error_message}</context>" system_message_content = f"<context>Image generation was attempted but failed because of an error. The system is currently unable to generate the image. Tell the user that the following error occurred: {error_message}</context>"
if system_message_content: if system_message_content:
form_data["messages"] = add_or_update_system_message( form_data["messages"] = add_or_update_system_message(