Skip to content

Commit 2b55087

Browse files
committed
feature "rewrite-msg command" - reply to taz 2nd review;
1. ChatGptService: MAX_TOKENS value updated to 500; 2. RewriteCommand: Adding more precision in Ai Prompt message;
1 parent aebfa42 commit 2b55087

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.openai.models.responses.Response;
66
import com.openai.models.responses.ResponseCreateParams;
77
import com.openai.models.responses.ResponseOutputText;
8-
import net.dv8tion.jda.api.entities.Message;
98
import org.slf4j.Logger;
109
import org.slf4j.LoggerFactory;
1110

@@ -24,8 +23,11 @@ public class ChatGptService {
2423
private static final Logger logger = LoggerFactory.getLogger(ChatGptService.class);
2524
private static final Duration TIMEOUT = Duration.ofSeconds(90);
2625

27-
/** The maximum number of tokens allowed for the generated answer. */
28-
private static final int MAX_TOKENS = Message.MAX_CONTENT_LENGTH;
26+
/**
27+
* The maximum number of tokens allowed for the generated answer. This value is appropriate for
28+
* Discord's 2000 character message limit.
29+
*/
30+
private static final int MAX_TOKENS = 500;
2931

3032
private boolean isDisabled = false;
3133
private OpenAIClient openAIClient;

application/src/main/java/org/togetherjava/tjbot/features/messages/RewriteCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public final class RewriteCommand extends SlashCommandAdapter {
4848
4949
If the message is already well-written, make only minor improvements.
5050
51+
Reply with ONLY the rewritten message, nothing else (greetings, preamble, etc).
52+
5153
Message to rewrite:
5254
%s
5355
""".stripIndent();

0 commit comments

Comments
 (0)