diff --git a/llm/anthropic.go b/llm/anthropic.go index 568b075..a3ab799 100644 --- a/llm/anthropic.go +++ b/llm/anthropic.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "time" ) @@ -179,7 +179,7 @@ func (c *AnthropicClient) Generate( defer resp.Body.Close() if resp.StatusCode >= 400 { - b, _ := ioutil.ReadAll(resp.Body) + b, _ := io.ReadAll(resp.Body) return nil, fmt.Errorf("Anthropic Error %d: %s", resp.StatusCode, string(b)) } diff --git a/llm/commom.go b/llm/commom.go index b50c64a..8026a8f 100644 --- a/llm/commom.go +++ b/llm/commom.go @@ -3,7 +3,6 @@ package llm import ( "encoding/json" "fmt" - "io/ioutil" "math/rand" "os" "path/filepath" @@ -270,11 +269,11 @@ func (h *MessageHistory) SaveToFile(filename string) error { if err := os.MkdirAll(dir, 0755); err != nil { return err } - return ioutil.WriteFile(filename, data, 0644) + return os.WriteFile(filename, data, 0644) } func (h *MessageHistory) LoadFromFile(filename string) error { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return err } diff --git a/llm/gemini.go b/llm/gemini.go index 86fba24..ef66529 100644 --- a/llm/gemini.go +++ b/llm/gemini.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "time" ) @@ -152,7 +152,7 @@ func (c *GeminiClient) Generate( defer resp.Body.Close() if resp.StatusCode >= 400 { - b, _ := ioutil.ReadAll(resp.Body) + b, _ := io.ReadAll(resp.Body) return nil, fmt.Errorf("Gemini Error %d: %s", resp.StatusCode, string(b)) } diff --git a/llm/openai.go b/llm/openai.go index f113a16..17b1771 100644 --- a/llm/openai.go +++ b/llm/openai.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" "time" @@ -240,7 +240,7 @@ func (c *OpenAIClient) Generate( defer resp.Body.Close() if resp.StatusCode >= 400 { - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) return nil, fmt.Errorf("OpenAI API error: %d - %s", resp.StatusCode, string(body)) }