feat(ai-proxy): Adjust the streaming response structure to keep it consistent with the openai (#2391)

Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
This commit is contained in:
Xijun Dai
2025-06-12 16:25:35 +08:00
committed by GitHub
parent 86934b3203
commit fb8dd819e9
12 changed files with 180 additions and 178 deletions

View File

@@ -42,8 +42,7 @@ const (
requestIdHeader = "X-Amzn-Requestid" requestIdHeader = "X-Amzn-Requestid"
) )
type bedrockProviderInitializer struct { type bedrockProviderInitializer struct{}
}
func (b *bedrockProviderInitializer) ValidateConfig(config *ProviderConfig) error { func (b *bedrockProviderInitializer) ValidateConfig(config *ProviderConfig) error {
if len(config.awsAccessKey) == 0 || len(config.awsSecretKey) == 0 { if len(config.awsAccessKey) == 0 || len(config.awsSecretKey) == 0 {
@@ -104,7 +103,7 @@ func (b *bedrockProvider) convertEventFromBedrockToOpenAI(ctx wrapper.HttpContex
chatChoice.Delta = &chatMessage{Content: bedrockEvent.Delta.Text} chatChoice.Delta = &chatMessage{Content: bedrockEvent.Delta.Text}
} }
if bedrockEvent.StopReason != nil { if bedrockEvent.StopReason != nil {
chatChoice.FinishReason = stopReasonBedrock2OpenAI(*bedrockEvent.StopReason) chatChoice.FinishReason = util.Ptr(stopReasonBedrock2OpenAI(*bedrockEvent.StopReason))
} }
choices = append(choices, chatChoice) choices = append(choices, chatChoice)
requestId := ctx.GetStringContext(requestIdHeader, "") requestId := ctx.GetStringContext(requestIdHeader, "")
@@ -118,7 +117,7 @@ func (b *bedrockProvider) convertEventFromBedrockToOpenAI(ctx wrapper.HttpContex
} }
if bedrockEvent.Usage != nil { if bedrockEvent.Usage != nil {
openAIFormattedChunk.Choices = choices[:0] openAIFormattedChunk.Choices = choices[:0]
openAIFormattedChunk.Usage = usage{ openAIFormattedChunk.Usage = &usage{
CompletionTokens: bedrockEvent.Usage.OutputTokens, CompletionTokens: bedrockEvent.Usage.OutputTokens,
PromptTokens: bedrockEvent.Usage.InputTokens, PromptTokens: bedrockEvent.Usage.InputTokens,
TotalTokens: bedrockEvent.Usage.TotalTokens, TotalTokens: bedrockEvent.Usage.TotalTokens,
@@ -756,7 +755,7 @@ func (b *bedrockProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, b
Role: bedrockResponse.Output.Message.Role, Role: bedrockResponse.Output.Message.Role,
Content: outputContent, Content: outputContent,
}, },
FinishReason: stopReasonBedrock2OpenAI(bedrockResponse.StopReason), FinishReason: util.Ptr(stopReasonBedrock2OpenAI(bedrockResponse.StopReason)),
}, },
} }
requestId := ctx.GetStringContext(requestIdHeader, "") requestId := ctx.GetStringContext(requestIdHeader, "")
@@ -768,7 +767,7 @@ func (b *bedrockProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, b
SystemFingerprint: "", SystemFingerprint: "",
Object: objectChatCompletion, Object: objectChatCompletion,
Choices: choices, Choices: choices,
Usage: usage{ Usage: &usage{
PromptTokens: bedrockResponse.Usage.InputTokens, PromptTokens: bedrockResponse.Usage.InputTokens,
CompletionTokens: bedrockResponse.Usage.OutputTokens, CompletionTokens: bedrockResponse.Usage.OutputTokens,
TotalTokens: bedrockResponse.Usage.TotalTokens, TotalTokens: bedrockResponse.Usage.TotalTokens,

View File

@@ -341,7 +341,7 @@ func (c *claudeProvider) responseClaude2OpenAI(ctx wrapper.HttpContext, origResp
choice := chatCompletionChoice{ choice := chatCompletionChoice{
Index: 0, Index: 0,
Message: &chatMessage{Role: roleAssistant, Content: origResponse.Content[0].Text}, Message: &chatMessage{Role: roleAssistant, Content: origResponse.Content[0].Text},
FinishReason: stopReasonClaude2OpenAI(origResponse.StopReason), FinishReason: util.Ptr(stopReasonClaude2OpenAI(origResponse.StopReason)),
} }
return &chatCompletionResponse{ return &chatCompletionResponse{
@@ -351,7 +351,7 @@ func (c *claudeProvider) responseClaude2OpenAI(ctx wrapper.HttpContext, origResp
SystemFingerprint: "", SystemFingerprint: "",
Object: objectChatCompletion, Object: objectChatCompletion,
Choices: []chatCompletionChoice{choice}, Choices: []chatCompletionChoice{choice},
Usage: usage{ Usage: &usage{
PromptTokens: origResponse.Usage.InputTokens, PromptTokens: origResponse.Usage.InputTokens,
CompletionTokens: origResponse.Usage.OutputTokens, CompletionTokens: origResponse.Usage.OutputTokens,
TotalTokens: origResponse.Usage.InputTokens + origResponse.Usage.OutputTokens, TotalTokens: origResponse.Usage.InputTokens + origResponse.Usage.OutputTokens,
@@ -404,7 +404,7 @@ func (c *claudeProvider) streamResponseClaude2OpenAI(ctx wrapper.HttpContext, or
choice := chatCompletionChoice{ choice := chatCompletionChoice{
Index: origResponse.Index, Index: origResponse.Index,
Delta: &chatMessage{}, Delta: &chatMessage{},
FinishReason: stopReasonClaude2OpenAI(origResponse.Delta.StopReason), FinishReason: util.Ptr(stopReasonClaude2OpenAI(origResponse.Delta.StopReason)),
} }
return c.createChatCompletionResponse(ctx, origResponse, choice) return c.createChatCompletionResponse(ctx, origResponse, choice)
case "message_stop": case "message_stop":
@@ -415,7 +415,7 @@ func (c *claudeProvider) streamResponseClaude2OpenAI(ctx wrapper.HttpContext, or
Object: objectChatCompletionChunk, Object: objectChatCompletionChunk,
Choices: []chatCompletionChoice{}, Choices: []chatCompletionChoice{},
ServiceTier: c.serviceTier, ServiceTier: c.serviceTier,
Usage: usage{ Usage: &usage{
PromptTokens: c.usage.PromptTokens, PromptTokens: c.usage.PromptTokens,
CompletionTokens: c.usage.CompletionTokens, CompletionTokens: c.usage.CompletionTokens,
TotalTokens: c.usage.TotalTokens, TotalTokens: c.usage.TotalTokens,

View File

@@ -116,23 +116,23 @@ func (d *difyProvider) responseDify2OpenAI(ctx wrapper.HttpContext, response *Di
choice = chatCompletionChoice{ choice = chatCompletionChoice{
Index: 0, Index: 0,
Message: &chatMessage{Role: roleAssistant, Content: response.Answer}, Message: &chatMessage{Role: roleAssistant, Content: response.Answer},
FinishReason: finishReasonStop, FinishReason: util.Ptr(finishReasonStop),
} }
//response header中增加conversationId字段 // response header中增加conversationId字段
_ = proxywasm.ReplaceHttpResponseHeader("ConversationId", response.ConversationId) _ = proxywasm.ReplaceHttpResponseHeader("ConversationId", response.ConversationId)
id = response.ConversationId id = response.ConversationId
case BotTypeCompletion: case BotTypeCompletion:
choice = chatCompletionChoice{ choice = chatCompletionChoice{
Index: 0, Index: 0,
Message: &chatMessage{Role: roleAssistant, Content: response.Answer}, Message: &chatMessage{Role: roleAssistant, Content: response.Answer},
FinishReason: finishReasonStop, FinishReason: util.Ptr(finishReasonStop),
} }
id = response.MessageId id = response.MessageId
case BotTypeWorkflow: case BotTypeWorkflow:
choice = chatCompletionChoice{ choice = chatCompletionChoice{
Index: 0, Index: 0,
Message: &chatMessage{Role: roleAssistant, Content: response.Data.Outputs[d.config.outputVariable]}, Message: &chatMessage{Role: roleAssistant, Content: response.Data.Outputs[d.config.outputVariable]},
FinishReason: finishReasonStop, FinishReason: util.Ptr(finishReasonStop),
} }
id = response.Data.WorkflowId id = response.Data.WorkflowId
} }
@@ -143,7 +143,7 @@ func (d *difyProvider) responseDify2OpenAI(ctx wrapper.HttpContext, response *Di
SystemFingerprint: "", SystemFingerprint: "",
Object: objectChatCompletion, Object: objectChatCompletion,
Choices: []chatCompletionChoice{choice}, Choices: []chatCompletionChoice{choice},
Usage: response.MetaData.Usage, Usage: &response.MetaData.Usage,
} }
} }
@@ -188,7 +188,7 @@ func (d *difyProvider) OnStreamingResponseBody(ctx wrapper.HttpContext, name Api
func (d *difyProvider) streamResponseDify2OpenAI(ctx wrapper.HttpContext, response *DifyChunkChatResponse) *chatCompletionResponse { func (d *difyProvider) streamResponseDify2OpenAI(ctx wrapper.HttpContext, response *DifyChunkChatResponse) *chatCompletionResponse {
var choice chatCompletionChoice var choice chatCompletionChoice
var id string var id string
var responseUsage usage var responseUsage *usage
switch d.config.botType { switch d.config.botType {
case BotTypeChat, BotTypeAgent: case BotTypeChat, BotTypeAgent:
choice = chatCompletionChoice{ choice = chatCompletionChoice{
@@ -211,9 +211,9 @@ func (d *difyProvider) streamResponseDify2OpenAI(ctx wrapper.HttpContext, respon
id = response.Data.WorkflowId id = response.Data.WorkflowId
} }
if response.Event == "message_end" || response.Event == "workflow_finished" { if response.Event == "message_end" || response.Event == "workflow_finished" {
choice.FinishReason = finishReasonStop choice.FinishReason = util.Ptr(finishReasonStop)
if response.Event == "message_end" { if response.Event == "message_end" {
responseUsage = usage{ responseUsage = &usage{
PromptTokens: response.MetaData.Usage.PromptTokens, PromptTokens: response.MetaData.Usage.PromptTokens,
CompletionTokens: response.MetaData.Usage.CompletionTokens, CompletionTokens: response.MetaData.Usage.CompletionTokens,
TotalTokens: response.MetaData.Usage.TotalTokens, TotalTokens: response.MetaData.Usage.TotalTokens,

View File

@@ -500,7 +500,7 @@ func (g *geminiProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, re
Object: objectChatCompletion, Object: objectChatCompletion,
Created: time.Now().UnixMilli() / 1000, Created: time.Now().UnixMilli() / 1000,
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
Usage: usage{ Usage: &usage{
PromptTokens: response.UsageMetadata.PromptTokenCount, PromptTokens: response.UsageMetadata.PromptTokenCount,
CompletionTokens: response.UsageMetadata.CandidatesTokenCount, CompletionTokens: response.UsageMetadata.CandidatesTokenCount,
TotalTokens: response.UsageMetadata.TotalTokenCount, TotalTokens: response.UsageMetadata.TotalTokenCount,
@@ -514,7 +514,7 @@ func (g *geminiProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, re
Message: &chatMessage{ Message: &chatMessage{
Role: roleAssistant, Role: roleAssistant,
}, },
FinishReason: finishReasonStop, FinishReason: util.Ptr(finishReasonStop),
} }
if part.FunctionCall != nil { if part.FunctionCall != nil {
choice.Message.ToolCalls = g.buildToolCalls(&candidate) choice.Message.ToolCalls = g.buildToolCalls(&candidate)
@@ -524,7 +524,7 @@ func (g *geminiProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, re
choice.Message.Content = part.Text choice.Message.Content = part.Text
} }
choice.FinishReason = candidate.FinishReason choice.FinishReason = util.Ptr(candidate.FinishReason)
fullTextResponse.Choices = append(fullTextResponse.Choices, choice) fullTextResponse.Choices = append(fullTextResponse.Choices, choice)
choiceIndex += 1 choiceIndex += 1
} }
@@ -567,7 +567,7 @@ func (g *geminiProvider) buildChatCompletionStreamResponse(ctx wrapper.HttpConte
Created: time.Now().UnixMilli() / 1000, Created: time.Now().UnixMilli() / 1000,
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
Choices: []chatCompletionChoice{choice}, Choices: []chatCompletionChoice{choice},
Usage: usage{ Usage: &usage{
PromptTokens: geminiResp.UsageMetadata.PromptTokenCount, PromptTokens: geminiResp.UsageMetadata.PromptTokenCount,
CompletionTokens: geminiResp.UsageMetadata.CandidatesTokenCount, CompletionTokens: geminiResp.UsageMetadata.CandidatesTokenCount,
TotalTokens: geminiResp.UsageMetadata.TotalTokenCount, TotalTokens: geminiResp.UsageMetadata.TotalTokenCount,

View File

@@ -387,7 +387,7 @@ func (m *hunyuanProvider) convertChunkFromHunyuanToOpenAI(ctx wrapper.HttpContex
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
SystemFingerprint: "", SystemFingerprint: "",
Object: objectChatCompletionChunk, Object: objectChatCompletionChunk,
Usage: usage{ Usage: &usage{
PromptTokens: hunyuanFormattedChunk.Usage.PromptTokens, PromptTokens: hunyuanFormattedChunk.Usage.PromptTokens,
CompletionTokens: hunyuanFormattedChunk.Usage.CompletionTokens, CompletionTokens: hunyuanFormattedChunk.Usage.CompletionTokens,
TotalTokens: hunyuanFormattedChunk.Usage.TotalTokens, TotalTokens: hunyuanFormattedChunk.Usage.TotalTokens,
@@ -400,7 +400,7 @@ func (m *hunyuanProvider) convertChunkFromHunyuanToOpenAI(ctx wrapper.HttpContex
if hunyuanFormattedChunk.Choices[0].FinishReason == hunyuanStreamEndMark { if hunyuanFormattedChunk.Choices[0].FinishReason == hunyuanStreamEndMark {
// log.Debugf("@@@ --- 最后chunk: ") // log.Debugf("@@@ --- 最后chunk: ")
openAIFormattedChunk.Choices = append(openAIFormattedChunk.Choices, chatCompletionChoice{ openAIFormattedChunk.Choices = append(openAIFormattedChunk.Choices, chatCompletionChoice{
FinishReason: hunyuanFormattedChunk.Choices[0].FinishReason, FinishReason: util.Ptr(hunyuanFormattedChunk.Choices[0].FinishReason),
}) })
} else { } else {
deltaMsg := chatMessage{ deltaMsg := chatMessage{
@@ -495,7 +495,7 @@ func (m *hunyuanProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, h
Content: choice.Message.Content, Content: choice.Message.Content,
ToolCalls: nil, ToolCalls: nil,
}, },
FinishReason: choice.FinishReason, FinishReason: util.Ptr(choice.FinishReason),
}) })
} }
return &chatCompletionResponse{ return &chatCompletionResponse{
@@ -505,7 +505,7 @@ func (m *hunyuanProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, h
SystemFingerprint: "", SystemFingerprint: "",
Object: objectChatCompletion, Object: objectChatCompletion,
Choices: choices, Choices: choices,
Usage: usage{ Usage: &usage{
PromptTokens: hunyuanResponse.Response.Usage.PromptTokens, PromptTokens: hunyuanResponse.Response.Usage.PromptTokens,
CompletionTokens: hunyuanResponse.Response.Usage.CompletionTokens, CompletionTokens: hunyuanResponse.Response.Usage.CompletionTokens,
TotalTokens: hunyuanResponse.Response.Usage.TotalTokens, TotalTokens: hunyuanResponse.Response.Usage.TotalTokens,

View File

@@ -36,8 +36,7 @@ const (
defaultSenderName string = "小明" defaultSenderName string = "小明"
) )
type minimaxProviderInitializer struct { type minimaxProviderInitializer struct{}
}
func (m *minimaxProviderInitializer) ValidateConfig(config *ProviderConfig) error { func (m *minimaxProviderInitializer) ValidateConfig(config *ProviderConfig) error {
// If using the chat completion Pro API, a group ID must be set. // If using the chat completion Pro API, a group ID must be set.
@@ -368,7 +367,7 @@ func (m *minimaxProvider) responseProToOpenAI(response *minimaxChatCompletionPro
Content: message.Text, Content: message.Text,
} }
choices = append(choices, chatCompletionChoice{ choices = append(choices, chatCompletionChoice{
FinishReason: choice.FinishReason, FinishReason: util.Ptr(choice.FinishReason),
Index: messageIndex, Index: messageIndex,
Message: message, Message: message,
}) })
@@ -381,7 +380,7 @@ func (m *minimaxProvider) responseProToOpenAI(response *minimaxChatCompletionPro
Created: response.Created, Created: response.Created,
Model: response.Model, Model: response.Model,
Choices: choices, Choices: choices,
Usage: usage{ Usage: &usage{
TotalTokens: int(response.Usage.TotalTokens), TotalTokens: int(response.Usage.TotalTokens),
PromptTokens: int(response.Usage.PromptTokens), PromptTokens: int(response.Usage.PromptTokens),
CompletionTokens: int(response.Usage.CompletionTokens), CompletionTokens: int(response.Usage.CompletionTokens),

View File

@@ -138,15 +138,15 @@ type chatCompletionResponse struct {
ServiceTier string `json:"service_tier,omitempty"` ServiceTier string `json:"service_tier,omitempty"`
SystemFingerprint string `json:"system_fingerprint,omitempty"` SystemFingerprint string `json:"system_fingerprint,omitempty"`
Object string `json:"object,omitempty"` Object string `json:"object,omitempty"`
Usage usage `json:"usage,omitempty"` Usage *usage `json:"usage"`
} }
type chatCompletionChoice struct { type chatCompletionChoice struct {
Index int `json:"index"` Index int `json:"index"`
Message *chatMessage `json:"message,omitempty"` Message *chatMessage `json:"message,omitempty"`
Delta *chatMessage `json:"delta,omitempty"` Delta *chatMessage `json:"delta,omitempty"`
FinishReason string `json:"finish_reason,omitempty"` FinishReason *string `json:"finish_reason"`
Logprobs map[string]interface{} `json:"logprobs,omitempty"` Logprobs map[string]interface{} `json:"logprobs"`
} }
type usage struct { type usage struct {

View File

@@ -302,7 +302,7 @@ func (m *qwenProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, qwen
message := qwenMessageToChatMessage(qwenChoice.Message, m.config.reasoningContentMode) message := qwenMessageToChatMessage(qwenChoice.Message, m.config.reasoningContentMode)
choices = append(choices, chatCompletionChoice{ choices = append(choices, chatCompletionChoice{
Message: &message, Message: &message,
FinishReason: qwenChoice.FinishReason, FinishReason: util.Ptr(qwenChoice.FinishReason),
}) })
} }
return &chatCompletionResponse{ return &chatCompletionResponse{
@@ -312,7 +312,7 @@ func (m *qwenProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, qwen
SystemFingerprint: "", SystemFingerprint: "",
Object: objectChatCompletion, Object: objectChatCompletion,
Choices: choices, Choices: choices,
Usage: usage{ Usage: &usage{
PromptTokens: qwenResponse.Usage.InputTokens, PromptTokens: qwenResponse.Usage.InputTokens,
CompletionTokens: qwenResponse.Usage.OutputTokens, CompletionTokens: qwenResponse.Usage.OutputTokens,
TotalTokens: qwenResponse.Usage.TotalTokens, TotalTokens: qwenResponse.Usage.TotalTokens,
@@ -413,11 +413,11 @@ func (m *qwenProvider) buildChatCompletionStreamingResponse(ctx wrapper.HttpCont
if finished { if finished {
finishResponse := *&baseMessage finishResponse := *&baseMessage
finishResponse.Choices = append(finishResponse.Choices, chatCompletionChoice{Delta: &chatMessage{}, FinishReason: qwenChoice.FinishReason}) finishResponse.Choices = append(finishResponse.Choices, chatCompletionChoice{Delta: &chatMessage{}, FinishReason: util.Ptr(qwenChoice.FinishReason)})
usageResponse := *&baseMessage usageResponse := *&baseMessage
usageResponse.Choices = []chatCompletionChoice{{Delta: &chatMessage{}}} usageResponse.Choices = []chatCompletionChoice{{Delta: &chatMessage{}}}
usageResponse.Usage = usage{ usageResponse.Usage = &usage{
PromptTokens: qwenResponse.Usage.InputTokens, PromptTokens: qwenResponse.Usage.InputTokens,
CompletionTokens: qwenResponse.Usage.OutputTokens, CompletionTokens: qwenResponse.Usage.OutputTokens,
TotalTokens: qwenResponse.Usage.TotalTokens, TotalTokens: qwenResponse.Usage.TotalTokens,

View File

@@ -150,7 +150,7 @@ func (p *sparkProvider) responseSpark2OpenAI(ctx wrapper.HttpContext, response *
Object: objectChatCompletion, Object: objectChatCompletion,
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
Choices: choices, Choices: choices,
Usage: response.Usage, Usage: &response.Usage,
} }
} }
@@ -168,7 +168,7 @@ func (p *sparkProvider) streamResponseSpark2OpenAI(ctx wrapper.HttpContext, resp
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
Object: objectChatCompletion, Object: objectChatCompletion,
Choices: choices, Choices: choices,
Usage: response.Usage, Usage: &response.Usage,
} }
} }

View File

@@ -32,8 +32,7 @@ const (
vertexEmbeddingAction = "predict" vertexEmbeddingAction = "predict"
) )
type vertexProviderInitializer struct { type vertexProviderInitializer struct{}
}
func (v *vertexProviderInitializer) ValidateConfig(config *ProviderConfig) error { func (v *vertexProviderInitializer) ValidateConfig(config *ProviderConfig) error {
if config.vertexAuthKey == "" { if config.vertexAuthKey == "" {
@@ -245,7 +244,7 @@ func (v *vertexProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, re
Created: time.Now().UnixMilli() / 1000, Created: time.Now().UnixMilli() / 1000,
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
Choices: make([]chatCompletionChoice, 0, len(response.Candidates)), Choices: make([]chatCompletionChoice, 0, len(response.Candidates)),
Usage: usage{ Usage: &usage{
PromptTokens: response.UsageMetadata.PromptTokenCount, PromptTokens: response.UsageMetadata.PromptTokenCount,
CompletionTokens: response.UsageMetadata.CandidatesTokenCount, CompletionTokens: response.UsageMetadata.CandidatesTokenCount,
TotalTokens: response.UsageMetadata.TotalTokenCount, TotalTokens: response.UsageMetadata.TotalTokenCount,
@@ -257,7 +256,7 @@ func (v *vertexProvider) buildChatCompletionResponse(ctx wrapper.HttpContext, re
Message: &chatMessage{ Message: &chatMessage{
Role: roleAssistant, Role: roleAssistant,
}, },
FinishReason: candidate.FinishReason, FinishReason: util.Ptr(candidate.FinishReason),
} }
if len(candidate.Content.Parts) > 0 { if len(candidate.Content.Parts) > 0 {
choice.Message.Content = candidate.Content.Parts[0].Text choice.Message.Content = candidate.Content.Parts[0].Text
@@ -310,7 +309,7 @@ func (v *vertexProvider) buildChatCompletionStreamResponse(ctx wrapper.HttpConte
Created: time.Now().UnixMilli() / 1000, Created: time.Now().UnixMilli() / 1000,
Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""), Model: ctx.GetStringContext(ctxKeyFinalRequestModel, ""),
Choices: []chatCompletionChoice{choice}, Choices: []chatCompletionChoice{choice},
Usage: usage{ Usage: &usage{
PromptTokens: vertexResp.UsageMetadata.PromptTokenCount, PromptTokens: vertexResp.UsageMetadata.PromptTokenCount,
CompletionTokens: vertexResp.UsageMetadata.CandidatesTokenCount, CompletionTokens: vertexResp.UsageMetadata.CandidatesTokenCount,
TotalTokens: vertexResp.UsageMetadata.TotalTokenCount, TotalTokens: vertexResp.UsageMetadata.TotalTokenCount,

View File

@@ -0,0 +1,5 @@
package util
func Ptr[T any](v T) *T {
return &v
}

View File

@@ -55,7 +55,7 @@ var WasmPluginsAiProxy = suite.ConformanceTest{
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"360gpt-turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -77,19 +77,19 @@ var WasmPluginsAiProxy = suite.ConformanceTest{
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"360gpt-turbo","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -115,7 +115,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -137,19 +137,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"baichuan2-13b-chat-v1","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -175,7 +175,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -197,19 +197,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"ernie-3.5-8k","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -235,7 +235,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"deepseek-reasoner","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -257,19 +257,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"deepseek-reasoner","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -295,7 +295,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -317,19 +317,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"fake_doubao_endpoint","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -355,7 +355,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -377,19 +377,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"cohere-command-r-08-2024","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -415,7 +415,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"llama3-8b-8192","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -437,19 +437,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"llama3-8b-8192","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -475,7 +475,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -497,19 +497,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -535,7 +535,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -557,21 +557,21 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} Body: []byte(`data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你"},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"好"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"好"},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":""}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":""},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你"},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"是"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"是"},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"谁"}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"谁"},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":""}}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}} data: {"choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":""},"finish_reason":"","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{}}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"name":"MM智能助理","role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"abab6.5s-chat","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}
`), `),
}, },
@@ -595,7 +595,7 @@ data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"name":"MM智
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"mistral-tiny","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -617,19 +617,19 @@ data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"name":"MM智
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"mistral-tiny","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -655,7 +655,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"qwen-turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -677,19 +677,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"qwen-turbo","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -717,7 +717,7 @@ data: [DONE]
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
// Since the "created" field is generated by the ai-proxy plugin based on the current timestamp, it is ignored during comparison // Since the "created" field is generated by the ai-proxy plugin based on the current timestamp, it is ignored during comparison
JsonBodyIgnoreFields: []string{"created"}, JsonBodyIgnoreFields: []string{"created"},
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":1738218357,"model":"qwen-turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":1738218357,"model":"qwen-turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -739,7 +739,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"step-1-8k","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -761,19 +761,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"step-1-8k","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -799,7 +799,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -821,19 +821,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"meta-llama/Meta-Llama-3-8B-Instruct-Turbo","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -859,7 +859,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"Yi-Medium","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -881,19 +881,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"Yi-Medium","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -919,7 +919,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop"}],"created":10,"model":"glm-4-plus","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"你好,你是谁?"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -941,19 +941,19 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":null,"logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"是"},"finish_reason":null,"logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":"谁"},"finish_reason":null,"logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""}}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop","logprobs":null}],"created":10,"model":"glm-4-plus","object":"chat.completion.chunk","usage":null}
data: [DONE] data: [DONE]
@@ -979,7 +979,7 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeApplicationJson, ContentType: http.ContentTypeApplicationJson,
Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"USER: \n你好\n"},"finish_reason":"stop"}],"created":10,"model":"dify","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`), Body: []byte(`{"id":"chatcmpl-llm-mock","choices":[{"index":0,"message":{"role":"assistant","content":"USER: \n你好\n"},"finish_reason":"stop","logprobs":null}],"created":10,"model":"dify","object":"chat.completion","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}`),
}, },
}, },
}, },
@@ -1001,27 +1001,27 @@ data: [DONE]
ExpectedResponse: http.Response{ ExpectedResponse: http.Response{
StatusCode: 200, StatusCode: 200,
ContentType: http.ContentTypeTextEventStream, ContentType: http.ContentTypeTextEventStream,
Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"U"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} Body: []byte(`data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"U"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"S"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"S"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"E"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"E"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"R"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"R"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"你"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"你"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"好"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"好"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":{}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"logprobs":null}],"created":10,"model":"dify","object":"chat.completion.chunk","usage":null}
data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"USER: \n你好\n"},"finish_reason":"stop"}],"model":"dify","object":"chat.completion.chunk","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}} data: {"id":"chatcmpl-llm-mock","choices":[{"index":0,"delta":{"role":"assistant","content":"USER: \n你好\n"},"finish_reason":"stop","logprobs":null}],"model":"dify","object":"chat.completion.chunk","usage":{"prompt_tokens":9,"completion_tokens":1,"total_tokens":10}}
`), `),
}, },