-
-
Notifications
You must be signed in to change notification settings - Fork 105
Feature: Implement /rewrite command for message improvement using Cha… #1378
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
base: develop
Are you sure you want to change the base?
Conversation
|
| * <p> | ||
| * Users can optionally specify a tone/style for the rewrite. If not provided, defaults to CLEAR. | ||
| */ | ||
| public final class RewriteMsgCommand extends SlashCommandAdapter { |
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.
dont abbreviate, RewriteMsgCommand. but to avoid confusion i would try to stick to the actual slash-command name, so just RewriteCommand would be better imo
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.
I thought about doing that in the beginning, but I found that it may be confusing, since it's possible to be interpreted "rewrite something else, other than a message", so I found it better to write "Message" as abbreviation to avoid verbosity
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.
but that confusion then also applies to the slashcommand. if u think its confusing then the slash command has to be renamed as well, to /rewrite-msg for example. then the class name is okay again
|
|
||
|
|
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.
double new line
|
|
||
|
|
||
| public RewriteMsgCommand(RewriteMsgService rewriteMsgService) { | ||
| super(COMMAND_NAME, "Rewrite your message in a clearer, more professional form", |
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.
I would reword it to "Let AI rephrase and improve your message"
| * Users can optionally specify a tone/style for the rewrite. If not provided, defaults to CLEAR. | ||
| */ | ||
| public final class RewriteMsgCommand extends SlashCommandAdapter { | ||
| private static final Logger logger = LoggerFactory.getLogger(RewriteMsgCommand.class); |
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.
your logging in this entire class is mostly all over. almost all your "debug" logs are trace logs instead.
and most of your info logs are debug logs.
this has to be adjusted. ill try to leave comments on a per-log base
|
|
||
| this.rewriteMsgService = rewriteMsgService; | ||
|
|
||
| logger.debug("Initializing RewriteMsgCommand with ChatGptService and HelpSystemHelper"); |
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.
obsolete, BotCore already logs this stuff on trace level. remove
| final int previewLength = Math.min(50, message.length()); | ||
| final String preview = message.substring(0, previewLength); | ||
|
|
||
| logger.debug("Message content preview: {}", preview); |
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.
that log is missing context and not that helpful without
| * <p> | ||
| * Each tone provides a specific instruction to ChatGPT for how to approach the rewrite. | ||
| */ | ||
| public enum RewriteMsgTone { |
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.
put it as private helper inside RewriteCommand, then remove all the javadoc. all javadoc in this class is obsolete and just documenting what the code already says, its not needed and just bloat
| public String getPromptInstruction() { | ||
| return switch (this) { | ||
| case CLEAR -> "Make it clear and easy to understand."; | ||
| case PRO -> "Use a professional and polished tone."; | ||
| case DETAILED -> "Expand with more detail and explanation."; | ||
| case TECHNICAL -> "Use technical and specialized language where appropriate."; | ||
| }; | ||
| } |
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.
make that a field instead, like your displayName
| public String getDisplayName() { | ||
| return displayName; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the prompt instruction for this tone. | ||
| * | ||
| * @return the prompt instruction to include in ChatGPT prompt | ||
| */ | ||
| public String getPromptInstruction() { |
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.
once you moved that into RewriteCommand as private enum Tone {...}, the getters are obsolete as RewriteCommand can access the fields directly. so go for just:
private enum Tone {
CLEAR("Clear", "Make it clear and easy to understand."),
PRO("Pro", "Use a professional and polished tone."),
...
final String displayName;
final String promptInstructions;
Tone(String displayName, String promptInstructions) { ... }
}| TopHelpersService topHelpersService = new TopHelpersService(database); | ||
| TopHelpersAssignmentRoutine topHelpersAssignmentRoutine = | ||
| new TopHelpersAssignmentRoutine(config, topHelpersService); | ||
| RewriteMsgService rewriteService = new RewriteMsgService(chatGptService, helpSystemHelper); |
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.
(as commented on earlier, this service shouldnt exist)




New Feature: Rewrite Command
The
/rewritecommand allows users to have their messages rewritten in a clearer, more professional, or better structured form using ChatGPT AI (GPT 5 mini). The rewritten message is displayed as an ephemeral message (visible only to the user), making it perfect for getting quick writing improvements without cluttering the channel where they are.Usage
Parameters
CLEARif not providedAvailable Tones
How It Works
Example