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

@@ -99,13 +99,11 @@ export default function App() {
// Home: create session, navigate to chat, then send after a tick // Home: create session, navigate to chat, then send after a tick
function handleHomeSend(text) { function handleHomeSend(text) {
createSession(); const newSession = createSession(); // ← capture the returned session
setViewHistory(prev => [...prev, 'home']); setViewHistory(prev => [...prev, 'home']);
setView('chat'); setView('chat');
setLeftOpen(true); setLeftOpen(true);
setTimeout(() => { sendMessage(text, selectedModel, null, newSession); // ← pass directly, no setTimeout needed
sendMessage(text, selectedModel, null);
}, 50);
} }
function handleNewProjectChat(text) { function handleNewProjectChat(text) {
@@ -120,9 +118,7 @@ export default function App() {
setViewHistory(prev => [...prev, view]); setViewHistory(prev => [...prev, view]);
setView('chat'); setView('chat');
setLeftOpen(true); setLeftOpen(true);
setTimeout(() => { sendMessage(text, selectedModel, activeProject?.id ?? null, newSession); // ← direct, no timeout
sendMessage(text, selectedModel, activeProject?.id ?? null);
}, 50);
} }
const canGoBack = view !== 'home'; const canGoBack = view !== 'home';

View File

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

View File

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

View File

@@ -15,6 +15,9 @@ async function searchEpisodes( vector, {limit = ORCHESTRATION.RECENT_EPISODE_LIM
body.filter = { must: [{key: 'sessionId', match: {value: sessionId} }] }; body.filter = { must: [{key: 'sessionId', match: {value: sessionId} }] };
} }
console.log('[qdrant] searchEpisodes filter:', JSON.stringify(body.filter));
console.log('[qdrant] projectSessionIds:', projectSessionIds);
const res = await fetch ( const res = await fetch (
`${BASE_URL}/collections/${COLLECTIONS.EPISODES}/points/search`, `${BASE_URL}/collections/${COLLECTIONS.EPISODES}/points/search`,
{ {