Repository navigation
web: neutral Custom OpenAI-compatible preset for LLM profiles - #685
Merged
Merged
Conversation
Closes #648. A self-hosted or relayed OpenAI-compatible endpoint has to be configured today by picking the generic "openai" format and knowing the base-URL convention, which the README documents but the form does not guide. The common failures are a base URL that stops short of /v1 or one with /chat/completions pasted on the end. The preset is UI-only: it selects the existing openai format and shows the expected base-URL shape and a one-line hint. No wire format, no schema change, no vendor host, and nothing is prefilled into the value, so an empty base URL still saves as empty and existing profiles are untouched. Because the preset is not stored, it is re-derived when a profile reopens: an openai profile pointing somewhere other than api.openai.com shows the preset. Tests, written before the change: - agent: regression tests pinning the base-URL normalization the preset relies on (bare /v1, trailing slash, a pasted /chat/completions endpoint, whitespace, a path-prefixed gateway, host:port) and pinning that an empty base URL still resolves to the public endpoint. - web: unit tests for the derivation helper, following the src/lib/*.test.mjs convention, wired into package.json and CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lands #677 rebased on current main, with the contributor commit unchanged apart from dropping a co-author trailer that does not belong in the public history.
What it adds
The format selector in System, LLM offers "Custom OpenAI-compatible". It selects the existing
openaiformat, shows the expected base-URL shape (https://<host>/v1) and a one-line hint that the provider appends/chat/completions. Nothing is prefilled into the value and no vendor host is baked in, so an empty base URL keeps the documented public fallback.The preset is UI-only and not stored. Reopening a saved
openaiprofile re-derives it from the base URL: a host other thanapi.openai.comselects the preset, the public endpoint keeps its normal entry.Tests
agent/provider_openai_compatible_test.gopins the normalization the preset relies on: bare/v1, trailing slash, a pasted/chat/completions, whitespace, a path-prefixed gateway, host and port, and the empty base URL fallback.web/src/lib/openai-compatible.test.mjscovers the derivation helper, including the empty, case-insensitive and unparseable cases.test:openai-compatibleis wired intoweb/package.jsonand the web CI job.Credits
@Dukotah, with authorship kept. Closes #648 in the original PR.
Verification
test:openai-compatible,test:i18n,npx tsc --noEmit, and the two new Go tests.