Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llm/anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"
)
Expand Down Expand Up @@ -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))
}

Expand Down
5 changes: 2 additions & 3 deletions llm/commom.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package llm
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions llm/gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"
)
Expand Down Expand Up @@ -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))
}

Expand Down
4 changes: 2 additions & 2 deletions llm/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"time"
Expand Down Expand Up @@ -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))
}

Expand Down