Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

feat(settings): provider key/endpoint modal + reasoning checkbox & server-side name validation (#235)

shubhamagarwal-create5b9a969404a1
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureModelProviderForm.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureModelProviderForm.tsx
new file mode 100644
index 000000000..de0cc0f7b
--- /dev/null
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConfigureModelProviderForm.tsx
@@ -0,0 +1,158 @@
+'use client';
+
+import { useEffect, useState, type FormEvent } from 'react';
+
+import { cn } from '../../atoms/lib/cn.js';
+import { auiInputClass } from '../../atoms/lib/inputClasses.js';
+import { Accordion, AccordionDetails, AccordionSummary } from '../../atoms/primitives/Accordion.js';
+import { Button } from '../../atoms/primitives/Button.js';
+import { CenteredModal } from '../../atoms/primitives/CenteredModal.js';
+import { Icon } from '../../icons/Icon.js';
+
+export type ModelProviderKeyDraft = { apiKey: string; baseUrl: string };
+
+type ConfigureModelProviderFormProps = {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ onSave: (draft: ModelProviderKeyDraft) => void | Promise<void>;
+ title: string;
+ description?: string;
+ /** Prefills the Base URL (endpoint). The API key is never autofilled. */
+ initialBaseUrl?: string;
+ baseUrlPlaceholder?: string;
+ /** When false (editing), a blank API key keeps the existing one; a value replaces it. */
+ requireApiKey?: boolean;
+ submitLabel?: string;
+ busy?: boolean;
+ error?: string | null;
+};
+
+const inputClassName = auiInputClass('h-11 shadow-sm');
+
+const ConfigureModelProviderForm = ({
+ open,
+ onOpenChange,
+ onSave,
+ title,
+ description,
+ initialBaseUrl = '',
+ baseUrlPlaceholder = 'https://api.openai.com/v1',
+ requireApiKey = true,
+ submitLabel = 'Save',
+ busy = false,
+ error,
+}: ConfigureModelProviderFormProps) => {
+ const [apiKey, setApiKey] = useState('');
+ const [baseUrl, setBaseUrl] = useState('');
+ const [advancedOpen, setAdvancedOpen] = useState(false);
+
+ const resetForm = () => {
+ setApiKey('');
+ setBaseUrl('');
+ setAdvancedOpen(false);
+ };
+
+ // Prefill the endpoint when the modal opens; the API key is always blank (never echoed back).
+ useEffect(() => {
+ if (!open) return;
+ setApiKey('');
+ setBaseUrl(initialBaseUrl);
+ setAdvancedOpen(false);
+ }, [open, initialBaseUrl]);
+
+ const handleOpenChange = (nextOpen: boolean) => {
+ if (!nextOpen) resetForm();
+ onOpenChange(nextOpen);
+ };
+
+ const trimmedKey = apiKey.trim();
+ const isValid = !requireApiKey || !!trimmedKey;
+
+ const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {
+ event.preventDefault();
+ if (!isValid || busy) return;
+ try {
+ await onSave({ apiKey: trimmedKey, baseUrl: baseUrl.trim() });
+ resetForm();
+ onOpenChange(false);
+ } catch {
+ // Parent surfaces the error via the `error` prop; keep the modal open.
+ }
+ };
+
+ return (
+ <CenteredModal open={open} onOpenChange={handleOpenChange} title={title} description={description} contentSized>
+ <form className="flex flex-col overflow-y-auto p-5 md:p-6" onSubmit={handleSubmit}>
+ <div className="space-y-4">
+ <div>
+ <label htmlFor="model-provider-api-key" className="mb-1.5 block text-sm font-medium text-text-primary">
+ API key
+ {!requireApiKey ? <span className="font-normal text-text-secondary"> (optional)</span> : null}
+ </label>
+ <input
+ id="model-provider-api-key"
+ type="password"
+ required={requireApiKey}
+ value={apiKey}
+ onChange={event => {
+ setApiKey(event.target.value);
+ }}
+ placeholder={requireApiKey ? 'Enter API key' : 'Enter a new key'}
+ autoFocus
+ className={inputClassName}
+ />
+ {!requireApiKey ? (
+ <p className="mt-1.5 text-xs text-text-secondary">
+ Leave blank to keep the current key; enter a new one to replace it.
+ </p>
+ ) : null}
+ </div>
+
+ <Accordion
+ expanded={advancedOpen}
+ onChange={(_event, next) => setAdvancedOpen(next)}
+ className="rounded-md border border-border"
+ >
+ <AccordionSummary className="px-3 py-2.5">
+ <span className="flex w-full items-center justify-between text-sm font-medium text-text-primary">
+ Advanced · custom endpoint
+ <Icon
+ name="chevron-down"
+ className={cn(
+ 'size-4 shrink-0 text-text-secondary transition-transform duration-200',
+ advancedOpen ? 'rotate-0' : '-rotate-90',
+ )}
+ />
+ </span>
+ </AccordionSummary>
+ <AccordionDetails className="space-y-1.5 border-t border-border px-3 pb-3 pt-4">
+ <label htmlFor="model-provider-base-url" className="block text-sm font-medium text-text-primary">
+ Base URL
+ </label>
+ <input
+ id="model-provider-base-url"
+ type="url"
+ value={baseUrl}
+ onChange={event => {
+ setBaseUrl(event.target.value);
+ }}
+ placeholder={baseUrlPlaceholder}
+ className={inputClassName}
+ />
+ <p className="text-xs text-text-secondary">Leave blank unless you use a regional or proxy endpoint.</p>
+ </AccordionDetails>
+ </Accordion>
+ </div>
+
+ <div className="mt-6 space-y-3">
+ {error ? <p className="text-failure-bg text-sm">{error}</p> : null}
+ <Button type="submit" size="lg" disabled={!isValid || busy} className="w-full shrink-0">
+ {submitLabel}
+ </Button>
+ </div>
+ </form>
+ </CenteredModal>
+ );
+};
+
+export default ConfigureModelProviderForm;
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/CustomModelProviderForm.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/CustomModelProviderForm.tsx
index 2282bba97..808372b03 100644
--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/CustomModelProviderForm.tsx
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/CustomModelProviderForm.tsx
@@ -5,7 +5,6 @@ import { useState, type ReactNode } from 'react';
import { cn } from '../../atoms/lib/cn.js';
import { Button } from '../../atoms/primitives/Button.js';
import { CenteredModal } from '../../atoms/primitives/CenteredModal.js';
-import { Switch } from '../../atoms/primitives/Switch.js';
import { Icon } from '../../icons/Icon.js';
export type CustomProviderDraft = {
@@ -83,9 +82,6 @@ const inputClassName =
'h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50';
const inputErrorClassName = 'border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg';
-/** Client-side slug rule — identical to the backend NameSchema so the form never rejects a name the server accepts. */
-const NAME_RE = /^[a-z](?:[a-z0-9._-]{0,62}[a-z0-9])$/;
-
/** Parse an optional positive integer; returns null when empty or invalid (so it's simply omitted). */
function parsePositiveInt(raw: string): number | null {
const trimmed = raw.trim();
@@ -171,13 +167,11 @@ const CustomModelProviderForm = ({
);
};
- // ── Validation (client-side; do not rely on backend errors) ──
+ // ── Validation ── Client checks stay backend-agnostic: presence only. Name *format*
+ // rules (slug pattern, length) belong to the server, which may differ per deployment;
+ // violations surface via the `error` prop on submit rather than being second-guessed here.
const trimmedName = name.trim();
- const nameError = !trimmedName
- ? 'Name is required.'
- : trimmedName.length < 2 || trimmedName.length > 64 || !NAME_RE.test(trimmedName)
- ? 'Must be 2–64 lowercase characters, start with a letter, using . _ or - as separators.'
- : null;
+ const nameError = trimmedName ? null : 'Name is required.';
const trimmedBaseUrl = baseUrl.trim();
let baseUrlError: string | null = null;
@@ -192,14 +186,7 @@ const CustomModelProviderForm = ({
}
const modelIdError = (model: ModelRow): string | null => (model.id.trim() ? null : 'Model ID is required.');
- const modelNameError = (model: ModelRow): string | null => {
- const value = model.name.trim();
- if (!value) return 'Model name is required.';
- if (value.length < 2 || value.length > 64 || !NAME_RE.test(value)) {
- return 'Must be 2–64 lowercase characters, start with a letter, using . _ or - as separators.';
- }
- return null;
- };
+ const modelNameError = (model: ModelRow): string | null => (model.name.trim() ? null : 'Model name is required.');
// Both limits are required: the harness budgets a run as input + reserved output ≤ context window.
const modelContextError = (model: ModelRow): string | null =>
@@ -345,8 +332,8 @@ const CustomModelProviderForm = ({
/>
<FieldHelp>
{isEditMode
- ? 'Leave empty to keep the saved key, or enter a new key to replace it.'
- : 'Leave empty if your endpoint needs no key (e.g. a local model).'}
+ ? 'Leave blank to keep the saved key, or enter a new key to replace it.'
+ : 'Leave blank if your endpoint needs no key (e.g. a local model).'}
</FieldHelp>
</div>
@@ -508,20 +495,21 @@ const CustomModelProviderForm = ({
{reasoningEffortOptions && reasoningEffortOptions.length > 0 ? (
<div>
- <div className="flex items-center justify-between gap-3">
- <span className="text-text-secondary text-xs font-medium">Reasoning effort</span>
- <Switch
+ <label className="flex w-fit cursor-pointer items-center gap-2 select-none">
+ <input
+ type="checkbox"
+ className="size-4 shrink-0 cursor-pointer accent-primary-button-bg disabled:cursor-not-allowed disabled:opacity-50"
checked={model.reasoningEfforts !== undefined}
aria-label={`Enable reasoning effort for model ${index + 1}`}
disabled={busy}
- size="md"
- onCheckedChange={nextChecked =>
+ onChange={event =>
updateModel(index, {
- reasoningEfforts: nextChecked ? [] : undefined,
+ reasoningEfforts: event.target.checked ? [] : undefined,
})
}
/>
- </div>
+ <span className="text-text-secondary text-xs font-medium">Reasoning effort</span>
+ </label>
{model.reasoningEfforts !== undefined ? (
<div
role="group"
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx
index 0c5bb6c08..8836278d6 100644
--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx
@@ -2,11 +2,12 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
-import { auiInputClass } from '@/atoms/lib/inputClasses.js';
-import { Accordion, AccordionDetails, AccordionSummary } from '@/atoms/primitives/Accordion.js';
import { Button } from '@/atoms/primitives/Button.js';
import { CatalogLogo } from '@/atoms/primitives/CatalogLogo.js';
import SearchInput from '@/atoms/primitives/SearchInput.js';
+import ConfigureModelProviderForm, {
+ type ModelProviderKeyDraft,
+} from '@/containers/SettingsBuilder/ConfigureModelProviderForm.js';
import CustomModelProviderForm, {
type CustomProviderDraft,
} from '@/containers/SettingsBuilder/CustomModelProviderForm.js';
@@ -37,9 +38,7 @@ const ModelSettings = () => {
const [editingProviderId, setEditingProviderId] = useState<string | null>(null);
const [editingCatalogType, setEditingCatalogType] = useState<string | null>(null);
- const [apiKey, setApiKey] = useState('');
- const [baseUrl, setBaseUrl] = useState('');
- const [advancedOpen, setAdvancedOpen] = useState(false);
+ const [keyError, setKeyError] = useState<string | null>(null);
const [customProviderOpen, setCustomProviderOpen] = useState(false);
const [customProviderToEdit, setCustomProviderToEdit] = useState<ModelProviderBase | null>(null);
@@ -121,9 +120,7 @@ const ModelSettings = () => {
const closeKeyEditor = () => {
setEditingProviderId(null);
setEditingCatalogType(null);
- setApiKey('');
- setBaseUrl('');
- setAdvancedOpen(false);
+ setKeyError(null);
};
const runMutation = async (fn: () => Promise<void>, onError?: (error: unknown) => void) => {
@@ -147,36 +144,41 @@ const ModelSettings = () => {
}
};
- const handleCreateFromCatalog = (providerType: string) => {
- const entry = catalog.find(item => item.type === providerType);
- if (!entry || !apiKey.trim()) return;
-
- void runMutation(async () => {
- await modelCatalog.createModelProvider({
- type: entry.type,
- name: entry.name,
- ...(baseUrl.trim() ? { baseUrl: baseUrl.trim() } : {}),
- apiKey: apiKey.trim(),
- models: entry.models,
- });
- }).catch(() => {});
+ // The key/endpoint modal owns the draft and awaits these handlers: on failure runMutation
+ // re-throws so the modal stays open and shows `keyError`; on success it closes the editor.
+ const handleCreateFromCatalog = async (entry: ModelProviderCatalogEntry, draft: ModelProviderKeyDraft) => {
+ setKeyError(null);
+ await runMutation(
+ async () => {
+ await modelCatalog.createModelProvider({
+ type: entry.type,
+ name: entry.name,
+ ...(draft.baseUrl ? { baseUrl: draft.baseUrl } : {}),
+ apiKey: draft.apiKey,
+ models: entry.models,
+ });
+ },
+ err => setKeyError(getErrorMessage(err, 'Request failed')),
+ );
};
- const handleReplaceKey = (provider: ModelProviderBase) => {
- void runMutation(async () => {
- await modelCatalog.updateModelProvider({
- id: provider.id,
- type: provider.type,
- name: provider.name,
- ...(baseUrl.trim() ? { baseUrl: baseUrl.trim() } : {}),
- apiKey: apiKey.trim(),
- models: provider.models,
- });
- })
- .then(() => {
- toaster?.showSuccess({ title: `${provider.name} updated` });
- })
- .catch(() => {});
+ const handleReplaceKey = async (provider: ModelProviderBase, draft: ModelProviderKeyDraft) => {
+ setKeyError(null);
+ await runMutation(
+ async () => {
+ await modelCatalog.updateModelProvider({
+ id: provider.id,
+ type: provider.type,
+ name: provider.name,
+ ...(draft.baseUrl ? { baseUrl: draft.baseUrl } : {}),
+ // Empty key means "keep the existing one" for hosts that support it.
+ apiKey: draft.apiKey,
+ models: provider.models,
+ });
+ },
+ err => setKeyError(getErrorMessage(err, 'Request failed')),
+ );
+ toaster?.showSuccess({ title: `${provider.name} updated` });
};
const handleRemoveProvider = (provider: ModelProviderBase) => {
@@ -254,79 +256,12 @@ const ModelSettings = () => {
}
: undefined;
- const renderKeyEditor = (opts: { id: string; submitLabel: string; onSave: () => void; isReplacingKey?: boolean }) => (
- <form
- className="mt-4 rounded-lg bg-secondary-bg/40 p-4"
- onSubmit={event => {
- event.preventDefault();
- opts.onSave();
- }}
- >
- <label
- htmlFor={`api-key-${opts.id}`}
- className="mb-2 block text-xs font-semibold uppercase tracking-wide text-text-secondary"
- >
- {opts.isReplacingKey ? 'New API key' : 'API key'}
- </label>
- <input
- id={`api-key-${opts.id}`}
- type="password"
- value={apiKey}
- onChange={event => {
- setApiKey(event.target.value);
- }}
- placeholder={opts.isReplacingKey ? 'Enter a new key' : 'Enter API Key'}
- autoFocus
- className={auiInputClass('h-10')}
- />
- {opts.isReplacingKey ? (
- <p className="mt-1.5 text-sm text-text-secondary">
- Leave blank to keep the current key; enter a new one to replace it.
- </p>
- ) : null}
- <Accordion expanded={advancedOpen} onChange={(_event, next) => setAdvancedOpen(next)}>
- <AccordionSummary className="pt-2 pb-1.5">
- <span className="flex items-center gap-1.5 text-xs text-text-secondary">
- <Icon
- name="chevron-down"
- className={`size-4 transition-transform duration-200 ${advancedOpen ? '' : '-rotate-90'}`}
- />
- Advanced · custom endpoint
- </span>
- </AccordionSummary>
- <AccordionDetails className="flex flex-col gap-1">
- <label
- htmlFor={`base-url-${opts.id}`}
- className="block text-xs font-semibold uppercase tracking-wide text-text-secondary"
- >
- Base URL
- </label>
- <input
- id={`base-url-${opts.id}`}
- type="url"
- value={baseUrl}
- onChange={event => {
- setBaseUrl(event.target.value);
- }}
- placeholder="https://api.openai.com/v1"
- className={auiInputClass('h-10')}
- />
- <p className="text-sm text-text-secondary">
- Leave as the default unless you use a regional or proxy endpoint.
- </p>
- </AccordionDetails>
- </Accordion>
-
- <div className="mt-2 flex items-center justify-end gap-2">
- <Button variant="ghost" size="sm" type="button" onClick={closeKeyEditor} disabled={busy}>
- Cancel
- </Button>
- <Button size="sm" type="submit" disabled={busy || (!opts.isReplacingKey && !apiKey.trim())}>
- {opts.submitLabel}
- </Button>
- </div>
- </form>
- );
+ // The key/endpoint editor is a single centered modal driven by which entry is being edited.
+ const editingProvider =
+ editingProviderId != null ? (configured.find(item => item.id === editingProviderId) ?? null) : null;
+ const editingCatalogEntry =
+ editingCatalogType != null ? (catalog.find(item => item.type === editingCatalogType) ?? null) : null;
+ const keyModalOpen = editingProvider != null || editingCatalogEntry != null;
return (
<>
@@ -415,11 +350,9 @@ const ModelSettings = () => {
setCustomProviderToEdit(provider);
setCustomProviderOpen(true);
} else {
+ setKeyError(null);
setEditingCatalogType(null);
setEditingProviderId(provider.id);
- setApiKey('');
- setBaseUrl(provider.baseUrl ?? '');
- setAdvancedOpen(false);
}
}}
>
@@ -443,17 +376,6 @@ const ModelSettings = () => {
</div>
</header>
- {editingProviderId === provider.id
- ? renderKeyEditor({
- id: provider.id,
- submitLabel: 'Save',
- isReplacingKey: true,
- onSave: () => {
- handleReplaceKey(provider);
- },
- })
- : null}
-
<div className="mt-3 overflow-hidden rounded-lg border border-border bg-secondary-bg/30">
{provider.models.map(model => (
<div
@@ -550,26 +472,15 @@ const ModelSettings = () => {
type="button"
disabled={busy}
onClick={() => {
+ setKeyError(null);
setEditingProviderId(null);
setEditingCatalogType(provider.type);
- setApiKey('');
- setBaseUrl(catalogBaseUrl(provider));
- setAdvancedOpen(false);
}}
>
<Icon name="wrench" className="size-4" />
Configure
</Button>
</header>
- {editingCatalogType === provider.type
- ? renderKeyEditor({
- id: provider.type,
- submitLabel: 'Create',
- onSave: () => {
- handleCreateFromCatalog(provider.type);
- },
- })
- : null}
</article>
);
})}
@@ -584,6 +495,29 @@ const ModelSettings = () => {
) : null}
</div>
+ <ConfigureModelProviderForm
+ open={keyModalOpen}
+ onOpenChange={open => {
+ if (!open) closeKeyEditor();
+ }}
+ onSave={draft => {
+ if (editingProvider) return handleReplaceKey(editingProvider, draft);
+ if (editingCatalogEntry) return handleCreateFromCatalog(editingCatalogEntry, draft);
+ }}
+ title={editingProvider ? 'Edit Provider Details' : 'Configure Provider Details'}
+ initialBaseUrl={
+ editingProvider
+ ? (editingProvider.baseUrl ?? '')
+ : editingCatalogEntry
+ ? catalogBaseUrl(editingCatalogEntry)
+ : ''
+ }
+ requireApiKey={editingProvider == null}
+ submitLabel={editingProvider ? 'Save' : 'Create'}
+ busy={busy}
+ error={keyError}
+ />
+
<CustomModelProviderForm
key={customProviderToEdit?.id ?? 'add-custom-provider'}
open={customProviderOpen}
diff --git a/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/CustomModelProviderForm.test.tsx b/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/CustomModelProviderForm.test.tsx
index 928b87c1a..4f2b4819c 100644
--- a/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/CustomModelProviderForm.test.tsx
+++ b/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/CustomModelProviderForm.test.tsx
@@ -74,13 +74,17 @@ describe('CustomModelProviderForm', () => {
expect(submit).toBeEnabled();
});
- it('shows an inline slug error for an invalid provider name and blocks submit', () => {
+ it('requires the provider name but defers format validation to the server', () => {
renderForm();
const name = screen.getByPlaceholderText('local-llama');
+ // A non-empty name with backend-specific format issues is not rejected client-side —
+ // the server validates format and surfaces it on submit.
fireEvent.change(name, { target: { value: 'Local Llama' } }); // spaces + capitals
fireEvent.blur(name);
- expect(screen.getByText(/2–64 lowercase characters/)).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add provider' })).toBeDisabled();
+ expect(screen.queryByText(/lowercase characters/)).not.toBeInTheDocument();
+ // Emptiness is the only client-side check.
+ fireEvent.change(name, { target: { value: '' } });
+ expect(screen.getByText('Name is required.')).toBeInTheDocument();
});
it('flags an invalid base URL', () => {
@@ -150,7 +154,7 @@ describe('CustomModelProviderForm', () => {
it('includes selected reasoning efforts in properties', async () => {
const onAdd = renderForm();
fillValid(); // expands Advanced and fills the required limits
- fireEvent.click(screen.getByRole('switch', { name: /Enable reasoning effort/ }));
+ fireEvent.click(screen.getByRole('checkbox', { name: /Enable reasoning effort/ }));
fireEvent.click(screen.getByRole('button', { name: 'low' }));
fireEvent.click(screen.getByRole('button', { name: 'Add provider' }));
@@ -168,14 +172,16 @@ describe('CustomModelProviderForm', () => {
expect((screen.getByPlaceholderText('llama-3-1-70b') as HTMLInputElement).value).toBe('llama-3-1-70b');
});
- it('requires the Model name to be a valid slug and blocks submit otherwise', () => {
+ it('defers Model name format validation to the server', () => {
renderForm();
fillVisible();
const modelName = screen.getByPlaceholderText('llama-3-1-70b');
fireEvent.change(modelName, { target: { value: 'Bad Name' } }); // spaces + capitals
fireEvent.blur(modelName);
- expect(screen.getByText(/2–64 lowercase characters/)).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add provider' })).toBeDisabled();
+ // No client-side format error; the server validates the slug on submit.
+ expect(screen.queryByText(/lowercase characters/)).not.toBeInTheDocument();
+ // A non-empty (if malformed) model name does not block submit client-side.
+ expect(screen.getByRole('button', { name: 'Add provider' })).toBeEnabled();
});
it('never errors the auto-derived Model name; the user just enters one', () => {
@@ -199,16 +205,6 @@ describe('CustomModelProviderForm', () => {
expect(screen.queryByText('Model name is required.')).not.toBeInTheDocument();
});
- it('accepts backend-valid names with adjacent separators (matches NameSchema)', () => {
- renderForm();
- fillVisible();
- const modelName = screen.getByPlaceholderText('llama-3-1-70b');
- // Adjacent/mixed separators are valid under the backend NameSchema; the form must not reject them.
- fireEvent.change(modelName, { target: { value: 'gpt--4.1_turbo' } });
- fireEvent.blur(modelName);
- expect(screen.queryByText(/2–64 lowercase characters/)).not.toBeInTheDocument();
- });
-
it('submits the derived slug as the model name', async () => {
const onAdd = renderForm();
fillValid();