iOfficeAI / iOfficeAI/AionCore
fix(aionrs): handle non-v1 OpenAI-compatible API roots for chat completions
- Dominant language
- Rust
- Stars
- 105
- Forks
- 169
- Avg merge
- 5h 58m
- Merged PRs (30d)
- 84
Description
### Summary
After the AionUi / AionCore repo split, the old AionUi PR iOfficeAI/AionUi#2514 no longer applies cleanly, but the runtime bug is still relevant.
Some OpenAI-compatible providers use a versioned API root that is not `/v1`, for example:
- Zhipu: `https://open.bigmodel.cn/api/paas/v4`
- Ark: `https://ark.cn-beijing.volces.com/api/v3`
- Qianfan: `https://qianfan.baidubce.com/v2`
When these providers are used through AionRS, the request can become:
```text
/api/paas/v4/v1/chat/completions
```
Expected:
```text
/api/paas/v4/chat/completions
```
### Current code after the split
AionUi still owns the preset provider list, but AionRS runtime URL resolution now lives in AionCore.
Relevant current AionCore behavior:
- `resolve_aionrs_url_and_compat()` handles:
- `is_full_url`
- Gemini `/v1beta/openai`
- official OpenAI `max_completion_tokens`
- It does not yet set `compat.api_path = "/chat/completions"` for known non-`/v1` OpenAI-compatible roots.
- `crates/aionui-system/src/model_fetcher/url_fixer.rs` already knows these roots for model fetching: `/v2`, `/api/v3`, `/api/paas/v4`.
### Proposed fix
In AionCore, when the mapped provider is `openai` and the base URL path ends with one of the known non-`/v1` API roots:
- `/api/paas/v4`
- `/api/v3`
- `/v2`
set:
```rust
compat.api_path = Some("/chat/completions".to_owned());
```
Keep existing behavior unchanged for:
- official OpenAI `/v1`
- DeepSeek and other normal `/v1` OpenAI-compatible providers
- Gemini
- `is_full_url = true`
### Acceptance criteria
- Zhipu `/api/paas/v4` resolves to root chat completions path.
- Ark `/api/v3` resolves to root chat completions path.
- Qianfan `/v2` resolves to root chat completions path.
- Trailing slash variants are covered.
- Official OpenAI `/v1` does not get this override.
- Existing `is_full_url` behavior from AionCore#307 remains unchanged.
Related:
- Old PR: iOfficeAI/AionUi#2514
- User reports: iOfficeAI/AionUi#2713, iOfficeAI/AionUi#2854
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.