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

未关闭
#82 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@CodeMatrix1 已经在做这个了。

开始于 2026年3月30日。

  • #81 来自 @CodeMatrix1 —— 已关闭,未合并
  • #83 来自 @CodeMatrix1 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
typescript

调研方向

从 /quick ai 入口开始,跟踪 response.data.candidates[0].content.parts[0].text 附近的 Gemini 响应处理。复现过载或暂时不可用的响应,然后验证明确的提供商消息会被呈现,并且意外响应会被记录日志,而不是导致通用失败。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
7
派生
21
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RocketChat/Apps.QuickReplies 的其他 Issue

查看 RocketChat/Apps.QuickReplies 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。