From 292c620abe5b0efc9a2990a6fbe137bc4d874549 Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Sun, 14 Jan 2024 13:51:30 +0200 Subject: [PATCH] #44 Updated swag CLI to fix differences in generated specs --- docs/docs.go | 8 +++--- docs/swagger.json | 8 +++--- docs/swagger.yaml | 4 +-- main.go | 20 +++++++------- pkg/api/http/handlers.go | 56 ++++++++++++++++++++-------------------- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index d694af45..c4153a82 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -318,12 +318,12 @@ const docTemplate = `{ "routing.Strategy": { "type": "string", "enum": [ - "priority", - "round-robin" + "round-robin", + "priority" ], "x-enum-varnames": [ - "Priority", - "RoundRobin" + "RoundRobin", + "Priority" ] }, "schemas.ChatMessage": { diff --git a/docs/swagger.json b/docs/swagger.json index fed6ae86..d5a365d2 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -315,12 +315,12 @@ "routing.Strategy": { "type": "string", "enum": [ - "priority", - "round-robin" + "round-robin", + "priority" ], "x-enum-varnames": [ - "Priority", - "RoundRobin" + "RoundRobin", + "Priority" ] }, "schemas.ChatMessage": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 9aed5ea5..aed56a2b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -126,12 +126,12 @@ definitions: type: object routing.Strategy: enum: - - priority - round-robin + - priority type: string x-enum-varnames: - - Priority - RoundRobin + - Priority schemas.ChatMessage: properties: content: diff --git a/main.go b/main.go index c6d11005..fd201e09 100644 --- a/main.go +++ b/main.go @@ -6,19 +6,19 @@ import ( "glide/pkg/cmd" ) -// @title Glide Gateway -// @version 1.0 -// @description API documentation for Glide, an open-source lightweight high-performance model gateway +// @title Glide Gateway +// @version 1.0 +// @description API documentation for Glide, an open-source lightweight high-performance model gateway -// @contact.name Glide Community -// @contact.url https://github.com/modelgateway/glide +// @contact.name Glide Community +// @contact.url https://github.com/modelgateway/glide -// @license.name Apache 2.0 -// @license.url https://github.com/modelgateway/glide/blob/develop/LICENSE +// @license.name Apache 2.0 +// @license.url https://github.com/modelgateway/glide/blob/develop/LICENSE -// @host localhost:9099 -// @BasePath / -// @schemes http +// @host localhost:9099 +// @BasePath / +// @schemes http func main() { cli := cmd.NewCLI() diff --git a/pkg/api/http/handlers.go b/pkg/api/http/handlers.go index 51a4e05d..2fff587d 100644 --- a/pkg/api/http/handlers.go +++ b/pkg/api/http/handlers.go @@ -16,18 +16,18 @@ type Handler = func(ctx context.Context, c *app.RequestContext) // - https://github.com/swaggo/swag/tree/master/example/celler // LangChatHandler -// @id glide-language-chat -// @Summary Language Chat -// @Description Talk to different LLMs Chat API via unified endpoint -// @tags Language -// @Param router path string true "Router ID" -// @Param payload body schemas.UnifiedChatRequest true "Request Data" -// @Accept json -// @Produce json -// @Success 200 {object} schemas.UnifiedChatResponse -// @Failure 400 {object} http.ErrorSchema -// @Failure 404 {object} http.ErrorSchema -// @Router /v1/language/{router}/chat [POST] +// @id glide-language-chat +// @Summary Language Chat +// @Description Talk to different LLMs Chat API via unified endpoint +// @tags Language +// @Param router path string true "Router ID" +// @Param payload body schemas.UnifiedChatRequest true "Request Data" +// @Accept json +// @Produce json +// @Success 200 {object} schemas.UnifiedChatResponse +// @Failure 400 {object} http.ErrorSchema +// @Failure 404 {object} http.ErrorSchema +// @Router /v1/language/{router}/chat [POST] func LangChatHandler(routerManager *routers.RouterManager) Handler { return func(ctx context.Context, c *app.RequestContext) { var req *schemas.UnifiedChatRequest @@ -67,14 +67,14 @@ func LangChatHandler(routerManager *routers.RouterManager) Handler { } // LangRoutersHandler -// @id glide-language-routers -// @Summary Language Router List -// @Description Retrieve list of configured language routers and their configurations -// @tags Language -// @Accept json -// @Produce json -// @Success 200 {object} http.RouterListSchema -// @Router /v1/language/ [GET] +// @id glide-language-routers +// @Summary Language Router List +// @Description Retrieve list of configured language routers and their configurations +// @tags Language +// @Accept json +// @Produce json +// @Success 200 {object} http.RouterListSchema +// @Router /v1/language/ [GET] func LangRoutersHandler(routerManager *routers.RouterManager) Handler { return func(ctx context.Context, c *app.RequestContext) { configuredRouters := routerManager.GetLangRouters() @@ -89,14 +89,14 @@ func LangRoutersHandler(routerManager *routers.RouterManager) Handler { } // HealthHandler -// @id glide-health -// @Summary Gateway Health -// @Description -// @tags Operations -// @Accept json -// @Produce json -// @Success 200 {object} http.HealthSchema -// @Router /v1/health/ [get] +// @id glide-health +// @Summary Gateway Health +// @Description +// @tags Operations +// @Accept json +// @Produce json +// @Success 200 {object} http.HealthSchema +// @Router /v1/health/ [get] func HealthHandler(_ context.Context, c *app.RequestContext) { c.JSON(consts.StatusOK, HealthSchema{Healthy: true}) }