documentation update

This commit is contained in:
Storme-bit
2026-04-19 00:26:48 -07:00
parent e1375e7d1b
commit ed57a0331a
4 changed files with 13 additions and 12 deletions

View File

@@ -8,8 +8,9 @@ export function useChat({ activeSession, appendMessage, updateLastMessage, refre
const [lastModel, setLastModel] = useState(null);
const cancelRef = useRef(null);
const sendMessage = useCallback(async (text, model, projectId = null) => {
if (!activeSession || !text.trim() || streaming) return;
const sendMessage = useCallback(async (text, model, projectId = null, session=null) => {
const targetSession = session ?? activeSession;
if (!targetSession || !text.trim() || streaming) return;
setError(null);
@@ -32,7 +33,7 @@ export function useChat({ activeSession, appendMessage, updateLastMessage, refre
// 3. Open stream
cancelRef.current = streamMessage(
activeSession.external_id,
targetSession.external_id,
text,
model,
{
@@ -59,7 +60,7 @@ export function useChat({ activeSession, appendMessage, updateLastMessage, refre
// Assign project after first message if one was set
if (projectId) {
updateSession(activeSession.external_id, { projectId })
updateSession(targetSession.external_id, { projectId })
.catch(err => console.warn('[useChat] Failed to assign project:', err.message));
}
},

View File

@@ -58,11 +58,12 @@ export function useSession() {
const newSession = {
external_id: uuidv4(),
metadata: null,
isNew: true, // flag so SessionList can style it differently
isNew: true,
};
setSessions(prev => [newSession, ...prev]);
setActiveSession(newSession);
setMessages([]);
return newSession
}, []);