From ede37aced8494f82276a85b591ca80f3e169c22f Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 17 Jul 2026 17:22:26 +0200 Subject: [PATCH] feat: remove header and buttons, move actions to toolbar, drag&drop to any folder level --- frontend/src/components/ai/SessionList.tsx | 18 ++------------ frontend/src/pages/AIAssistant.tsx | 29 ++++++++++++++++++---- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/ai/SessionList.tsx b/frontend/src/components/ai/SessionList.tsx index 211cab4..5313816 100644 --- a/frontend/src/components/ai/SessionList.tsx +++ b/frontend/src/components/ai/SessionList.tsx @@ -36,13 +36,12 @@ function buildTree(folders: ChatFolder[], sessions: ChatSession[]): TreeNode[] { } function TreeItem({ - node, activeSessionId, onSelectSession, depth, onMoveSession, onDeleteFolder, onAddFolder, onDragSession, onDropToFolder, + node, activeSessionId, onSelectSession, depth, onDeleteFolder, onAddFolder, onDragSession, onDropToFolder, }: { node: TreeNode; activeSessionId: string | null; onSelectSession: (id: string) => void; depth: number; - onMoveSession: (sessionId: string, folderId: string | null) => void; onDeleteFolder: (folderId: string) => void; onAddFolder: (parentId: string | null) => void; onDragSession: (sessionId: string) => void; @@ -109,7 +108,6 @@ function TreeItem({ activeSessionId={activeSessionId} onSelectSession={onSelectSession} depth={depth + 1} - onMoveSession={onMoveSession} onDeleteFolder={onDeleteFolder} onAddFolder={onAddFolder} onDragSession={onDragSession} @@ -138,15 +136,8 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class useEffect(() => { loadData(); }, [isSidebar]); - const handleNewChat = async () => { - try { - const session = await createSession({ is_sidebar: isSidebar || false }); - setSessions((prev) => [session, ...prev]); onSelectSession(session.id); - } catch (e) { setError(e instanceof Error ? e.message : 'Failed'); } - }; - const handleAddFolder = (parentId: string | null) => { - const name = prompt('Ordnername:');; + const name = prompt('Ordnername:'); if (!name) return; createFolder({ name, parent_id: parentId || undefined }).then(() => loadData()).catch((e) => setError(e?.message)); }; @@ -171,10 +162,6 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class return (
-
- - -
{error &&
{error}
}
{tree.map((node) => ( @@ -184,7 +171,6 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class activeSessionId={activeSessionId} onSelectSession={onSelectSession} depth={0} - onMoveSession={() => {}} onDeleteFolder={handleDeleteFolder} onAddFolder={handleAddFolder} onDragSession={setDragSessionId} diff --git a/frontend/src/pages/AIAssistant.tsx b/frontend/src/pages/AIAssistant.tsx index 7b21105..2293156 100644 --- a/frontend/src/pages/AIAssistant.tsx +++ b/frontend/src/pages/AIAssistant.tsx @@ -9,6 +9,7 @@ export function AIAssistantPage() { const [agents, setAgents] = useState([]); const [selectedAgentId, setSelectedAgentId] = useState(null); const [mobileView, setMobileView] = useState<'list' | 'chat'>('list'); + const [refreshKey, setRefreshKey] = useState(0); const { registerItems, unregisterPlugin } = usePluginToolbarStore(); useEffect(() => { fetchAgents().then(setAgents).catch(() => {}); }, []); @@ -37,7 +38,27 @@ export function AIAssistantPage() { ), - onClick: () => { setActiveSessionId(null); setMobileView('list'); }, + onClick: () => { setActiveSessionId(null); setMobileView('list'); setRefreshKey(k => k + 1); }, + }, + { + id: 'new-folder', + plugin: 'ai_assistant', + label: 'Ordner', + type: 'button', + group: 'actions', + icon: ( + + + + ), + onClick: () => { + const name = prompt('Ordnername:'); + if (name) { + import('@/api/ai').then(({ createFolder }) => { + createFolder({ name }).then(() => setRefreshKey(k => k + 1)).catch(() => {}); + }); + } + }, }, ]); return () => unregisterPlugin('ai_assistant'); @@ -49,8 +70,7 @@ export function AIAssistantPage() {
{/* Desktop: two-pane layout */}
-

KI Assistent

- +
{activeSessionId ? : ( @@ -61,8 +81,7 @@ export function AIAssistantPage() {
{mobileView === 'list' && (
-

KI Assistent

- +
)} {mobileView === 'chat' && activeSessionId && (