Allow cleartext HTTP for user-supplied local OpenAI-compatible endpoints (and surface model-list errors)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 54/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- ai, mobile, networking
Hướng nghiên cứu
Start with app/src/main/AndroidManifest.xml and app/src/debug/AndroidManifest.xml to compare release and debug network policies, then inspect AiConfigScreen.kt where openAIModels errors switch to manual input. Decide how user-supplied HTTP endpoints should be permitted and show the model-list error; done means release builds can use the intended local endpoint policy and users see an actionable error when model loading fails. Check the issue thread for maintainer guidance before choosing the security scope.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened
I'm using the "OpenAI compatible API" AI backend with a gateway running on the phone itself: http://127.0.0.1:7863/v1/. The endpoint is healthy — curl http://127.0.0.1:7863/v1/models returns 200 with 16 models — but in the app the model picker stays on "Loading models…" forever, and no error is ever shown.
Root cause
app/src/main/AndroidManifest.xml declares <application> without android:usesCleartextTraffic and without android:networkSecurityConfig. With targetSdk = compileSdk (37), Android 9+ blocks cleartext HTTP by default, so OkHttp fails at connect time with:
java.net.UnknownServiceException: CLEARTEXT communication to 127.0.0.1 not permitted by network security policy
The only place that permits cleartext for 127.0.0.1 is the debug variant (app/src/debug/AndroidManifest.xml → @xml/webview_test_network_security_config), and its comment explicitly says the release policy is unchanged. So release builds (Play / F-Droid / GitHub) can never reach a local http:// endpoint.
The second half of the problem is that this failure is invisible: in AiConfigScreen.kt, shouldShowManualModelInput becomes true on UiState.Error, which replaces the dropdown with a manual text field and renders no error text. From the user's point of view the model list simply never loads, which reads as a hang rather than a policy rejection.
Why this matters
Running the model endpoint on-device (or on the LAN) is a normal setup: local gateways, Ollama, LM Studio, llama.cpp server, mobile-hosted proxies. All of them are plain http:// by default, and none of them can be reached from a release build.
What I'd like
- Primary: let a user-supplied endpoint use cleartext HTTP. Options, in order of preference:
- add a
networkSecurityConfigin the release manifest that permits cleartext forlocalhost/127.0.0.1(and optionally10.0.2.2/ private ranges) — narrow scope, no globalusesCleartextTraffic; - or gate it behind an explicit opt-in setting (e.g. "allow insecure connections for this endpoint") next to the server URL field;
- or, if you'd rather not permit cleartext at all, at least document it in the AI settings screen ("HTTPS required").
- add a
- Secondary (independent, cheap): surface the actual error when
openAIModelsisUiState.Errorinstead of silently switching to manual input. Right now a cleartext block, a 401, a wrong path and a dead server are all indistinguishable from a hang. Even one line of text would have saved me a lot of guessing.
Environment
- Flare 1.8.0 (Play Store build), Android 13 (API 33), HyperOS
- AI backend: OpenAI compatible API, server URL
http://127.0.0.1:7863/v1/, API key supplied - The same endpoint works from
curlon the same device
Workaround for anyone hitting this
Use a client that allows cleartext custom endpoints, build a debug variant yourself (debug already whitelists 127.0.0.1), or put the endpoint behind a real HTTPS tunnel with a publicly trusted certificate.
- Ngôn ngữ chính
- Kotlin
- Star
- 1.7k
- Fork
- 85
- 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
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DimensionDev/Flare
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
DimensionDev/Flare#2928 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
DimensionDev/Flare#2930 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
DimensionDev/Flare#2929 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
DimensionDev/Flare#2890 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
DimensionDev/Flare#2825 ·
Tất cả issue của DimensionDev/Flare
Issue tương tự
-
IzzyOnDroid inclusionĐang mởF-Droid FOSS question
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
d4rken-org/butler#365 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: 删除聊天模型后错误出现快速入门界面Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Streaming repair closes ~~ with strikethrough off (streamingRepairOptions never sets strikethrough)Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
software-mansion/enriched-markdown#1265 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
kushagrasinghx/BitChord#2048 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
-
device-support good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100