Skip to content

Commit 7faac21

Browse files
committed
Tell ChatGPT to use code block markdown syntax
1 parent db709c9 commit 7faac21

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/main/java/oakbot/listener/chatgpt/ChatGPT.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ public void run(IBot bot) throws Exception {
161161
continue;
162162
}
163163

164-
var prompt = buildPrompt(roomId, bot);
165-
prompt += " Nobody is talking to you directly; you are just sharing your thoughts.";
164+
var prompt = buildPromptForSpontaneousPost(roomId, bot);
166165

167166
var apiMessages = buildChatCompletionMessages(prompt, messages, bot);
168167

@@ -328,6 +327,18 @@ public String buildPrompt(int roomId, IBot bot) {
328327
prompt = prompt.replace("$ROOMNAME", roomName);
329328
}
330329

330+
/*
331+
* ChatGPT stopped doing this in gpt-5. The SO chat post is converted to
332+
* monospace if these are detected.
333+
*/
334+
prompt += " Surround all code blocks with ``` markdown syntax.";
335+
336+
return prompt;
337+
}
338+
339+
public String buildPromptForSpontaneousPost(int roomId, IBot bot) {
340+
var prompt = buildPrompt(roomId, bot);
341+
prompt += " Nobody is talking to you directly; you are just sharing your thoughts.";
331342
return prompt;
332343
}
333344

0 commit comments

Comments
 (0)