From 87a5e40daf144b9bd10d800eb69736ac5ac98acd Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Sun, 22 Dec 2024 16:22:55 +0800 Subject: [PATCH] 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. --- dto/openai_request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dto/openai_request.go b/dto/openai_request.go index 752311c7..95f88812 100644 --- a/dto/openai_request.go +++ b/dto/openai_request.go @@ -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 }