소스 검색

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.
CalciumIon 1 년 전
부모
커밋
87a5e40daf
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      dto/openai_request.go

+ 1 - 1
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
 }