[Bug] Handle Gemini error responses safely in /quick ai

Đang mở
#82 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

@CodeMatrix1 đang làm issue này rồi.

Từ ngày 30/3/2026.

  • #81 của @CodeMatrix1 — đã đóng, không merge
  • #83 của @CodeMatrix1 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Bắt đầu từ điểm vào /quick ai và theo dõi việc xử lý phản hồi Gemini xung quanh response.data.candidates[0].content.parts[0].text. Tái hiện một phản hồi do quá tải hoặc tạm thời không khả dụng, sau đó xác minh rằng các thông báo rõ ràng từ nhà cung cấp được hiển thị và các phản hồi không mong đợi được ghi log thay vì gây ra lỗi chung.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
What happened?

Description

When /quick ai is used with Gemini and the provider returns an error payload instead of generated candidate text, the AI flow fails.

The current implementation assumes the Gemini response always contains text at:

response.data.candidates[0].content.parts[0].text

In practice, Gemini can return an error object instead of candidates, for example when the model is overloaded or temporarily unavailable. In those cases, /quick ai does not handle the response shape safely.

Expected behavior

  • /quick ai should safely handle Gemini responses that do not include candidates
  • if Gemini returns an explicit error payload, the app should surface the provider message instead of failing
  • if Gemini returns an unexpected shape without generated text, the app should log the error in gemini response.

Actual behaviour

  • /quick ai assumes the Gemini response always contains generated text at response.data.candidates[0].content.parts[0].text
  • when Gemini returns an error payload instead of candidates, the AI flow fails
  • proper logs are not generated
  • the modal falls back to a generic failure message instead of handling the provider response safely
Steps to reproduce
  1. Install the Quick Replies app
  2. Configure Gemini as the AI provider
  3. Trigger /quick ai
  4. Enter a prompt and click Generate
  5. Hit a Gemini error response such as overload / temporary unavailability
  6. Observe that the response does not contain generated candidate text
Relevant ScreenShots
Image
Version

v8.2.1

What browsers are you seeing the problem on?

Firefox

Ngôn ngữ chính
TypeScript
Star
7
Fork
21
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RocketChat/Apps.QuickReplies

Tất cả issue của RocketChat/Apps.QuickReplies

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.