Skip to content

Commit 2cf63a9

Browse files
authored
Fix compilation error with ChatCompletionMessage (#6)
1 parent e9196ce commit 2cf63a9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

chat.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ type ChatCompletionMessage struct {
121121
ToolCallID string `json:"tool_call_id,omitempty"`
122122

123123
// Messari custom fields
124-
Prefix bool `json:"prefix"`
124+
Prefix bool `json:"prefix,omitempty"`
125125
}
126126

127127
func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
@@ -139,6 +139,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
139139
FunctionCall *FunctionCall `json:"function_call,omitempty"`
140140
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
141141
ToolCallID string `json:"tool_call_id,omitempty"`
142+
Prefix bool `json:"prefix,omitempty"`
142143
}(m)
143144
return json.Marshal(msg)
144145
}
@@ -153,6 +154,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
153154
FunctionCall *FunctionCall `json:"function_call,omitempty"`
154155
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
155156
ToolCallID string `json:"tool_call_id,omitempty"`
157+
Prefix bool `json:"prefix,omitempty"`
156158
}(m)
157159
return json.Marshal(msg)
158160
}
@@ -168,6 +170,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
168170
FunctionCall *FunctionCall `json:"function_call,omitempty"`
169171
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
170172
ToolCallID string `json:"tool_call_id,omitempty"`
173+
Prefix bool `json:"prefix,omitempty"`
171174
}{}
172175

173176
if err := json.Unmarshal(bs, &msg); err == nil {
@@ -184,6 +187,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
184187
FunctionCall *FunctionCall `json:"function_call,omitempty"`
185188
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
186189
ToolCallID string `json:"tool_call_id,omitempty"`
190+
Prefix bool `json:"prefix,omitempty"`
187191
}{}
188192
if err := json.Unmarshal(bs, &multiMsg); err != nil {
189193
return err

messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type Message struct {
2626
httpHeader
2727

2828
// Messari custom fields
29-
Prefix bool `json:"prefix"`
29+
Prefix bool `json:"prefix,omitempty"`
3030
}
3131

3232
type MessagesList struct {

0 commit comments

Comments
 (0)