refactor: Update SetToolCalls method to use pointer receiver

- Changed the SetToolCalls method to use a pointer receiver for the Message struct, allowing for modifications to the original instance.
- This change improves the method's efficiency and aligns with Go best practices for mutating struct methods.
This commit is contained in:
CalciumIon
2024-12-22 16:22:55 +08:00
parent 0c326556aa
commit 87a5e40daf

View File

@@ -104,7 +104,7 @@ func (m Message) ParseToolCalls() []ToolCall {
return toolCalls
}
func (m Message) SetToolCalls(toolCalls any) {
func (m *Message) SetToolCalls(toolCalls any) {
toolCallsJson, _ := json.Marshal(toolCalls)
m.ToolCalls = toolCallsJson
}