feat(FN-2959): merge fusion/fn-2959-2
- Add custom provider CRUD routes (`POST/GET/PUT/DELETE /api/custom-providers`) with auth validation and storage in `~/.fusion/settings.json`; registers via `register-custom-provider-routes.ts` - Add `CustomProviderForm` component for user-defined provider configuration (endpoint URL, API key, model ID); includes dedicated CSS - Add custom provider section to `SettingsModal` under the "Models" tab with provider list and add/disable controls - Add custom provider selection to `ModelOnboardingModal` onboarding flow so new users can use their own endpoints - Add changeset (`custom-openai-anthropic-providers.md`) for `@runfusion/fusion` minor release - Add unit tests for `CustomProviderForm`, `ModelOnboardingModal`, `SettingsModal`, custom-provider routes, and `useTasks` hook; update existing mocks Commits merged: - feat(FN-2959): complete Step 6 — add changeset and docs - test(FN-2959): update settings modal mocks for custom provider API - feat(FN-2959): complete Step 4 — add onboarding custom provider flow - feat(FN-2959): complete Step 3 — add settings custom provider disclosure - feat(FN-2959): complete Step 2 — add custom provider form component - feat(FN-2959): complete Step 1 — add custom provider CRUD routes - feat(FN-2975): merge fusion/fn-2975 Files changed: .changeset/custom-openai-anthropic-providers.md | 5 + packages/dashboard/app/api/legacy.ts | 41 ++++ .../app/components/CustomProviderForm.css | 45 ++++ .../app/components/CustomProviderForm.tsx | 203 ++++++++++++++++ .../app/components/ModelOnboardingModal.css | 14 ++ .../app/components/ModelOnboardingModal.tsx | 62 ++++- .../dashboard/app/components/SettingsModal.css | 38 +++ .../dashboard/app/components/SettingsModal.tsx | 91 +++++++- .../__tests__/CustomProviderForm.test.tsx | 60 +++++ .../__tests__/ModelOnboardingModal.test.tsx | 23 ++ .../components/__tests__/SettingsModal.test.tsx | 13 ++ .../__tests__/SettingsModalNodeRouting.test.tsx | 4 + .../components/__tests__/settings-mobile.test.tsx | 4 + .../dashboard/app/hooks/__tests__/useTasks.test.ts | 48 ++++ packages/dashboard/app/hooks/useTasks.ts | 4 +- packages/dashboard/src/auth-paths.ts | 4 + packages/dashboard/src/routes.ts | 2 + .../__tests__/custom-provider-routes.test.ts | 118 ++++++++++ .../src/routes/register-custom-provider-routes.ts | 254 +++++++++++++++++++++ 19 files changed, 1027 insertions(+), 6 deletions(-) Fusion-Task-Id: FN-2959
This commit is contained in:
@@ -1499,6 +1499,47 @@ export function setClaudeCliEnabled(
|
||||
});
|
||||
}
|
||||
|
||||
export interface CustomProviderModelInput {
|
||||
id: string;
|
||||
name?: string;
|
||||
reasoning?: boolean;
|
||||
contextWindow?: number;
|
||||
maxTokens?: number;
|
||||
}
|
||||
|
||||
export interface CustomProviderConfig {
|
||||
id: string;
|
||||
name?: string;
|
||||
baseUrl: string;
|
||||
api: "openai-completions" | "openai-responses" | "anthropic-messages" | "google-generative-ai";
|
||||
apiKey?: string;
|
||||
models: CustomProviderModelInput[];
|
||||
}
|
||||
|
||||
export function fetchCustomProviders(): Promise<{ providers: CustomProviderConfig[] }> {
|
||||
return api<{ providers: CustomProviderConfig[] }>("/custom-providers");
|
||||
}
|
||||
|
||||
export function createCustomProvider(config: CustomProviderConfig): Promise<{ provider: CustomProviderConfig }> {
|
||||
return api<{ provider: CustomProviderConfig }>("/custom-providers", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(config),
|
||||
});
|
||||
}
|
||||
|
||||
export function updateCustomProvider(id: string, config: CustomProviderConfig): Promise<{ provider: CustomProviderConfig }> {
|
||||
return api<{ provider: CustomProviderConfig }>(`/custom-providers/${encodeURIComponent(id)}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(config),
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteCustomProvider(id: string): Promise<void> {
|
||||
return api<void>(`/custom-providers/${encodeURIComponent(id)}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
}
|
||||
|
||||
/** Fetch authentication status for all OAuth providers */
|
||||
export function fetchAuthStatus(): Promise<{
|
||||
providers: AuthProvider[];
|
||||
|
||||
Reference in New Issue
Block a user