Skip to content

Commit

Permalink
feat: add index handler
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu327 committed Dec 18, 2023
1 parent bdea541 commit bbd1a08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import (
"github.com/zhu327/gemini-openai-proxy/pkg/util"
)

func IndexHandler(c *gin.Context) {
c.JSON(http.StatusMisdirectedRequest, gin.H{
"message": "Welcome to the OpenAI API! Documentation is available at https://platform.openai.com/docs/api-reference",
})
}

func ModelListHandler(c *gin.Context) {
model := openai.Model{
CreatedAt: 1686935002,
Expand Down
1 change: 1 addition & 0 deletions api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func Register(router *gin.Engine) {
router.Use(cors.New(config))

// Define a route and its handler
router.GET("/", IndexHandler)
// openai model
router.GET("/v1/models", ModelListHandler)
router.GET("/v1/models/gpt-3.5-turbo", ModelRetrieveHandler)
Expand Down

0 comments on commit bbd1a08

Please sign in to comment.