From 59a835ede7d9325a3af55e26c47725b0c849bfe8 Mon Sep 17 00:00:00 2001 From: ybyang Date: Thu, 28 Nov 2024 18:05:38 +0800 Subject: [PATCH] support stream usage --- relay/adaptor/xunfei/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/adaptor/xunfei/main.go b/relay/adaptor/xunfei/main.go index 6f100e8b..359cd49a 100644 --- a/relay/adaptor/xunfei/main.go +++ b/relay/adaptor/xunfei/main.go @@ -121,11 +121,12 @@ func streamResponseXunfei2OpenAI(xunfeiResponse *ChatResponse) *openai.ChatCompl choice.FinishReason = &constant.StopFinishReason } response := openai.ChatCompletionsStreamResponse{ - Id: fmt.Sprintf("chatcmpl-%s", random.GetUUID()), + Id: xunfeiResponse.Header.Sid, Object: "chat.completion.chunk", Created: helper.GetTimestamp(), Model: "SparkDesk", Choices: []openai.ChatCompletionsStreamResponseChoice{choice}, + Usage: &xunfeiResponse.Payload.Usage.Text, } return &response }