Spaces:
Configuration error
Configuration error
Download sessions/Sidebar.jsx from CPISTO/TARSTHENEXT: direct link, hf CLI and curl.
- Browser
- Download file 963 Bytes
-
https://huggingface.co/spaces/CPISTO/TARSTHENEXT/resolve/main/sessions/Sidebar.jsx
- Command line
-
hf download hf://spaces/CPISTO/TARSTHENEXT/sessions/Sidebar.jsx
-
curl -L -o Sidebar.jsx https://huggingface.co/spaces/CPISTO/TARSTHENEXT/resolve/main/sessions/Sidebar.jsx
963 Bytes
| import { useEffect, useState } from 'react' | |
| export default function Sidebar({ onSelect }) { | |
| const [sessions, setSessions] = useState([]) | |
| useEffect(() => { | |
| fetch('http://localhost:4000/sessions') | |
| .then(res => res.json()) | |
| .then(data => setSessions(data)) | |
| .catch(err => console.error('Erro ao carregar sessões:', err)) | |
| }, []) | |
| return ( | |
| <aside className="w-64 h-full bg-zinc-800 border-r border-zinc-700 p-4 text-white overflow-y-auto"> | |
| <h2 className="text-lg font-semibold mb-4">Histórico</h2> | |
| <ul className="space-y-2"> | |
| {sessions.map(session => ( | |
| <li key={session.id}> | |
| <button | |
| onClick={() => onSelect(session.messages)} | |
| className="w-full text-left text-sm bg-zinc-700 hover:bg-zinc-600 px-3 py-2 rounded" | |
| > | |
| {session.id} | |
| </button> | |
| </li> | |
| ))} | |
| </ul> | |
| </aside> | |
| ) | |
| } | |