token count now adapts to chosen provider tokenizer

This commit is contained in:
PaulKoudelka committed 2026-04-14 16:27:10 +02:00
1 parent e07ca378d4
commit 41573406d5
10 files changed
+263336 -39

No files matched your search

@@ -994,6 +994,16 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
this.tokenCount = "0";
return;
}
var tokenizerResponse = await this.RustService.EnsureTokenizer(this.Provider);
if (tokenizerResponse is null)
return;
if (!tokenizerResponse.Value.Success)
{
this.Logger.LogWarning($"Failed to initialize the tokenizer for the provider: {tokenizerResponse.Value.Message}");
return;
}
var response = await this.RustService.GetTokenCount(this.inputField.Value);
if (response is null)
return;