big_model.go 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package apis
  2. import (
  3. "go-admin/app/observe/service"
  4. "go-admin/app/observe/service/dto"
  5. "go-admin/utils"
  6. "net/http"
  7. "github.com/gin-gonic/gin"
  8. )
  9. type BigModel struct {
  10. utils.OtApi
  11. }
  12. // List 获取Biz列表
  13. func (e BigModel) List(c *gin.Context) {
  14. req := dto.BizListReq{}
  15. svc := service.Biz{}
  16. if err := e.Init(c, &req, &svc.OtService); err != nil {
  17. return
  18. }
  19. resp := make([]dto.BizListResp, 0)
  20. var count int64
  21. if err := svc.List(&req, &resp, &count); err != nil {
  22. e.Error(http.StatusInternalServerError, err, err.Error())
  23. return
  24. }
  25. e.PageOK(resp, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
  26. }
  27. func (e BigModel) AiAnswerMe(c *gin.Context) {
  28. req := dto.AskAiModel{}
  29. bm := service.BigModel{}
  30. if err := e.Init(c, &req, &bm.OtService); err != nil {
  31. return
  32. }
  33. resp := new(dto.BigModelResp)
  34. if err := bm.RequestAiPlatform(&req, resp); err != nil {
  35. e.Error(http.StatusInternalServerError, err, err.Error())
  36. return
  37. }
  38. e.OK(resp, "查询完成")
  39. }