mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-06 17:57:43 +02:00
Merge remote-tracking branch 'origin/eric/dev' into eric/dev
This commit is contained in:
@@ -215,12 +215,7 @@ export function useAgentSpawn({
|
||||
(s) => s.status !== 'draft' && s.dashboard_id === dashboardId,
|
||||
).length;
|
||||
const NAME_GEN_TRIGGERS = [1, 3, 6];
|
||||
const currentDash = store.getState().dashboards.items[dashboardId];
|
||||
const canAutoName =
|
||||
currentDash &&
|
||||
(currentDash.auto_named || currentDash.name === 'Untitled Dashboard');
|
||||
|
||||
if (NAME_GEN_TRIGGERS.includes(agentCount) && canAutoName) {
|
||||
if (NAME_GEN_TRIGGERS.includes(agentCount)) {
|
||||
dispatch(generateDashboardName(dashboardId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,16 +255,13 @@ export function useDashboardLifecycle({
|
||||
|
||||
const namedOnFirstMessageRef = useRef<string | null>(null);
|
||||
useEffect(() => {
|
||||
if (!dashboardId || !layoutInitialized) return;
|
||||
if (!dashboardId) return;
|
||||
if (namedOnFirstMessageRef.current === dashboardId) return;
|
||||
const dash = store.getState().dashboards.items[dashboardId];
|
||||
if (!dash) return;
|
||||
if (!dash.auto_named && dash.name !== 'Untitled Dashboard') return;
|
||||
const hasUserMessage = Object.values(sessions).some(
|
||||
(s) => s.dashboard_id === dashboardId && s.messages?.some((m) => m.role === 'user'),
|
||||
);
|
||||
if (!hasUserMessage) return;
|
||||
namedOnFirstMessageRef.current = dashboardId;
|
||||
dispatch(generateDashboardName(dashboardId));
|
||||
}, [sessions, dashboardId, layoutInitialized, dispatch]);
|
||||
}, [sessions, dashboardId, dispatch]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user