Change OpenAI compatible URL placeholder in edit prediction settings (#58771)

Fixed my PR #58753. 

Change the url placeholder from http://localhost:11434 to
http://localhost:8080/v1/completions to match the URL endpoint in the
[docs](https://zed.dev/docs/ai/edit-prediction)
```json
{
  "edit_predictions": {
    "provider": "open_ai_compatible_api",
    "open_ai_compatible_api": {
      "api_url": "http://localhost:8080/v1/completions",
      "model": "deepseek-coder-6.7b-base",
      "prompt_format": "deepseek_coder",
      "max_output_tokens": 512
    }
  }
}
```
Note: http://localhost:8080/v1/completions/ with an extra / does not
work.


Added the constants OPEN_AI_COMPATIBLE_API_URL_PLACEHOLDER and
OPEN_AI_COMPATIBLE_MODEL_PLACEHOLDER.

### Initial Issue
I noticed that using http://localhost:8080 doesn't work with llama.cpp.
Giving errors like this from (zed: open log):
```
2026-06-06T17:55:39+01:00 ERROR [crates/edit_prediction/src/edit_prediction.rs:2464] custom server error: 404 Not Found - {"error":{"message":"File Not Found","type":"not_found_error","code":404}}
```
After reading the docs above, I found out that I had to add
/v1/completions to the end.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:
- N/A
This commit is contained in:
excited gui 2026-07-07 10:53:16 +01:00 committed by GitHub
parent 811fe501a7
commit 64c55b038f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,9 @@ use workspace::AppState;
const OLLAMA_API_URL_PLACEHOLDER: &str = "http://localhost:11434";
const OLLAMA_MODEL_PLACEHOLDER: &str = "qwen2.5-coder:3b-base";
const OPEN_AI_COMPATIBLE_API_URL_PLACEHOLDER: &str = "http://localhost:8080/v1/completions";
const OPEN_AI_COMPATIBLE_MODEL_PLACEHOLDER: &str = "qwen2.5-coder:3b-base";
use crate::{
SettingField, SettingItem, SettingsFieldMetadata, SettingsPageItem, SettingsWindow, USER,
components::{SettingsInputField, SettingsSectionHeader},
@ -526,7 +529,7 @@ fn open_ai_compatible_settings() -> Box<[SettingsPageItem]> {
json_path: Some("edit_predictions.open_ai_compatible_api.api_url"),
}),
metadata: Some(Box::new(SettingsFieldMetadata {
placeholder: Some(OLLAMA_API_URL_PLACEHOLDER),
placeholder: Some(OPEN_AI_COMPATIBLE_API_URL_PLACEHOLDER),
..Default::default()
})),
files: USER,
@ -560,7 +563,7 @@ fn open_ai_compatible_settings() -> Box<[SettingsPageItem]> {
json_path: Some("edit_predictions.open_ai_compatible_api.model"),
}),
metadata: Some(Box::new(SettingsFieldMetadata {
placeholder: Some(OLLAMA_MODEL_PLACEHOLDER),
placeholder: Some(OPEN_AI_COMPATIBLE_MODEL_PLACEHOLDER),
..Default::default()
})),
files: USER,