mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#2085 Switch to async token counters
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
user_avatar,
|
||||
} from '../script.js';
|
||||
import { persona_description_positions, power_user } from './power-user.js';
|
||||
import { getTokenCount } from './tokenizers.js';
|
||||
import { getTokenCountAsync } from './tokenizers.js';
|
||||
import { debounce, delay, download, parseJsonFile } from './utils.js';
|
||||
|
||||
const GRID_STORAGE_KEY = 'Personas_GridView';
|
||||
@@ -171,9 +171,9 @@ export async function convertCharacterToPersona(characterId = null) {
|
||||
/**
|
||||
* Counts the number of tokens in a persona description.
|
||||
*/
|
||||
const countPersonaDescriptionTokens = debounce(() => {
|
||||
const countPersonaDescriptionTokens = debounce(async () => {
|
||||
const description = String($('#persona_description').val());
|
||||
const count = getTokenCount(description);
|
||||
const count = await getTokenCountAsync(description);
|
||||
$('#persona_description_token_count').text(String(count));
|
||||
}, 1000);
|
||||
|
||||
|
Reference in New Issue
Block a user