Skip to content

Commit

Permalink
chore: fix codeql warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brennan2005 committed Feb 12, 2024
1 parent ad82b6b commit 28831ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions backend/src/embeddings/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ func CreateEmbeddingVector(infoForEmbedding string) ([]float32, *errors.Error) {
requestInfoBody := bytes.NewBuffer(InfoBody)

req, err := http.NewRequest("POST", fmt.Sprintf("https://api.openai.com/v1/embeddings"), requestInfoBody)
if err != nil {
return nil, &errors.FailedToVectorizeClub
}

req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
req.Header.Set("content-type", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, &errors.FailedToVectorizeClub
}

defer resp.Body.Close()

if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions backend/src/embeddings/pinecone.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ func SearchPinecone(item types.Embeddable, topKResults int) ([]string, *errors.E
req.Header.Set("content-type", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
return []string{}, &errors.FailedToSearchPinecone
}

defer resp.Body.Close()

if err != nil {
Expand Down
1 change: 1 addition & 0 deletions backend/src/errors/club.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var (
FailedToVectorizeClub = Error{
StatusCode: fiber.StatusInternalServerError,
Message: "failed to vectorize club",
}
FailedToGetClubFollowers = Error{
StatusCode: fiber.StatusInternalServerError,
Message: "failed to get club followers",
Expand Down
3 changes: 2 additions & 1 deletion go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down Expand Up @@ -180,5 +179,7 @@ gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo=
gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0=
gorm.io/gorm v1.25.6 h1:V92+vVda1wEISSOMtodHVRcUIOPYa2tgQtyF+DfFx+A=
gorm.io/gorm v1.25.6/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
lukechampine.com/frand v1.4.2 h1:RzFIpOvkMXuPMBb9maa4ND4wjBn71E1Jpf8BzJHMaVw=
lukechampine.com/frand v1.4.2/go.mod h1:4S/TM2ZgrKejMcKMbeLjISpJMO+/eZ1zu3vYX9dtj3s=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

0 comments on commit 28831ef

Please sign in to comment.