diff --git a/web/client/src/components/layout/MiddlePanel.tsx b/web/client/src/components/layout/MiddlePanel.tsx index 7c3ea97..1bc7aa5 100644 --- a/web/client/src/components/layout/MiddlePanel.tsx +++ b/web/client/src/components/layout/MiddlePanel.tsx @@ -1,11 +1,27 @@ import { Plus } from 'lucide-react'; +import { useState, useEffect } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { ScrollArea } from '@/components/ui/scroll-area'; import { useAppStore } from '@/store'; +import { api } from '@/lib/api'; export function MiddlePanel() { - const { conversations, activeConversationId, setActiveConversationId } = useAppStore(); + const { conversations, activeConversationId, setActiveConversationId, setConversations } = useAppStore(); + const [search, setSearch] = useState(''); + + useEffect(() => { + api.listConversations().then(setConversations).catch(() => {}); + }, []); + + const handleSearch = (value: string) => { + setSearch(value); + const qs = value ? `?search=${encodeURIComponent(value)}` : ''; + fetch(`/api/pipeline/conversations${qs}`) + .then((r) => r.json()) + .then(setConversations) + .catch(() => {}); + }; return (