Fix provider snapshot session hydration and agent scoping

This commit is contained in:
Mohamed Boudra
2026-04-07 00:11:43 +07:00
parent 27ddc95862
commit 390a3402ab
5 changed files with 49 additions and 211 deletions
@@ -887,26 +887,17 @@ export function AgentStatusBar({ agentId, serverId, onDropdownClose }: AgentStat
const models = snapshotModels;
const agentProviderDefinitions = useMemo(() => {
if (snapshotEntries) {
return AGENT_PROVIDER_DEFINITIONS.filter((d) =>
snapshotEntries.some((e) => e.provider === d.id),
);
}
const definition = AGENT_PROVIDER_DEFINITIONS.find((d) => d.id === agent?.provider);
return definition ? [definition] : [];
}, [agent?.provider, snapshotEntries]);
}, [agent?.provider]);
const agentProviderModels = useMemo(() => {
const map = new Map<string, AgentModelDefinition[]>();
if (snapshotEntries) {
for (const entry of snapshotEntries) {
if (entry.models) {
map.set(entry.provider, entry.models);
}
}
if (agent?.provider && snapshotModels) {
map.set(agent.provider, snapshotModels);
}
return map;
}, [snapshotEntries]);
}, [agent?.provider, snapshotModels]);
const displayMode =
availableModes.find((mode) => mode.id === agent?.currentModeId)?.label ||