From 79f587db91c71ca6cb8a89f6f1d7d7662d1ea1df Mon Sep 17 00:00:00 2001 From: skeris Date: Sat, 5 Jul 2025 20:26:55 +0300 Subject: [PATCH] -- --- app/app.go | 2 +- clients/aiClient.go | 15 ++++++--------- service/service.go | 3 +++ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/app.go b/app/app.go index e8f0178..fbeed1c 100644 --- a/app/app.go +++ b/app/app.go @@ -154,7 +154,7 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co WorkerRespondentCh: workerRespondentCh, Encrypt: encrypt, RedirectURl: options.RedirectURL, - AiClient: clients.NewAiClient("https://alvatar.com/api/engine/send_answer/"), + AiClient: clients.NewAiClient("https://alvatar.com/api/engine/send_answer"), }) saveRespWcData := savewc.DepsForResp{ diff --git a/clients/aiClient.go b/clients/aiClient.go index d93e527..0e5d130 100644 --- a/clients/aiClient.go +++ b/clients/aiClient.go @@ -15,7 +15,7 @@ type AIClient struct { type SendAnswerRequest struct { Tipe string `json:"type"` Message string `json:"message"` - Final bool `json:"final"` + Final bool `json:"is_final"` Session string `json:"session"` } @@ -34,13 +34,10 @@ func (client *AIClient) SendAnswerer(final bool, tipe, message, session string) // Session: session, //} - clownRequest := struct { - Title string `json:"title"` - Text string `json:"text"` - Final bool `json:"is_final"` - Session string `json:"string"` - }{ - Text: message, + clownRequest := SendAnswerRequest{ + Message: message, + Tipe: "text", + Final: false, Session: session, } @@ -57,7 +54,7 @@ func (client *AIClient) SendAnswerer(final bool, tipe, message, session string) return "", errors.Join(errs...) } - if statusCode != fiber.StatusCreated { + if statusCode != fiber.StatusOK { return "", fmt.Errorf("invalid response status code: %d", statusCode) } diff --git a/service/service.go b/service/service.go index 5fd439f..218234d 100644 --- a/service/service.go +++ b/service/service.go @@ -178,6 +178,9 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error { var cnt uint64 if quiz.Status == model.StatusAI { + if req.Page >= 1 { + req.Page+=1 + } questions, cnt, err = s.dal.QuestionRepo.GetQuestionsAI(c.Context(), int64(quiz.Id), cs, int32(req.Limit), int32(req.Page*req.Limit), req.Auditory) if err != nil { return c.Status(fiber.StatusInternalServerError).SendString(err.Error())