-
Notifications
You must be signed in to change notification settings - Fork 222
feat(config): support 'openai-responses' as customProtocol value #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ import { API_PROVIDER_PRESETS, PI_AI_CURATED_PRESETS } from '../../shared/api-mo | |
| * Application configuration schema | ||
| */ | ||
| export type ProviderType = 'openrouter' | 'anthropic' | 'custom' | 'openai' | 'gemini' | 'ollama'; | ||
| export type CustomProtocolType = 'anthropic' | 'openai' | 'gemini'; | ||
| export type CustomProtocolType = 'anthropic' | 'openai' | 'openai-responses' | 'gemini'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MAJOR] Adding Suggested fix: function normalizeCustomProtocol(
value: CustomProtocolType | undefined,
fallback: CustomProtocolType = 'anthropic'
): CustomProtocolType {
if (
value === 'openai' ||
value === 'openai-responses' ||
value === 'gemini' ||
value === 'anthropic'
) {
return value;
}
return fallback;
} |
||
| export type AppTheme = 'dark' | 'light' | 'system'; | ||
| export type ProviderProfileKey = | ||
| | 'openrouter' | ||
|
|
@@ -293,7 +293,12 @@ function isProviderType(value: unknown): value is ProviderType { | |
| } | ||
|
|
||
| function isCustomProtocol(value: unknown): value is CustomProtocolType { | ||
| return value === 'anthropic' || value === 'openai' || value === 'gemini'; | ||
| return ( | ||
| value === 'anthropic' || | ||
| value === 'openai' || | ||
| value === 'openai-responses' || | ||
| value === 'gemini' | ||
| ); | ||
| } | ||
|
|
||
| function isProfileKey(value: unknown): value is ProviderProfileKey { | ||
|
|
@@ -311,7 +316,10 @@ function profileKeyFromProvider( | |
| if (provider !== 'custom') { | ||
| return provider; | ||
| } | ||
| if (customProtocol === 'openai') { | ||
| if (customProtocol === 'openai' || customProtocol === 'openai-responses') { | ||
| // openai-responses shares the profile slot with openai (same baseUrl/key, | ||
| // different request shape). Avoids forcing the user to re-enter creds when | ||
| // toggling between the two protocols on the same relay. | ||
| return 'custom:openai'; | ||
| } | ||
| if (customProtocol === 'gemini') { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -428,7 +428,7 @@ export interface ExecutionContext { | |
|
|
||
| // App Config types | ||
| export type ProviderType = 'openrouter' | 'anthropic' | 'custom' | 'openai' | 'gemini' | 'ollama'; | ||
| export type CustomProtocolType = 'anthropic' | 'openai' | 'gemini'; | ||
| export type CustomProtocolType = 'anthropic' | 'openai' | 'openai-responses' | 'gemini'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MAJOR] The renderer still only understands three custom protocols even though the type now exposes a fourth. Suggested fix: function isCustomProtocol(value: unknown): value is CustomProtocolType {
return (
value === 'anthropic' ||
value === 'openai' ||
value === 'openai-responses' ||
value === 'gemini'
);
}
if (customProtocol === 'openai' || customProtocol === 'openai-responses') {
return 'custom:openai';
}
[
{ id: 'anthropic', label: 'Anthropic' },
{ id: 'openai', label: 'OpenAI' },
{ id: 'openai-responses', label: 'OpenAI Responses' },
{ id: 'gemini', label: 'Gemini' },
] as const |
||
| export type AppTheme = 'dark' | 'light' | 'system'; | ||
| export type ProviderProfileKey = | ||
| | 'openrouter' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MAJOR] This new branch opts custom relays into
openai-responses, but the surrounding OpenAI-compatible helpers still exclude that protocol.isOpenAIProvider()and related helpers only recognizecustomProtocol === 'openai'(src/main/config/auth-utils.ts:41-46,src/main/config/auth-utils.ts:147-156,src/main/config/auth-utils.ts:220-232),api-diagnosticsuses the same gate (src/main/config/api-diagnostics.ts:99-105), andapplyToEnv()only exportsOPENAI_*forcustomProtocol === 'openai'(src/main/config/config-store.ts:1416-1429). A custom/v1/responsesrelay will therefore be treated as non-OpenAI in validation and env-based flows.Suggested fix: