mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-07 03:29:40 +00:00
Read the reported token usage in one place
This commit is contained in:
7 files changed
+23
-31
No files matched your search
@@ -1123,11 +1123,12 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
// 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())
|
||||
var usage = providerResponse.GetUsage();
|
||||
if (usage.IsKnown)
|
||||
{
|
||||
yield return providerResponse.ContainsContent()
|
||||
? providerResponse.GetContent() with { Usage = providerResponse.GetUsage() }
|
||||
: new(string.Empty, [], providerResponse.GetUsage());
|
||||
? providerResponse.GetContent() with { Usage = usage }
|
||||
: new(string.Empty, [], usage);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user