Add canonical per-provider model lists with picker UI
The catalog only carried one defaultModel string per provider, which forced users to type model ids by hand and made the onboarding / providers panel feel like the original AgentCompany was missing models. - src/shared/provider-models.ts holds the canonical id/name list per provider key (~165 entries across OpenAI, Anthropic, xAI, Groq, GitHub Copilot, Antigravity, GPT account, Azure, Bedrock, Vertex) - ProviderCatalogEntry now exposes a models[] array - Onboarding ProviderStep renders a <select> populated from the active provider's catalog instead of a freeform text input - ProvidersPanel connect dialog uses the same picker for API key, OAuth, and account auth flows - TeamPage hire dialog adds a <datalist> with every catalog model so manual entry is autocompletable
This commit is contained in:
1 parent
dc791ec984
commit
2c3760ca11
6 files changed
+257
-6
No files matched your search
@@ -266,7 +266,19 @@ function ProviderStep({
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Model">
|
||||
<input className="input" value={draft.providerModel} onChange={(event) => onChange({ providerModel: event.target.value })} />
|
||||
{providers.find((entry) => entry.key === draft.providerKey)?.models.length ? (
|
||||
<select
|
||||
className="input"
|
||||
value={draft.providerModel}
|
||||
onChange={(event) => onChange({ providerModel: event.target.value })}
|
||||
>
|
||||
{providers.find((entry) => entry.key === draft.providerKey)?.models.map((model) => (
|
||||
<option key={model.id} value={model.id}>{model.name}</option>
|
||||
))}
|
||||
</select>
|
||||
) : (
|
||||
<input className="input" value={draft.providerModel} onChange={(event) => onChange({ providerModel: event.target.value })} />
|
||||
)}
|
||||
</Field>
|
||||
<Actions onBack={onBack} onNext={onNext} />
|
||||
</div>
|
||||
|
||||
@@ -113,7 +113,21 @@ export function TeamPage({ snapshot, actions }: PageProps) {
|
||||
{providers.map((provider) => <option key={provider.id} value={provider.id}>{provider.label}</option>)}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Model"><input className="input" name="modelId" /></Field>
|
||||
<Field label="Model">
|
||||
<input
|
||||
className="input"
|
||||
name="modelId"
|
||||
list="agent-model-suggestions"
|
||||
placeholder="Leave blank to inherit provider default"
|
||||
/>
|
||||
</Field>
|
||||
<datalist id="agent-model-suggestions">
|
||||
{snapshot.providerCatalog.flatMap((entry) =>
|
||||
entry.models.map((model) => (
|
||||
<option key={`${entry.key}-${model.id}`} value={model.id}>{entry.label} · {model.name}</option>
|
||||
)),
|
||||
)}
|
||||
</datalist>
|
||||
<Field label="Monthly budget"><input className="input" name="budget" type="number" min="0" step="1" defaultValue="250" /></Field>
|
||||
<Field label="Seniority">
|
||||
<select className="input" name="roleLevel" defaultValue="staff">
|
||||
|
||||
@@ -125,7 +125,7 @@ function ProviderConnectFields({
|
||||
<>
|
||||
<p style={{ fontSize: 12.5, color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p>
|
||||
<Field label="API key"><input className="input" name="secret" type="password" required autoFocus /></Field>
|
||||
<Field label="Default model"><input className="input" name="model" defaultValue={provider.model ?? entry.defaultModel ?? ""} /></Field>
|
||||
<ModelPicker entry={entry} provider={provider} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -140,13 +140,33 @@ function ProviderConnectFields({
|
||||
{entry.signInUrl && <span className="mono" style={{ fontSize: 11, color: "var(--text-3)" }}>{entry.signInUrl}</span>}
|
||||
</div>
|
||||
<Field label="Access token"><input className="input" name="secret" type="password" required /></Field>
|
||||
<Field label="Default model"><input className="input" name="model" defaultValue={provider.model ?? entry.defaultModel ?? ""} /></Field>
|
||||
<ModelPicker entry={entry} provider={provider} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
return <CloudFieldsForm entry={entry} provider={provider} />;
|
||||
}
|
||||
|
||||
function ModelPicker({ entry, provider }: { entry: ProviderCatalogEntry; provider: ProviderRecord }) {
|
||||
const defaultValue = provider.model ?? entry.defaultModel ?? entry.models[0]?.id ?? "";
|
||||
if (entry.models.length === 0) {
|
||||
return (
|
||||
<Field label="Default model">
|
||||
<input className="input" name="model" defaultValue={defaultValue} />
|
||||
</Field>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Field label="Default model">
|
||||
<select className="input" name="model" defaultValue={defaultValue}>
|
||||
{entry.models.map((model) => (
|
||||
<option key={model.id} value={model.id}>{model.name}</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
);
|
||||
}
|
||||
|
||||
function CloudFieldsForm({ entry, provider }: { entry: ProviderCatalogEntry; provider: ProviderRecord }) {
|
||||
const [state, setState] = useState<CloudFields>(CLOUD_DEFAULTS);
|
||||
const update = (patch: Partial<CloudFields>) => setState((current) => ({ ...current, ...patch }));
|
||||
|
||||
Reference in new issue
Block a user