#2557 Put MistralAI prefix under a feature toggle

5ad433c576b7e6356272496a56ec81810283be73

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +8 -1Ignore whitespace
default/config.yaml+5 -0
@@ -93,6 +93,11 @@ openai:
93deepl:93deepl:
94 # Available options: default, more, less, prefer_more, prefer_less94 # Available options: default, more, less, prefer_more, prefer_less
95 formality: default95 formality: default
96# -- MISTRAL API CONFIGURATION --
97mistral:
98 # Enables prefilling of the reply with the last assistant message in the prompt
99 # CAUTION: The prefix is echoed into the completion. You may want to use regex to trim it out.
100 enablePrefix: false
96# -- SERVER PLUGIN CONFIGURATION --101# -- SERVER PLUGIN CONFIGURATION --
97enableServerPlugins: false102enableServerPlugins: false
98# User session timeout *in seconds* (defaults to 24 hours).103# User session timeout *in seconds* (defaults to 24 hours).
src/prompt-converters.js+3 -1
@@ -1,4 +1,5 @@
1require('./polyfill.js');1require('./polyfill.js');
2const { getConfigValue } = require('./util.js');
23
3/**4/**
4 * Convert a prompt from the ChatML objects to the format used by Claude.5 * Convert a prompt from the ChatML objects to the format used by Claude.
@@ -373,8 +374,9 @@ function convertMistralMessages(messages, charName = '', userName = '') {
373 }374 }
374375
375 // Make the last assistant message a prefill376 // Make the last assistant message a prefill
377 const prefixEnabled = getConfigValue('mistral.enablePrefix', false);
376 const lastMsg = messages[messages.length - 1];378 const lastMsg = messages[messages.length - 1];
377 if (messages.length > 0 && lastMsg && (lastMsg.role === 'assistant')) {379 if (prefixEnabled && messages.length > 0 && lastMsg?.role === 'assistant') {
378 lastMsg.prefix = true;380 lastMsg.prefix = true;
379 }381 }
380382