mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-09 15:53:48 +00:00
Kept the reported token usage as one record on the answer
This commit is contained in:
4 files changed
+77
-58
No files matched your search
@@ -1650,10 +1650,11 @@ public partial class ChatComponent : MSGComponentBase
|
||||
{
|
||||
for (var index = thread.Blocks.Count - 1; index >= 0; index--)
|
||||
{
|
||||
if (thread.Blocks[index].Content is not ContentText { IsStreaming: false } text)
|
||||
if (thread.Blocks[index].Content is not ContentText { IsStreaming: false, ReportedUsage: { } reported })
|
||||
continue;
|
||||
|
||||
if (!text.ReportedTokens.IsKnown)
|
||||
var usage = reported.ToTokenUsage();
|
||||
if (!usage.IsKnown)
|
||||
continue;
|
||||
|
||||
//
|
||||
@@ -1662,8 +1663,8 @@ public partial class ChatComponent : MSGComponentBase
|
||||
// answers of that same other model, so the search ends here and the estimate takes
|
||||
// over until this model has answered once.
|
||||
//
|
||||
return string.Equals(text.ReportedForModel, model.Id, StringComparison.Ordinal)
|
||||
? text.ReportedTokens
|
||||
return string.Equals(reported.ModelId, model.Id, StringComparison.Ordinal)
|
||||
? usage
|
||||
: TokenUsage.UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user