Merge pull request #3888 from KTibow/patch-1

change language when context size exceeded
This commit is contained in:
Cohee
2025-04-21 00:26:40 +03:00
committed by GitHub

View File

@@ -1412,9 +1412,9 @@ export async function prepareOpenAIMessages({
await populateChatCompletion(prompts, chatCompletion, { bias, quietPrompt, quietImage, type, cyclePrompt, messages, messageExamples });
} catch (error) {
if (error instanceof TokenBudgetExceededError) {
toastr.error(t`An error occurred while counting tokens: Token budget exceeded.`);
chatCompletion.log('Token budget exceeded.');
promptManager.error = t`Not enough free tokens for mandatory prompts. Raise your token Limit or disable custom prompts.`;
toastr.error(t`Mandatory prompts exceed the context size.`);
chatCompletion.log('Mandatory prompts exceed the context size.');
promptManager.error = t`Not enough free tokens for mandatory prompts. Raise your token limit or disable custom prompts.`;
} else if (error instanceof InvalidCharacterNameError) {
toastr.warning(t`An error occurred while counting tokens: Invalid character name`);
chatCompletion.log('Invalid character name');