mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-10 16:13:42 +08:00
feat: support claude stream_options
This commit is contained in:
@@ -24,3 +24,15 @@ func ResponseText2Usage(responseText string, modeName string, promptTokens int)
|
||||
usage.TotalTokens = usage.PromptTokens + usage.CompletionTokens
|
||||
return usage, err
|
||||
}
|
||||
|
||||
func GenerateFinalUsageResponse(id string, createAt int64, model string, usage dto.Usage) *dto.ChatCompletionsStreamResponse {
|
||||
return &dto.ChatCompletionsStreamResponse{
|
||||
Id: id,
|
||||
Object: "chat.completion.chunk",
|
||||
Created: createAt,
|
||||
Model: model,
|
||||
SystemFingerprint: nil,
|
||||
Choices: nil,
|
||||
Usage: &usage,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user