mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 18:53:48 +00:00
token count now adapts to chosen provider tokenizer
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user