mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-04 21:27:34 +01:00
fix: move prefill continuation handling to populateChatHistory
This commit is contained in:
parent
d5f94577dc
commit
aae934a849
@ -724,6 +724,12 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul
|
||||
|
||||
if (chatCompletion.canAfford(chatMessage)) {
|
||||
if (type === 'continue' && oai_settings.continue_prefill && chatPrompt === firstNonInjected) {
|
||||
// in case we are using continue_prefill and the latest message is an assistant message, we want to prepend the users assistant prefill on the message
|
||||
if (chatPrompt.role === 'assistant') {
|
||||
const collection = new MessageCollection('continuePrefill', new Message(chatMessage.role, substituteParams(oai_settings.assistant_prefill + '\n\n') + chatMessage.content, chatMessage.identifier));
|
||||
chatCompletion.add(collection, -1);
|
||||
continue;
|
||||
}
|
||||
const collection = new MessageCollection('continuePrefill', chatMessage);
|
||||
chatCompletion.add(collection, -1);
|
||||
continue;
|
||||
@ -1771,7 +1777,7 @@ async function sendOpenAIRequest(type, messages, signal) {
|
||||
generate_data['stop'] = getCustomStoppingStrings(); // Claude shouldn't have limits on stop strings.
|
||||
generate_data['human_sysprompt_message'] = substituteParams(oai_settings.human_sysprompt_message);
|
||||
// Don't add a prefill on quiet gens (summarization)
|
||||
if (!isQuiet) {
|
||||
if (!isQuiet && !isContinue) {
|
||||
generate_data['assistant_prefill'] = isImpersonate ? substituteParams(oai_settings.assistant_impersonation) : substituteParams(oai_settings.assistant_prefill);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user