feat: 完成倍率的配置化

This commit is contained in:
chenchun
2025-11-25 09:54:13 +08:00
parent 4c65b2398d
commit 688d93e5c1
7 changed files with 24 additions and 12 deletions

View File

@@ -14,8 +14,6 @@ public class AnthropicChatCompletionsService(
ILogger<AnthropicChatCompletionsService> logger)
: IAnthropicChatCompletionService
{
public const double ClaudeMultiplier = 1.3d;
public async Task<AnthropicChatCompletionDto> ChatCompletionsAsync(AiModelDescribe options, AnthropicInput input,
CancellationToken cancellationToken = default)
{
@@ -86,8 +84,7 @@ public class AnthropicChatCompletionsService(
var value =
await response.Content.ReadFromJsonAsync<AnthropicChatCompletionDto>(ThorJsonSerializer.DefaultOptions,
cancellationToken: cancellationToken);
value.SupplementalMultiplier(AnthropicChatCompletionsService.ClaudeMultiplier);
return value;
}
@@ -169,8 +166,7 @@ public class AnthropicChatCompletionsService(
var result = JsonSerializer.Deserialize<AnthropicStreamDto>(data,
ThorJsonSerializer.DefaultOptions);
result.SupplementalMultiplier(AnthropicChatCompletionsService.ClaudeMultiplier);
yield return (eventType, result);
}
}

View File

@@ -716,7 +716,7 @@ public sealed class ClaudiaChatCompletionsService(
output.Usage.PromptTokens = output.Usage.InputTokens;
output.Usage.CompletionTokens = output.Usage.OutputTokens;
output.Usage.TotalTokens = output.Usage.InputTokens + output.Usage.OutputTokens;
output.SupplementalMultiplier(AnthropicChatCompletionsService.ClaudeMultiplier);
yield return output;
}
}
@@ -873,7 +873,6 @@ public sealed class ClaudiaChatCompletionsService(
}
thor.Usage.TotalTokens = thor.Usage.InputTokens + thor.Usage.OutputTokens;
thor.SupplementalMultiplier(AnthropicChatCompletionsService.ClaudeMultiplier);
return thor;
}
}