fix: remove role in relay stream response

This commit is contained in:
Zhang Minghan 2024-02-18 21:08:44 +08:00
parent e14fb02fb9
commit 104b5d3aac
2 changed files with 13 additions and 5 deletions

View File

@ -165,8 +165,7 @@ func getStreamTranshipmentForm(id string, created int64, form RelayForm, data *g
Choices: []ChoiceDelta{
{
Index: 0,
Delta: globals.Message{
Role: globals.Assistant,
Delta: Message{
Content: data.Content,
ToolCalls: data.ToolCall,
FunctionCall: data.FunctionCall,

View File

@ -50,6 +50,15 @@ type Choice struct {
FinishReason string `json:"finish_reason"`
}
type StreamMessage struct {
Role *string `json:"role"`
Content string `json:"content"`
Name *string `json:"name,omitempty"`
FunctionCall *globals.FunctionCall `json:"function_call,omitempty"` // only `function` role
ToolCallId *string `json:"tool_call_id,omitempty"` // only `tool` role
ToolCalls *globals.ToolCalls `json:"tool_calls,omitempty"` // only `assistant` role
}
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
@ -67,9 +76,9 @@ type RelayResponse struct {
}
type ChoiceDelta struct {
Index int `json:"index"`
Delta globals.Message `json:"delta"`
FinishReason interface{} `json:"finish_reason"`
Index int `json:"index"`
Delta Message `json:"delta"`
FinishReason interface{} `json:"finish_reason"`
}
type RelayStreamResponse struct {