diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 9eba100..23de309 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -734,11 +734,14 @@ }, { "description": "代码文件信息", - "name": "codeFiles", + "name": "fileMetas", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CodeFiles" + "type": "array", + "items": { + "$ref": "#/definitions/domain.FileMeta" + } } } ], @@ -3340,6 +3343,30 @@ } } }, + "/v1/health": { + "get": { + "description": "固定回包 `{\"code\": 0, \"data\": \"MonkeyCode\"}`", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "OpenAIV1" + ], + "summary": "健康检查", + "operationId": "health", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/web.Resp" + } + } + } + } + }, "/v1/models": { "get": { "description": "模型列表", @@ -3840,17 +3867,6 @@ } } }, - "domain.CodeFiles": { - "type": "object", - "properties": { - "files": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.FileMeta" - } - } - } - }, "domain.CodeLanguageType": { "type": "string", "enum": [ diff --git a/backend/internal/openai/handler/v1/v1.go b/backend/internal/openai/handler/v1/v1.go index 155c444..5bcecbb 100644 --- a/backend/internal/openai/handler/v1/v1.go +++ b/backend/internal/openai/handler/v1/v1.go @@ -49,6 +49,7 @@ func NewV1Handler( w.GET("/api/config", web.BindHandler(h.GetConfig), middleware.Auth()) w.GET("/v1/version", web.BaseHandler(h.Version), middleware.Auth()) + w.GET("/v1/health", web.BaseHandler(h.HealthCheck)) g := w.Group("/v1", middleware.Auth()) g.GET("/models", web.BaseHandler(h.ModelList)) @@ -201,3 +202,17 @@ func (h *V1Handler) GetConfig(c *web.Context, req domain.ConfigReq) error { } return c.JSON(http.StatusOK, resp) } + +// HealthCheck 健康检查 +// +// @Tags OpenAIV1 +// @Summary 健康检查 +// @Description 固定回包 `{"code": 0, "data": "MonkeyCode"}` +// @ID health +// @Accept json +// @Produce json +// @Success 200 {object} web.Resp{} +// @Router /v1/health [get] +func (h *V1Handler) HealthCheck(c *web.Context) error { + return c.Success("MonkeyCode") +} diff --git a/backend/pkg/cli/cli.go b/backend/pkg/cli/cli.go index 7648dd8..9eade42 100644 --- a/backend/pkg/cli/cli.go +++ b/backend/pkg/cli/cli.go @@ -18,9 +18,9 @@ const scriptPath = "./tools/dist/cli.cjs" // @Description 运行monkeycode-cli命令 // @Accept json // @Produce json -// @Param command index string true "命令" +// @Param command path string true "命令" // @Param flag query string false "标志" -// @Param fileMetas body domain.[]FileMeta true "代码文件信息" +// @Param fileMetas body []domain.FileMeta true "代码文件信息" // @Success 200 {object} []domain.IndexResult "输出结果" // @Failure 500 {object} web.Resp "内部错误" // @Router /api/v1/cli/{command} [post]