package cmd import ( "aiChat/internal/controller" "aiChat/utility" "context" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/os/gcmd" ) var ( Main = gcmd.Command{ Name: "aiChat", Usage: "main", Brief: "start http aiChat server", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { s := g.Server() s.Use(utility.MiddlewareHandlerResponse) s.Group("/aiChat", func(group *ghttp.RouterGroup) { group.ALL("/ws", controller.ChatWs) //websocket 聊天 group.ALL("/chatHistory", controller.ChatHistory) //历史记录 group.ALL("/evaluate", controller.Evaluate) group.Bind( // controller.ChatHistory, //历史记录 // controller.Evaluate, //评价 // controller.GuessQuestion, //猜你想问 controller.UsuallyProblem, //常见问题 ) }) s.Run() return nil }, } )