mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-10 19:50:53 +08:00
23 lines
852 B
C#
23 lines
852 B
C#
using Yi.Framework.AiHub.Domain.Shared.Dtos.OpenAi;
|
|
|
|
namespace Yi.Framework.AiHub.Domain.AiGateWay;
|
|
|
|
public static class SupplementalMultiplierHelper
|
|
{
|
|
public static void SetSupplementalMultiplier(this ThorUsageResponse? usage,decimal multiplier)
|
|
{
|
|
if (usage is not null)
|
|
{
|
|
usage.InputTokens =
|
|
(int)Math.Round((usage.InputTokens ?? 0) * multiplier);
|
|
usage.OutputTokens =
|
|
(int)Math.Round((usage.OutputTokens ?? 0) * multiplier);
|
|
usage.CompletionTokens =
|
|
(int)Math.Round((usage.CompletionTokens ?? 0) * multiplier);
|
|
usage.PromptTokens =
|
|
(int)Math.Round((usage.PromptTokens ?? 0) * multiplier);
|
|
usage.TotalTokens =
|
|
(int)Math.Round((usage.TotalTokens ?? 0) * multiplier);
|
|
}
|
|
}
|
|
} |