mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 10:13:48 +00:00
Added the exact token count where the provider reports it
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c95cc5bacc
commit
0aa3b23b81
21 files changed
+598
-7
No files matched your search
@@ -1037,6 +1037,20 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// The line stating what the request cost carries no content of its own: providers
|
||||
// send it as the last line of the stream, with no choices at all. It is handled
|
||||
// before the check below, which would otherwise drop it as an empty response.
|
||||
//
|
||||
if (providerResponse.ContainsUsage())
|
||||
{
|
||||
yield return providerResponse.ContainsContent()
|
||||
? providerResponse.GetContent() with { Usage = providerResponse.GetUsage() }
|
||||
: new(string.Empty, [], providerResponse.GetUsage());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip empty responses:
|
||||
if (!providerResponse.ContainsContent())
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user