mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#2557 Put MistralAI prefix under a feature toggle
This commit is contained in:
@@ -93,6 +93,11 @@ openai:
|
|||||||
deepl:
|
deepl:
|
||||||
# Available options: default, more, less, prefer_more, prefer_less
|
# Available options: default, more, less, prefer_more, prefer_less
|
||||||
formality: default
|
formality: default
|
||||||
|
# -- MISTRAL API CONFIGURATION --
|
||||||
|
mistral:
|
||||||
|
# Enables prefilling of the reply with the last assistant message in the prompt
|
||||||
|
# CAUTION: The prefix is echoed into the completion. You may want to use regex to trim it out.
|
||||||
|
enablePrefix: false
|
||||||
# -- SERVER PLUGIN CONFIGURATION --
|
# -- SERVER PLUGIN CONFIGURATION --
|
||||||
enableServerPlugins: false
|
enableServerPlugins: false
|
||||||
# User session timeout *in seconds* (defaults to 24 hours).
|
# User session timeout *in seconds* (defaults to 24 hours).
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
require('./polyfill.js');
|
require('./polyfill.js');
|
||||||
|
const { getConfigValue } = require('./util.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a prompt from the ChatML objects to the format used by Claude.
|
* 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
|
// Make the last assistant message a prefill
|
||||||
|
const prefixEnabled = getConfigValue('mistral.enablePrefix', false);
|
||||||
const lastMsg = messages[messages.length - 1];
|
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;
|
lastMsg.prefix = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user