mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): add openai-compatible endpoint placeholder (#26017)
OpenAI-compatible provider endpoints need to include the upstream OpenAI-compatible prefix, typically `/v1`, because Coder appends request suffixes such as `/chat/completions`, `/responses`, and `/models`. The generic OpenAI-compatible provider form did not show an example endpoint, so it was easy to save a host-only URL that looked valid but would fail when used. Add `https://provider.example.com/v1` as the Endpoint placeholder for the OpenAI-compatible provider, matching the documented example URL shape.
This commit is contained in:
@@ -94,6 +94,10 @@ const providerDefaults: Partial<
|
||||
vercel: { name: "vercel", baseUrl: "https://ai-gateway.vercel.sh/v1" },
|
||||
};
|
||||
|
||||
const baseUrlPlaceholders: Partial<Record<AIProviderType, string>> = {
|
||||
"openai-compat": "https://provider.example.com/v1",
|
||||
};
|
||||
|
||||
const makeOpenAiAnthropicSchema = (editing: boolean) =>
|
||||
Yup.object({
|
||||
type: Yup.string()
|
||||
@@ -243,6 +247,7 @@ const apiKeyPlaceholder = (provider: string) => {
|
||||
};
|
||||
|
||||
const baseUrlPlaceholder = (provider: string) =>
|
||||
baseUrlPlaceholders[provider as keyof typeof baseUrlPlaceholders] ??
|
||||
providerDefaults[provider as keyof typeof providerDefaults]?.baseUrl;
|
||||
|
||||
export const ProviderForm: FC<ProviderFormProps> = ({
|
||||
|
||||
Reference in New Issue
Block a user