route.go 734 B

1234567891011121314151617181920212223242526272829
  1. package mcp_ai
  2. import (
  3. "dbview/service/internal/modules/mcp_ai/handler"
  4. svc "dbview/service/internal/modules/mcp_ai/service"
  5. "github.com/gin-gonic/gin"
  6. )
  7. // RegisterRoutes 注册 AI 聊天相关路由。
  8. func RegisterRoutes(r *gin.Engine, svcObj *svc.AIService) {
  9. if svcObj == nil {
  10. return
  11. }
  12. h := handler.NewHandler(svcObj)
  13. grp := r.Group("/ai")
  14. {
  15. grp.POST("/chat", h.Chat)
  16. grp.POST("/chat/cancel", h.CancelChat)
  17. grp.POST("/history", h.History)
  18. grp.POST("/history/delete", h.DeleteHistory)
  19. grp.POST("/config/get", h.GetConfig)
  20. grp.POST("/config/list", h.ListConfigs)
  21. grp.POST("/config/create", h.CreateConfig)
  22. grp.POST("/config/update", h.UpdateConfig)
  23. grp.POST("/config/delete", h.DeleteConfig)
  24. }
  25. }