Skip to content

Enhancement: prevent chatgpt autopost when attachment is available #1133

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private RestAction<Message> createAIResponse(ThreadChannel threadChannel, Messag
}

private static boolean isContextSufficient(Message message) {
return !MessageUtils.containsImage(message)
return !MessageUtils.containsAttachments(message)
&& !LinkDetection.containsLink(message.getContentRaw());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ public static Optional<CodeFence> extractCode(String fullMessage) {
}

/**
* Checks if a given message contains any image attachments.
*
* Checks if a given message contains any attachments.
*
* @param message the message to be checked
* @return {@code true} if the message contains at least one image attachment
* @return {@code true} if the message contains at least one attachment
*
* @see Message
* @see Message.Attachment
*/
public static boolean containsImage(Message message) {
return message.getAttachments().stream().anyMatch(Message.Attachment::isImage);
public static boolean containsAttachments(Message message) {
return !message.getAttachments().isEmpty();
}

}
Loading