#2557 Put MistralAI prefix under a feature toggle
| @@ -93,6 +93,11 @@ openai: | ||
| 93 | 93 | deepl: |
| 94 | 94 | # Available options: default, more, less, prefer_more, prefer_less |
| 95 | 95 | formality: default |
| 96 | +# -- MISTRAL API CONFIGURATION -- | |
| 97 | +mistral: | |
| 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 | 101 | # -- SERVER PLUGIN CONFIGURATION -- |
| 97 | 102 | enableServerPlugins: false |
| 98 | 103 | # User session timeout *in seconds* (defaults to 24 hours). |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | require('./polyfill.js'); |
| 2 | +const { getConfigValue } = require('./util.js'); | |
| 2 | 3 | |
| 3 | 4 | /** |
| 4 | 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 | } |
| 374 | 375 | |
| 375 | 376 | // Make the last assistant message a prefill |
| 377 | + const prefixEnabled = getConfigValue('mistral.enablePrefix', false); | |
| 376 | 378 | const lastMsg = messages[messages.length - 1]; |
| 377 | 379 | if (prefixEnabled && messages.length > 0 && lastMsg && (lastMsg?.role === 'assistant')) { |
| 378 | 380 | lastMsg.prefix = true; |
| 379 | 381 | } |
| 380 | 382 | |