Skip to content

Commit 32bea33

Browse files
author
Jicheng Lu
committed
fix typo
1 parent 6a78bec commit 32bea33

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Infrastructure/BotSharp.Core/Conversations/Services/TokenStatistics.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ public void AddToken(TokenStatsModel stats, RoleDialogModel message)
5757
_completionCost += deltaCompletionCost;
5858

5959
// Accumulated Token
60-
var stat = _services.GetRequiredService<IConversationStateService>();
61-
var inputCount = int.Parse(stat.GetState("prompt_total", "0"));
62-
stat.SetState("prompt_total", stats.TotalInputTokens + inputCount, isNeedVersion: false, source: StateSource.Application);
63-
var outputCount = int.Parse(stat.GetState("completion_total", "0"));
64-
stat.SetState("completion_total", stats.TotalOutputTokens + outputCount, isNeedVersion: false, source: StateSource.Application);
60+
var state = _services.GetRequiredService<IConversationStateService>();
61+
var inputCount = int.Parse(state.GetState("prompt_total", "0"));
62+
state.SetState("prompt_total", stats.TotalInputTokens + inputCount, isNeedVersion: false, source: StateSource.Application);
63+
var outputCount = int.Parse(state.GetState("completion_total", "0"));
64+
state.SetState("completion_total", stats.TotalOutputTokens + outputCount, isNeedVersion: false, source: StateSource.Application);
6565

6666
// Total cost
67-
var total_cost = float.Parse(stat.GetState("llm_total_cost", "0"));
67+
var total_cost = float.Parse(state.GetState("llm_total_cost", "0"));
6868
total_cost += deltaTotal;
69-
stat.SetState("llm_total_cost", total_cost, isNeedVersion: false, source: StateSource.Application);
69+
state.SetState("llm_total_cost", total_cost, isNeedVersion: false, source: StateSource.Application);
7070

7171
// Save stats
7272
var metric = StatsMetric.AgentLlmCost;

0 commit comments

Comments
 (0)