-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image handling is currently broken #156
Conversation
jaresty
commented
Aug 12, 2024
- When you fetch the image source it formats the messages
- If you try to extract them as text at that point, images will not be processed at all
- In order to process images you have to keep the messages intact from source extraction through to insertion
- When you fetch the image source it formats the messages - If you try to extract them as text at that point, images will not be processed at all - In order to process images you have to keep the messages intact from source extraction through to insertion
@@ -138,27 +138,22 @@ def gpt_apply_prompt(prompt: str, source: str = "", destination: str = ""): | |||
|
|||
text_to_process: GPTMessageItem = actions.user.gpt_get_source_text(source) | |||
|
|||
# If after creating the message there wasn't anything in the text_to_process, set it to None so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check was blocking images from being processed
@@ -212,72 +207,75 @@ def gpt_insert_response( | |||
# Skip inserting the response if the user is just viewing the thread in the window | |||
actions.user.confirmation_gui_refresh_thread() | |||
|
|||
message_text_no_images = extract_message(gpt_message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract message currently returns text so if there's an image here it will return an empty string
@@ -40,6 +40,11 @@ def disable_thread(cls): | |||
@classmethod | |||
def push_context(cls, context: GPTMessageItem): | |||
"""Add the selected text to the stored context""" | |||
if context.get("type") != "text": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that images don't get inserted into the system messages since that would cause an error
- since only some destination support images, it makes sense to handle them in a separate case - this will now print an error message of someone tries to 'pass clip to window' with an image in their clipboard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made two quick edits. If the user wanted to append to the thread, we want to refresh the GUI. The gui refresh function won't do anything if it is closed so its fine either way.
thanks for help cleaning this up