mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-31 12:19:48 +02:00
[eric] history: move chat history from the dock to the top island and make it global (was filtered to the current dashboard)
This commit is contained in:
@@ -259,9 +259,8 @@ const DashboardToolbar = React.forwardRef<HTMLDivElement, Props>(
|
||||
q: historyQuery,
|
||||
limit: HISTORY_PAGE_SIZE,
|
||||
offset: historySearch.results.length,
|
||||
dashboardId,
|
||||
}));
|
||||
}, [dispatch, historyQuery, historySearch.loading, historySearch.hasMore, historySearch.results.length, dashboardId]);
|
||||
}, [dispatch, historyQuery, historySearch.loading, historySearch.hasMore, historySearch.results.length]);
|
||||
|
||||
const isExpanded = inputOpen || viewPickerOpen || historyOpen;
|
||||
|
||||
@@ -376,13 +375,14 @@ const DashboardToolbar = React.forwardRef<HTMLDivElement, Props>(
|
||||
};
|
||||
}, [handleOpenViewPicker, handleOpenHistory, onAddBrowser]);
|
||||
|
||||
// No dashboardId: chat history is global, so a chat you started on another dashboard is still findable here.
|
||||
useEffect(() => {
|
||||
if (!historyOpen) return;
|
||||
const timer = setTimeout(() => {
|
||||
dispatch(searchHistory({ q: historyQuery, limit: HISTORY_PAGE_SIZE, offset: 0, dashboardId }));
|
||||
dispatch(searchHistory({ q: historyQuery, limit: HISTORY_PAGE_SIZE, offset: 0 }));
|
||||
}, 300);
|
||||
return () => clearTimeout(timer);
|
||||
}, [historyQuery, historyOpen, dispatch, dashboardId]);
|
||||
}, [historyQuery, historyOpen, dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
if (historyOpen && popoverMode === 'runs') {
|
||||
|
||||
@@ -5,6 +5,8 @@ import SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';
|
||||
import GridViewRoundedIcon from '@mui/icons-material/GridViewRounded';
|
||||
import LanguageIcon from '@mui/icons-material/Language';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import HistoryIcon from '@mui/icons-material/History';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
import { useClaudeTokens } from '@/shared/styles/ThemeContext';
|
||||
import { useAppDispatch } from '@/shared/hooks';
|
||||
import DashboardGlyph from './DashboardGlyph';
|
||||
@@ -164,6 +166,26 @@ const DashboardHeader: React.FC<DashboardHeaderProps> = ({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* Chat history lives up here on the island, not in the dock, and it spans every dashboard. */}
|
||||
<Tooltip title="Chat history" placement="bottom">
|
||||
<Box
|
||||
onClick={(e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
window.dispatchEvent(new CustomEvent('openswarm:open-history'));
|
||||
}}
|
||||
sx={{
|
||||
ml: 0.25,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
borderRadius: '5px',
|
||||
p: '2px',
|
||||
cursor: 'pointer',
|
||||
'&:hover': { bgcolor: `${c.bg.surface}99` },
|
||||
}}
|
||||
>
|
||||
<HistoryIcon sx={{ fontSize: 16, color: c.text.tertiary }} />
|
||||
</Box>
|
||||
</Tooltip>
|
||||
{dashboardId && (
|
||||
<Box sx={{ ml: 0.25, display: 'flex' }}>
|
||||
<ShareButton
|
||||
|
||||
@@ -5,7 +5,6 @@ import Typography from '@mui/material/Typography';
|
||||
import LanguageIcon from '@mui/icons-material/Language';
|
||||
import EventRepeatIcon from '@mui/icons-material/EventRepeat';
|
||||
import StickyNote2OutlinedIcon from '@mui/icons-material/StickyNote2Outlined';
|
||||
import HistoryIcon from '@mui/icons-material/History';
|
||||
import { openWorkflowsApp } from '@/shared/state/dashboardLayoutSlice';
|
||||
import SettingsIcon from '@mui/icons-material/Settings';
|
||||
import AppsRoundedIcon from '@mui/icons-material/AppsRounded';
|
||||
@@ -202,12 +201,11 @@ function DesktopDock({
|
||||
{entries.length > 0 && (
|
||||
<Box sx={{ width: TILE - 8, height: '1px', background: 'rgba(255,255,255,0.14)' }} />
|
||||
)}
|
||||
{/* The og toolbar's actions, dock-resident: browser, workflow, note, history, then settings + apps below their own divider. No New-chat tile; the spawn pill at the bottom is always there. */}
|
||||
{/* The og toolbar's actions, dock-resident: browser, workflow, note, then settings + apps below their own divider. New-chat lives in the spawn pill, history on the top island. */}
|
||||
{([
|
||||
{ label: 'New browser', icon: <LanguageIcon sx={{ fontSize: 17, color: '#e8e8ee' }} />, act: onAddBrowser },
|
||||
{ label: 'Workflows', icon: <EventRepeatIcon sx={{ fontSize: 16, color: '#e8e8ee' }} />, act: () => dispatch(openWorkflowsApp()) },
|
||||
{ label: 'New note', icon: <StickyNote2OutlinedIcon sx={{ fontSize: 16, color: '#e8e8ee' }} />, act: onAddNote },
|
||||
{ label: 'History', icon: <HistoryIcon sx={{ fontSize: 17, color: '#e8e8ee' }} />, act: () => window.dispatchEvent(new CustomEvent('openswarm:open-history')) },
|
||||
{ label: 'Settings', icon: <SettingsIcon sx={{ fontSize: 18, color: '#e8e8ee' }} />, act: () => dispatch(openSettingsModal(undefined)), divider: true },
|
||||
{ label: 'Applications', icon: <AppsRoundedIcon sx={{ fontSize: 18, color: '#e8e8ee' }} />, act: onApplications, bg: 'linear-gradient(135deg, #3d3d46, #232329)' },
|
||||
] as { label: string; icon: React.ReactNode; act: () => void; divider?: boolean; bg?: string }[]).map((a) => (
|
||||
|
||||
Reference in New Issue
Block a user