From 519128e8bd08ba408eeb1c107f8704f90f91d397 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 19 Dec 2023 20:40:14 -0700 Subject: [PATCH] #29: gofumpt --- pkg/providers/openai/chat.go | 2 -- pkg/providers/openai/openaiclient.go | 12 ++++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/pkg/providers/openai/chat.go b/pkg/providers/openai/chat.go index bf0cac93..58b9088c 100644 --- a/pkg/providers/openai/chat.go +++ b/pkg/providers/openai/chat.go @@ -69,7 +69,6 @@ type ChatUsage struct { } func (c *Client) CreateChatRequest(message []byte) *ChatRequest { - err := json.Unmarshal(message, &requestBody) if err != nil { slog.Error("Error:", err) @@ -181,7 +180,6 @@ func (c *Client) CreateChatResponse(ctx context.Context, r *ChatRequest) (*ChatR } func (c *Client) createChatHertz(ctx context.Context, payload *ChatRequest) (*ChatResponse, error) { - slog.Info("running createChat") if payload.StreamingFunc != nil { diff --git a/pkg/providers/openai/openaiclient.go b/pkg/providers/openai/openaiclient.go index 4688325c..7ef403eb 100644 --- a/pkg/providers/openai/openaiclient.go +++ b/pkg/providers/openai/openaiclient.go @@ -1,4 +1,4 @@ -//TODO: Explore resource pooling +// TODO: Explore resource pooling // TODO: Optimize Type use // TODO: Explore Hertz TLS & resource pooling @@ -8,10 +8,11 @@ import ( "context" "errors" "fmt" - "gopkg.in/yaml.v2" "log/slog" "os" + "gopkg.in/yaml.v2" + "glide/pkg/providers" "github.com/cloudwego/hertz/pkg/app/client" @@ -55,7 +56,6 @@ type Client struct { } func (c *Client) Run(poolName string, modelName string, payload []byte) (*ChatResponse, error) { - c, err := c.NewClient(poolName, modelName) if err != nil { slog.Error("Error:" + err.Error()) @@ -84,11 +84,10 @@ func (c *Client) NewClient(poolName string, modelName string) (*Client, error) { // modelName is determined by the model pool // poolName is determined by the route the request came from - var providerName = "openai" + providerName := "openai" // Read the YAML file data, err := os.ReadFile("/Users/max/code/Glide/config.yaml") - if err != nil { slog.Error("Failed to read file: %v", err) return nil, err @@ -144,15 +143,12 @@ func (c *Client) NewClient(poolName string, modelName string) (*Client, error) { } return client, nil - } func HttpClient() *client.Client { - c, err := client.NewClient() if err != nil { slog.Error(err.Error()) } return c - }