@@ -1,5 +1,5 @@
|
||||
import { localforage } from '../lib.js';
|
||||
import { characters, main_api, nai_settings, online_status, this_chid } from '../script.js';
|
||||
import { characters, event_types, eventSource, main_api, nai_settings, online_status, this_chid } from '../script.js';
|
||||
import { power_user, registerDebugFunction } from './power-user.js';
|
||||
import { chat_completion_sources, model_list, oai_settings } from './openai.js';
|
||||
import { groups, selected_group } from './group-chats.js';
|
||||
@@ -1223,6 +1223,12 @@ export async function initTokenizers() {
|
||||
textgen_types.VLLM,
|
||||
textgen_types.APHRODITE,
|
||||
);
|
||||
eventSource.on(event_types.ONLINE_STATUS_CHANGED, async () => {
|
||||
// Clear tokenizer warning when (re)connecting to an LLM backend that supports tokenization
|
||||
if (main_api === 'textgenerationwebui' && TEXTGEN_TOKENIZERS.includes(textgen_settings.type)) {
|
||||
sessionStorage.removeItem(TOKENIZER_WARNING_KEY);
|
||||
}
|
||||
});
|
||||
await loadTokenCache();
|
||||
registerDebugFunction('resetTokenCache', 'Reset token cache', 'Purges the calculated token counts. Use this if you want to force a full re-tokenization of all chats or suspect the token counts are wrong.', resetTokenCache);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user