fix: correction de régression UI wizard first-run
This commit is contained in:
@ -14,6 +14,15 @@ import type {
|
||||
} from "@/domain";
|
||||
import { useGateways } from "@/app/di";
|
||||
import { Button, Input, Panel, cn } from "@/shared";
|
||||
import {
|
||||
ModelServersPanel,
|
||||
useModelServers,
|
||||
} from "@/features/model-servers";
|
||||
import {
|
||||
OpenCodeModeFields,
|
||||
useOpenCodeProviderCatalog,
|
||||
} from "./OpenCodeModeFields";
|
||||
import { validateProfile } from "./profile";
|
||||
|
||||
type ProfileTab = "codex" | "claude" | "openCode";
|
||||
type ModelTab = "codex" | "claude";
|
||||
@ -258,6 +267,8 @@ function ModelField({
|
||||
|
||||
export function ProfilesSettings() {
|
||||
const { profile } = useGateways();
|
||||
const modelServers = useModelServers();
|
||||
const providerCatalog = useOpenCodeProviderCatalog();
|
||||
const [profiles, setProfiles] = useState<AgentProfile[]>([]);
|
||||
const [references, setReferences] = useState<AgentProfile[]>([]);
|
||||
const [catalogue, setCatalogue] = useState(EMPTY_CATALOGUE);
|
||||
@ -423,11 +434,6 @@ export function ProfilesSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
const modelOptions =
|
||||
activeTab === "codex" || activeTab === "claude"
|
||||
? catalogue[activeTab].models
|
||||
: [];
|
||||
|
||||
return (
|
||||
<Panel
|
||||
aria-label="ai profiles settings"
|
||||
@ -479,6 +485,8 @@ export function ProfilesSettings() {
|
||||
</p>
|
||||
))}
|
||||
|
||||
{activeTab === "openCode" && <ModelServersPanel vm={modelServers} />}
|
||||
|
||||
{visibleProfiles.length === 0 ? (
|
||||
<p className="text-sm text-muted">
|
||||
Aucun profil {TABS.find((tab) => tab.id === activeTab)?.label} configure.
|
||||
@ -489,6 +497,7 @@ export function ProfilesSettings() {
|
||||
const draft = drafts[saved.id] ?? saved;
|
||||
const model = modelOf(draft);
|
||||
const dirty = JSON.stringify(draft) !== JSON.stringify(saved);
|
||||
const errors = validateProfile(draft);
|
||||
return (
|
||||
<li
|
||||
key={saved.id}
|
||||
@ -520,26 +529,21 @@ export function ProfilesSettings() {
|
||||
updateDraft(saved.id, (p) => withModel(p, value))
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<label className="flex min-w-0 flex-col gap-1">
|
||||
<span className="text-xs font-medium text-muted">Modèle</span>
|
||||
<Input
|
||||
aria-label={`modele du profil ${saved.name}`}
|
||||
placeholder={
|
||||
modelOptions.length > 0
|
||||
? "Choisir ou saisir un modèle"
|
||||
: "Saisir un modèle"
|
||||
}
|
||||
value={model}
|
||||
onChange={(e) =>
|
||||
updateDraft(saved.id, (p) =>
|
||||
withModel(p, e.target.value),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{draft.structuredAdapter === "openCode" && (
|
||||
<OpenCodeModeFields
|
||||
profile={draft}
|
||||
errors={errors}
|
||||
servers={modelServers.servers}
|
||||
providerCatalog={providerCatalog}
|
||||
onChange={(next) =>
|
||||
updateDraft(saved.id, () => next)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{saveWarnings[saved.id] && (
|
||||
<p className="mt-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning">
|
||||
{saveWarnings[saved.id]}
|
||||
|
||||
Reference in New Issue
Block a user