#2379 Move continue prefill to end of completion
This commit is contained in:
parent
3cafc22e1d
commit
339428a4e9
|
@ -723,7 +723,7 @@ function populationInjectionPrompts(prompts, messages) {
|
||||||
const jointPrompt = [rolePrompts, extensionPrompt].filter(x => x).map(x => x.trim()).join(separator);
|
const jointPrompt = [rolePrompts, extensionPrompt].filter(x => x).map(x => x.trim()).join(separator);
|
||||||
|
|
||||||
if (jointPrompt && jointPrompt.length) {
|
if (jointPrompt && jointPrompt.length) {
|
||||||
roleMessages.push({ 'role': role, 'content': jointPrompt });
|
roleMessages.push({ 'role': role, 'content': jointPrompt, injected: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,6 +795,7 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul
|
||||||
|
|
||||||
// Insert chat messages as long as there is budget available
|
// Insert chat messages as long as there is budget available
|
||||||
const chatPool = [...messages].reverse();
|
const chatPool = [...messages].reverse();
|
||||||
|
const firstNonInjected = chatPool.find(x => !x.injected);
|
||||||
for (let index = 0; index < chatPool.length; index++) {
|
for (let index = 0; index < chatPool.length; index++) {
|
||||||
const chatPrompt = chatPool[index];
|
const chatPrompt = chatPool[index];
|
||||||
|
|
||||||
|
@ -813,6 +814,12 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatCompletion.canAfford(chatMessage)) {
|
if (chatCompletion.canAfford(chatMessage)) {
|
||||||
|
if (type === 'continue' && oai_settings.continue_prefill && chatPrompt === firstNonInjected) {
|
||||||
|
const collection = new MessageCollection('continuePrefill', chatMessage);
|
||||||
|
chatCompletion.add(collection, -1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
chatCompletion.insertAtStart(chatMessage, 'chatHistory');
|
chatCompletion.insertAtStart(chatMessage, 'chatHistory');
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue