Skip to content

fix: fallback to inline media when Drive storage quota is exceeded - #144

Open
w33tardthewise wants to merge 1 commit into
Mag1cFall:mainfrom
w33tardthewise:fix/drive-quota-inline-fallback
Open

w33tardthewise wants to merge 1 commit into
Mag1cFall:mainfrom
w33tardthewise:fix/drive-quota-inline-fallback

Conversation

@w33tardthewise

@w33tardthewise w33tardthewise commented Nov 11, 2026 •

Copy link
Copy Markdown

改动 / Changes

  • internal/aistudio/upload.go: 新增 driveStorageQuotaExceeded 辅助函数,在 Google Drive 上传返回 HTTP 403 且原因包含 storageQuotaExceeded、quota has been exceeded 或 servicedisabled 时识别为存储配额超限或服务未启用。
  • internal/aistudio/upload.go: 在 UploadInlineMediaToLease 中,当 Drive 上传遇到存储配额不足或无法写入时,清理临时副本并保持原始 inlineData 发送,避免因上游配额耗尽而陷入无限循环切换账户并导致请求超时。
  • internal/aistudio/compatibility_test.go: 在 TestRPCErrorCompatibility 中补充 driveStorageQuotaExceeded 的单元测试,覆盖真实 403 错误响应与非 403 / 其他原因的边界情况。
  • 同步更新 README.md、README_en.md 与 docs/protocol.md 中关于内联附件配额不足时保持内联数据发送的描述。

验证 / Verification

  • 运行 go test ./internal/aistudio/... 全部通过。
  • 在实际环境中配置无 Drive 配额或空间已满的账户,以 stream: true 发送携带 base64 图片的 /v1/chat/completions 请求:服务检测到 storageQuotaExceeded 后正确回退至 inlineData 发送,Gemini 正常以流式返回识别结果,未触发循环账户轮换与超时。

@w33tardthewise
w33tardthewise force-pushed the fix/drive-quota-inline-fallback branch from 3f8b1b0 to efda79b Compare November 11, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant