35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package system
|
|
|
|
import (
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Create
|
|
// @Tags mcp
|
|
// @Summary 自动McpTool
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.AutoMcpTool true "创建自动代码"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
|
// @Router /autoCode/mcp [post]
|
|
func (a *AutoCodeTemplateApi) MCP(c *gin.Context) {
|
|
var info request.AutoMcpTool
|
|
err := c.ShouldBindJSON(&info)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
|
|
toolFilePath, err := autoCodeTemplateService.CreateMcp(c.Request.Context(), info)
|
|
if err != nil {
|
|
response.FailWithMessage("创建失败", c)
|
|
global.GVA_LOG.Error(err.Error())
|
|
return
|
|
}
|
|
response.OkWithMessage("创建成功,MCP Tool路径:"+toolFilePath, c)
|
|
}
|