From 3e4d2117e130d6fa3dd9bc3d6309c240bfa47a06 Mon Sep 17 00:00:00 2001 From: Kaveen Kumarasinghe Date: Fri, 17 Nov 2023 11:14:26 -0500 Subject: [PATCH] pass is_drawable correctly --- services/text_service.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/services/text_service.py b/services/text_service.py index 1d6ce3b7..ccda3a98 100644 --- a/services/text_service.py +++ b/services/text_service.py @@ -353,16 +353,19 @@ async def encapsulated_send( usage_message = None if is_chatgpt_conversation: - if is_drawable: - converser_cog.conversation_threads[ - ctx.channel.id - ].history[0].text += "\nYou are able to draw images in this conversation. Only draw when EXPLICITLY asked to do so, otherwise, work on a prompt with the user and ask them if they'd like to draw, if you're discussing drawing in the first place." + converser_cog.conversation_threads[ctx.channel.id].history[ + 0 + ].text += ("\nYou are able to draw images in this conversation. Only draw when EXPLICITLY asked to " + "do so, otherwise, work on a prompt with the user and ask them if they'd like to draw, " + "if you're discussing drawing in the first place. Images that you draw will " + "automatically be sent in chat to the user so you don't need to name the file or " + "provide the file yourself, you will already have knowledge of what is drawn and will " + "simply describe it.") else: - converser_cog.conversation_threads[ - ctx.channel.id - ].history[ - 0].text += "\nYou are unable to draw images in this conversation. Ask the user to start a conversation with gpt-4-vision with the `draw` option turned on in order to have this ability." + converser_cog.conversation_threads[ctx.channel.id].history[ + 0 + ].text += "\nYou are unable to draw images in this conversation. Ask the user to start a conversation with gpt-4-vision with the `draw` option turned on in order to have this ability." _prompt_with_history = converser_cog.conversation_threads[ ctx.channel.id @@ -890,7 +893,11 @@ async def process_conversation_message( # Determine if we should draw an image and determine what to draw, and handle the drawing itself # TODO: This should be encapsulated better into some other service or function so we're not cluttering this text service file, this text service file is gross right now.. - if "-vision" in model and not converser_cog.pinecone_service and converser_cog.conversation_threads[message.channel.id].drawable: + if ( + "-vision" in model + and not converser_cog.pinecone_service + and converser_cog.conversation_threads[message.channel.id].drawable + ): print("Checking for if the user asked to draw") draw_check_prompt = """ You will be given a set of conversation items and you will determine if the intent of the user(s) are to draw/create a picture or not, if the intent is to @@ -1029,6 +1036,9 @@ async def process_conversation_message( overrides=overrides, model=converser_cog.conversation_threads[message.channel.id].model, custom_api_key=user_api_key, + is_drawable=converser_cog.conversation_threads[ + message.channel.id + ].drawable, ) # Delete the thinking embed