fix(chat): preserve custom CLI preference during catalog load (#149)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -362,25 +362,48 @@ function LeafView({
|
||||
|
||||
// Load the project's agents for the dropdown.
|
||||
const [agents, setAgents] = useState<Agent[]>([]);
|
||||
const [agentsLoaded, setAgentsLoaded] = useState(false);
|
||||
useEffect(() => {
|
||||
if (!agentGateway) return;
|
||||
setAgentsLoaded(false);
|
||||
if (!agentGateway) {
|
||||
setAgentsLoaded(true);
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
agentGateway.listAgents(projectId).then((list) => {
|
||||
if (!cancelled) setAgents(list);
|
||||
}).catch(() => {/* ignore — dropdown stays empty */});
|
||||
if (!cancelled) {
|
||||
setAgents(list);
|
||||
setAgentsLoaded(true);
|
||||
}
|
||||
}).catch(() => {
|
||||
if (!cancelled) setAgentsLoaded(true);
|
||||
/* ignore — dropdown stays empty */
|
||||
});
|
||||
return () => { cancelled = true; };
|
||||
}, [agentGateway, projectId]);
|
||||
|
||||
const [profiles, setProfiles] = useState<AgentProfile[]>([]);
|
||||
const [profilesLoaded, setProfilesLoaded] = useState(false);
|
||||
useEffect(() => {
|
||||
setProfilesLoaded(false);
|
||||
if (!profileGateway) {
|
||||
setProfilesLoaded(true);
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
profileGateway
|
||||
?.listProfiles()
|
||||
.listProfiles()
|
||||
.then((list) => {
|
||||
if (!cancelled) setProfiles(list);
|
||||
if (!cancelled) {
|
||||
setProfiles(list);
|
||||
setProfilesLoaded(true);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) setProfiles([]);
|
||||
if (!cancelled) {
|
||||
setProfiles([]);
|
||||
setProfilesLoaded(true);
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
@ -486,8 +509,9 @@ function LeafView({
|
||||
agentGateway?.closeAgentChat,
|
||||
);
|
||||
useEffect(() => {
|
||||
if (!agentsLoaded || !profilesLoaded) return;
|
||||
if (!customCliAvailable && cellMode !== "tui") setCellMode("tui");
|
||||
}, [cellMode, customCliAvailable]);
|
||||
}, [agentsLoaded, cellMode, customCliAvailable, profilesLoaded, setCellMode]);
|
||||
const modelServerStatus = statusForAgent(pinnedAgent);
|
||||
const modelServerOverlay = modelServerOverlayText(modelServerStatus);
|
||||
// F2 — download progress (bar/%/bytes/source) when the status carries it; null
|
||||
|
||||
Reference in New Issue
Block a user