diff --git a/frontend/src/ChatLayout.jsx b/frontend/src/ChatLayout.jsx index bf7567f..a10abb8 100644 --- a/frontend/src/ChatLayout.jsx +++ b/frontend/src/ChatLayout.jsx @@ -4,6 +4,7 @@ import ChatHeader from "./ChatHeader"; import ChatWindow from "./ChatWindow"; import ChatInput from "./ChatInput"; import SessionTable from "./SessionTable"; +import NoSessionBox from './NoSessionBox'; export default function ChatLayout({ theme, @@ -75,7 +76,12 @@ export default function ChatLayout({ )} - + {/* Se non c'è sessionId, mostra il box per crearne una */} + {sessionId ? ( + + ) : ( + + )}
+
Nessuna sessione attiva
+

+ Per iniziare una nuova conversazione, crea una sessione. + Potrai poi inviare messaggi e salvare la cronologia. +

+ +
+ ); +} + diff --git a/frontend/src/useSessionId.js b/frontend/src/useSessionId.js index 7371607..21b125e 100644 --- a/frontend/src/useSessionId.js +++ b/frontend/src/useSessionId.js @@ -9,6 +9,11 @@ export function getUserId() { } export function getSessionId() { + // Legge sempre da localStorage + return localStorage.getItem("sessionId") || null; +} + +export function getSessionIdForced() { // Always re‑read localStorage so latest value is returned let id = localStorage.getItem("sessionId"); if (!id) {