Merge pull request #986 from SillyTavern/prompt-manager-hotfix
Prompt manager hotfix
This commit is contained in:
commit
db9e9342fa
|
@ -1164,7 +1164,6 @@ PromptManagerModule.prototype.setChatCompletion = function (chatCompletion) {
|
|||
|
||||
this.setMessages(messages);
|
||||
this.populateTokenCounts(messages);
|
||||
this.populateLegacyTokenCounts(messages);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1194,7 +1193,7 @@ PromptManagerModule.prototype.populateTokenCounts = function (messages) {
|
|||
PromptManagerModule.prototype.populateLegacyTokenCounts = function (messages) {
|
||||
// Update general token counts
|
||||
const chatHistory = messages.getItemByIdentifier('chatHistory');
|
||||
const startChat = chatHistory?.getCollection()[0].getTokens() || 0;
|
||||
const startChat = chatHistory?.getCollection()[0]?.getTokens() || 0;
|
||||
const continueNudge = chatHistory?.getCollection().find(message => message.identifier === 'continueNudge')?.getTokens() || 0;
|
||||
|
||||
this.tokenHandler.counts = {
|
||||
|
|
|
@ -489,7 +489,7 @@ function populateChatHistory(prompts, chatCompletion, type = null, cyclePrompt =
|
|||
// Reserve budget for group nudge
|
||||
let groupNudgeMessage = null;
|
||||
if (selected_group) {
|
||||
const groupNudgeMessage = new Message.fromPrompt(prompts.get('groupNudge'));
|
||||
const groupNudgeMessage = Message.fromPrompt(prompts.get('groupNudge'));
|
||||
chatCompletion.reserveBudget(groupNudgeMessage);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue