From e309e18e97b7735a9e77297c601c457dfb06ae83 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Wed, 7 Jun 2023 20:04:15 +0300 Subject: [PATCH] Reset token counters when switching characters. Put main prompt at the beginning --- public/scripts/PromptManager.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/scripts/PromptManager.js b/public/scripts/PromptManager.js index 01a604bb6..b83724ff9 100644 --- a/public/scripts/PromptManager.js +++ b/public/scripts/PromptManager.js @@ -445,6 +445,8 @@ PromptManagerModule.prototype.handleCharacterSelected = function (event) { if (0 === promptList.length) this.addPromptListForCharacter(this.activeCharacter, openAiDefaultPromptList) // Check whether the referenced prompts are present. if (0 === this.serviceSettings.prompts.length) this.setPrompts(openAiDefaultPrompts.prompts); + + this.updatePrompts(this.getChatCompletion().getPromptsWithTokenCount()); } PromptManagerModule.prototype.handleGroupSelected = function (event) { @@ -454,6 +456,8 @@ PromptManagerModule.prototype.handleGroupSelected = function (event) { if (0 === promptList.length) this.addPromptListForCharacter(characterDummy, openAiDefaultPromptList) if (0 === this.serviceSettings.prompts.length) this.setPrompts(openAiDefaultPrompts.prompts); + + this.updatePrompts(this.getChatCompletion().getPromptsWithTokenCount()); } PromptManagerModule.prototype.getActiveGroupCharacters = function() { @@ -901,6 +905,10 @@ const openAiDefaultPromptLists = { }; const openAiDefaultPromptList = [ + { + "identifier": "main", + "enabled": true + }, { "identifier": "worldInfoBefore", "enabled": true @@ -937,10 +945,6 @@ const openAiDefaultPromptList = [ "identifier": "chatHistory", "enabled": true }, - { - "identifier": "main", - "enabled": true - }, { "identifier": "jailbreak", "enabled": false