Commit 697f0469 by Jonathan Thomas

Fixing regression which caused uncleaned messages (i.e. with behaviors) to be…

Fixing regression which caused uncleaned messages (i.e. with behaviors) to be broadcast to players. This is fixed by adding only the cleaned message, and then updating the previousMessage history with the original/uncleaned message.
parent 536b8832
Pipeline #13284 passed with stages
in 2 minutes 8 seconds
......@@ -525,16 +525,18 @@ public class EntityChatData {
}
}
// Add ASSISTANT message to history
this.addMessage(result.getOriginalMessage(), ChatDataManager.ChatSender.ASSISTANT, player, systemPrompt);
// Get cleaned message (i.e. no <BEHAVIOR> strings)
String cleanedMessage = result.getCleanedMessage();
if (cleanedMessage.isEmpty()) {
cleanedMessage = Randomizer.getRandomMessage(Randomizer.RandomType.NO_RESPONSE);
}
// Update the current message to a 'cleaned version'
this.currentMessage = cleanedMessage;
// Add ASSISTANT message to history
this.addMessage(cleanedMessage, ChatDataManager.ChatSender.ASSISTANT, player, systemPrompt);
// Update the last entry in previousMessages to use the original message
this.previousMessages.set(this.previousMessages.size() - 1,
new ChatMessage(result.getOriginalMessage(), ChatDataManager.ChatSender.ASSISTANT, player.getDisplayName().getString()));
} else {
// Error / No Chat Message (Failure)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment