summaryrefslogtreecommitdiffstats
path: root/g4f/gui
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-12 18:45:22 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-12 18:45:22 +0100
commit5bcf21f9bd2dd9ea581e5301113facda6fc28426 (patch)
treeee3bd34f1e061c80576d8a34cb2bf0033f80a4ac /g4f/gui
parentFix unit test with missing requirements (diff)
downloadgpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.tar
gpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.tar.gz
gpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.tar.bz2
gpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.tar.lz
gpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.tar.xz
gpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.tar.zst
gpt4free-5bcf21f9bd2dd9ea581e5301113facda6fc28426.zip
Diffstat (limited to 'g4f/gui')
-rw-r--r--g4f/gui/client/js/chat.v1.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js
index 8dd17275..16b4acb9 100644
--- a/g4f/gui/client/js/chat.v1.js
+++ b/g4f/gui/client/js/chat.v1.js
@@ -751,8 +751,12 @@ function count_words(text) {
return text.trim().match(/[\w\u4E00-\u9FA5]+/gu)?.length || 0;
}
+function count_chars(text) {
+ return text.match(/[^\s\p{P}]/gu)?.length || 0;
+}
+
function count_words_and_tokens(text, model) {
- return `(${count_words(text)} words, ${count_tokens(model, text)} tokens)`;
+ return `(${count_words(text)} words, ${count_chars(text)} chars, ${count_tokens(model, text)} tokens)`;
}
let countFocus = messageInput;