Anxcye / Anxcye/anx-reader

[Bug]: 使用自签证书的OpenAI接口时,出现 CERTIFICATE_VERIFY_FAILED 错误

Abierto
#643 2 comentarios 0 reacciones 0 asignados Ver en GitHub
bug P3 upstream limitation
Lenguaje dominante
Dart
Estrellas
8.8k
Forks
626
Merge medio
9 d 22 h
PR fusionados (30 d)
1

Descripción

### Prerequisites|前提条件

- [x] I have checked the [troubleshooting](https://github.com/Anxcye/anx-reader/blob/develop/docs/troubleshooting.md)|我已经查看过[故障排除](https://github.com/Anxcye/anx-reader/blob/develop/docs/troubleshooting.md)
- [x] I have searched for similar issues and did not find any|我已经搜索过没有相同的问题

### Describe the bug|描述问题

在使用 **自签证书** 的 OpenAI 兼容接口时,即使在 Android 系统中已经导入了该自签证书的根证书,并且系统浏览器访问正常,但 ANX-Reader 在 **AI 设置** 中测试连接时,仍然会抛出 `OpenAIClientException`,错误原因为 `CERTIFICATE_VERIFY_FAILED`。这表明应用可能未使用系统的证书存储,或在 HTTPS 请求时未正确信任用户已安装的证书。

### To reproduce|重现步骤

1. 在 Android 系统设置中,导入并安装自签证书的根证书。
2. 打开 ANX-Reader 应用。
3. 进入 **设置 → 更多设置 → AI设置**。
4. 在 **AI服务** 中选择 **OpenAI**。
5. 在 `URL` 字段中输入使用自签证书的 OpenAI 兼容接口地址。
6. 在 `api_key` 字段中输入有效的密钥。
7. 点击 **测试** 按钮。
8. **观察结果**:连接失败,并出现 `OpenAIClientException: CERTIFICATE_VERIFY_FAILED` 错误。

### Expected behavior|预期行为

预期行为应与系统浏览器保持一致:当用户已在 Android 系统中正确安装并信任了自签证书的根证书后,ANX-Reader 应用内的网络请求(特别是到该 URL 的 AI 服务测试)应该能够成功通过证书验证,正常连接,而不应抛出证书验证失败的异常。

### Screenshots|截图

_No response_

### Platform (please complete the following information)|平台(请填写以下信息)

- Platform: | 平台: Android
- OS: | 操作系统: Android16(MagicOS10)
- AnxReader Version: | 安读版本: v1.10.1-beta.2
- Device: | 设备: 荣耀Magic7 Pro

### Additional context|其他信息

_No response_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.