mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Only display a warning if card tokens is more than 50% of real context size
This commit is contained in:
@@ -11,8 +11,7 @@ import {
|
|||||||
is_send_press,
|
is_send_press,
|
||||||
getTokenCount,
|
getTokenCount,
|
||||||
menu_type,
|
menu_type,
|
||||||
|
max_context,
|
||||||
|
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
|
|
||||||
|
|
||||||
@@ -287,8 +286,8 @@ export function RA_CountCharTokens() {
|
|||||||
} else { console.debug("RA_TC -- no valid char found, closing."); }
|
} else { console.debug("RA_TC -- no valid char found, closing."); }
|
||||||
}
|
}
|
||||||
// display the counted tokens
|
// display the counted tokens
|
||||||
if (count_tokens < 1024 && perm_tokens < 1024) {
|
const tokenLimit = Math.max(((main_api !== 'openai' ? max_context : oai_settings.openai_max_context) / 2), 1024);
|
||||||
//display normal if both counts are under 1024
|
if (count_tokens < tokenLimit && perm_tokens < tokenLimit) {
|
||||||
$("#result_info").html(`<small>${count_tokens} Tokens (${perm_tokens} Permanent)</small>`);
|
$("#result_info").html(`<small>${count_tokens} Tokens (${perm_tokens} Permanent)</small>`);
|
||||||
} else {
|
} else {
|
||||||
$("#result_info").html(`
|
$("#result_info").html(`
|
||||||
|
Reference in New Issue
Block a user