mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 01:26:37 +08:00
support stream usage
This commit is contained in:
parent
e916af9c56
commit
59a835ede7
@ -121,11 +121,12 @@ func streamResponseXunfei2OpenAI(xunfeiResponse *ChatResponse) *openai.ChatCompl
|
|||||||
choice.FinishReason = &constant.StopFinishReason
|
choice.FinishReason = &constant.StopFinishReason
|
||||||
}
|
}
|
||||||
response := openai.ChatCompletionsStreamResponse{
|
response := openai.ChatCompletionsStreamResponse{
|
||||||
Id: fmt.Sprintf("chatcmpl-%s", random.GetUUID()),
|
Id: xunfeiResponse.Header.Sid,
|
||||||
Object: "chat.completion.chunk",
|
Object: "chat.completion.chunk",
|
||||||
Created: helper.GetTimestamp(),
|
Created: helper.GetTimestamp(),
|
||||||
Model: "SparkDesk",
|
Model: "SparkDesk",
|
||||||
Choices: []openai.ChatCompletionsStreamResponseChoice{choice},
|
Choices: []openai.ChatCompletionsStreamResponseChoice{choice},
|
||||||
|
Usage: &xunfeiResponse.Payload.Usage.Text,
|
||||||
}
|
}
|
||||||
return &response
|
return &response
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user