Skip to content

Commit

Permalink
go mod tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks committed Oct 28, 2024
1 parent 163d429 commit 1b99ae8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go/ai-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/pluralsh/console/go/ai-proxy
go 1.22.8

require (
github.com/andybalholm/brotli v1.1.1
github.com/gorilla/mux v1.8.1
github.com/ollama/ollama v0.3.14
github.com/pluralsh/polly v0.1.10
Expand All @@ -12,7 +13,6 @@ require (
)

require (
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/bytedance/sonic v1.12.3 // indirect
github.com/bytedance/sonic/loader v0.2.1 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
Expand Down
1 change: 1 addition & 0 deletions go/ai-proxy/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
golang.org/x/arch v0.11.0 h1:KXV8WWKCXm6tRpLirl2szsO5j/oOODwZf4hATmGVNs4=
golang.org/x/arch v0.11.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
Expand Down
43 changes: 38 additions & 5 deletions go/ai-proxy/test/main_test.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,56 @@
package router_test

import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"testing"

"github.com/spf13/pflag"
)

func init() {
pflag.Set("provider-host", "localhost")
}

var (
server *httptest.Server
)

func createRequest[T any](method string, url string, body T) (*http.Request, error) {
bodyBytes, err := json.Marshal(body)
if err != nil {
return nil, err
}

return http.NewRequest(method, url, io.NopCloser(bytes.NewReader(bodyBytes)))
}

func TestOpenAIProxy(t *testing.T) {
//applicationHandler := router.NewRouter()
//server = httptest.NewServer(applicationHandler)
//defer server.Close()
//
//ts := httptest.NewServer(applicationHandler)
//defer ts.Close()
//
//res, err := http.Get(ts.URL)
//req, err := createRequest("POST", fmt.Sprintf("%s/api/chat", server.URL), ollamaapi.ChatRequest{
// Model: "testmodel",
// Messages: []ollamaapi.Message{{
// Role: "user",
// Content: "test prompt",
// }},
//})
//if err != nil {
// t.Fatalf("%s", err)
//}
//
//res, err := server.Client().Do(req)
//if err != nil {
// t.Fatalf("%s", err)
//}
//
//defer res.Body.Close()
//greeting, err := ioutil.ReadAll(res.Body)
//greeting, err := io.ReadAll(res.Body)
//
//if err != nil {
// log.Fatalf("%s", err)
Expand Down

0 comments on commit 1b99ae8

Please sign in to comment.