Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
add get models
Browse files Browse the repository at this point in the history
  • Loading branch information
cubatic45 committed Mar 6, 2024
1 parent 7cb4494 commit b79cb55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cubatic45/copi

go 1.21.6
go 1.22.0

require (
github.com/mitchellh/go-homedir v1.1.0
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func main() {
fmt.Printf("copilotToken: %s\n", copilotToken)
fmt.Printf("copilotTokenURL: %s\n", copilotTokenURL)
Init()
http.HandleFunc("/", handleProxy)
http.ListenAndServe(":8081", nil)
mux := http.NewServeMux()
mux.HandleFunc("GET /v1/models", handleModel)
mux.HandleFunc("POST /v1/chat/completions", handleProxy)
http.ListenAndServe(":8081", mux)
}
7 changes: 7 additions & 0 deletions model.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "net/http"

func handleModel(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`{"object":"list","data":[{"id":"gpt-3.5-turbo","object":"model","created":1677610602,"owned_by":"openai"},{"id":"gpt-4","object":"model","created":1677610602,"owned_by":"openai"}]}`))
}

0 comments on commit b79cb55

Please sign in to comment.