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

Aperta
#82 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@CodeMatrix1 ci sta già lavorando.

Dal 30/3/2026.

  • #81 di @CodeMatrix1 — chiusa senza merge
  • #83 di @CodeMatrix1 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript

Direzione di ricerca

Inizia dal punto di ingresso /quick ai e segui la gestione della risposta di Gemini attorno a response.data.candidates[0].content.parts[0].text. Riproduci una risposta di sovraccarico o di temporanea indisponibilità, quindi verifica che i messaggi espliciti del provider vengano mostrati e che le risposte impreviste vengano registrate invece di causare un errore generico.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
7
Fork
21
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RocketChat/Apps.QuickReplies

Tutte le issue di RocketChat/Apps.QuickReplies

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.