#2557 Put MistralAI prefix under a feature toggle

This commit is contained in:
Cohee
2024-07-27 19:57:40 +03:00
parent 8dd5d9321d
commit 5ad433c576
2 changed files with 8 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
require('./polyfill.js');
const { getConfigValue } = require('./util.js');
/**
* Convert a prompt from the ChatML objects to the format used by Claude.
@@ -373,8 +374,9 @@ function convertMistralMessages(messages, charName = '', userName = '') {
}
// Make the last assistant message a prefill
const prefixEnabled = getConfigValue('mistral.enablePrefix', false);
const lastMsg = messages[messages.length - 1];
if (messages.length > 0 && lastMsg && (lastMsg.role === 'assistant')) {
if (prefixEnabled && messages.length > 0 && lastMsg?.role === 'assistant') {
lastMsg.prefix = true;
}