Merge pull request #3888 from KTibow/patch-1 change language when context size exceeded

b3e012bea3b8adf630ebc995ebd9f7f5d9b9b839

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +3 -3Showing whitespace changes
public/scripts/openai.js+3 -3
@@ -1412,9 +1412,9 @@ export async function prepareOpenAIMessages({
1412 await populateChatCompletion(prompts, chatCompletion, { bias, quietPrompt, quietImage, type, cyclePrompt, messages, messageExamples });1412 await populateChatCompletion(prompts, chatCompletion, { bias, quietPrompt, quietImage, type, cyclePrompt, messages, messageExamples });
1413 } catch (error) {1413 } catch (error) {
1414 if (error instanceof TokenBudgetExceededError) {1414 if (error instanceof TokenBudgetExceededError) {
1415 toastr.error(t`An error occurred while counting tokens: Token budget exceeded.`);1415 toastr.error(t`Mandatory prompts exceed the context size.`);
1416 chatCompletion.log('Token budget exceeded.');1416 chatCompletion.log('Mandatory prompts exceed the context size.');
1417 promptManager.error = t`Not enough free tokens for mandatory prompts. Raise your token Limit or disable custom prompts.`;1417 promptManager.error = t`Not enough free tokens for mandatory prompts. Raise your token limit or disable custom prompts.`;
1418 } else if (error instanceof InvalidCharacterNameError) {1418 } else if (error instanceof InvalidCharacterNameError) {
1419 toastr.warning(t`An error occurred while counting tokens: Invalid character name`);1419 toastr.warning(t`An error occurred while counting tokens: Invalid character name`);
1420 chatCompletion.log('Invalid character name');1420 chatCompletion.log('Invalid character name');