Commit 18ed3795 by CalciumIon

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.
parent 464220cd
...@@ -104,7 +104,7 @@ func (m Message) ParseToolCalls() []ToolCall { ...@@ -104,7 +104,7 @@ func (m Message) ParseToolCalls() []ToolCall {
return toolCalls return toolCalls
} }
func (m Message) SetToolCalls(toolCalls any) { func (m *Message) SetToolCalls(toolCalls any) {
toolCallsJson, _ := json.Marshal(toolCalls) toolCallsJson, _ := json.Marshal(toolCalls)
m.ToolCalls = toolCallsJson m.ToolCalls = toolCallsJson
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment