Files
AgentCompany/src/renderer/components/company-onboarding/provider-cards/ProviderCard.tsx
T
ZacharyZhang-NY a532120649 feat(connectors): add Ollama and LM Studio as a local auth kind
Both servers expose OpenAI-compatible /v1/chat/completions and /v1/models,
so we route them through pi-ai's `openai-completions` API the same way
Fireworks does — but with a per-installation base URL the user enters
during onboarding instead of a hardcoded one. The shared schemas grow a
`local` credential payload carrying just the baseUrl; the credential
resolver surfaces it on `ResolvedCredential.baseUrl`, the runtime bridge
forwards it through `prepareRun`, and the worker plumbs it into
`resolveModel` so the streamed Model<openai-completions> targets the
user's server. The local-cost path short-circuits to zero in cost-writer
since users bill their own hardware, and the live model list is fetched
from the saved baseUrl by `fetchLocalConnectorModels` (Ollama and LM
Studio both speak the standard OpenAI catalog shape). Onboarding ships
a new LocalProviderCard and the Settings panel a LocalForm; both default
to the catalog's per-connector localhost URL and accept any custom URL.
2026-05-14 14:55:38 -04:00

39 lines
1.3 KiB
TypeScript

import type { ConnectorCatalogEntry } from "@shared/connector-catalog";
import type { CredentialSummary } from "@shared/contracts/schemas-credentials";
import type { TranslationFn } from "../../../i18n";
import { OAuthProviderCard } from "./oauth-card";
import { ApiKeyProviderCard } from "./api-key-card";
import { CloudProviderCard } from "./cloud-card";
import { LocalProviderCard } from "./local-card";
export interface ProviderCardProps {
entry: ConnectorCatalogEntry;
credential: CredentialSummary | null;
expanded: boolean;
onToggle: () => void;
onOpenSettings?: () => void;
t: TranslationFn;
}
/**
* Dispatch based on the catalog auth descriptor. Six auth kinds live behind
* four dedicated cards — cloud variants share a card because their onboarding
* affordance is identical (deep link to Settings). A universal form generator
* is intentionally avoided so each auth flow stays legible end-to-end.
*/
export function OnboardingProviderDispatch(props: ProviderCardProps) {
const { entry } = props;
switch (entry.auth.type) {
case "oauth":
return <OAuthProviderCard {...props} />;
case "api_key":
return <ApiKeyProviderCard {...props} />;
case "aws":
case "azure":
case "gcp_adc":
return <CloudProviderCard {...props} />;
case "local":
return <LocalProviderCard {...props} />;
}
}