Fix invalid character name error not being handled

This commit is contained in:
maver 2023-07-15 17:38:40 +02:00
parent 00e9987fb7
commit 6a52d6febd
1 changed files with 2 additions and 2 deletions

View File

@ -449,7 +449,7 @@ function populateChatHistory(prompts, chatCompletion, type = null, cyclePrompt =
if (true === promptManager.serviceSettings.names_in_completion && prompt.name)
if (promptManager.isValidName(prompt.name)) chatMessage.name = prompt.name;
else throw InvalidCharacterNameError();
else throw new InvalidCharacterNameError();
if (chatCompletion.canAfford(chatMessage)) chatCompletion.insertAtStart(chatMessage, 'chatHistory');
else return false;
@ -720,7 +720,7 @@ function prepareOpenAIMessages({
}
} finally {
const messages = chatCompletion.getMessages();
promptManager.populateTokenHandler(messages);
if (null === promptManager.error) promptManager.populateTokenHandler(messages);
promptManager.setMessages(messages);
// All information are up-to-date, render.