documentation update
This commit is contained in:
@@ -99,13 +99,11 @@ export default function App() {
|
||||
|
||||
// Home: create session, navigate to chat, then send after a tick
|
||||
function handleHomeSend(text) {
|
||||
createSession();
|
||||
const newSession = createSession(); // ← capture the returned session
|
||||
setViewHistory(prev => [...prev, 'home']);
|
||||
setView('chat');
|
||||
setLeftOpen(true);
|
||||
setTimeout(() => {
|
||||
sendMessage(text, selectedModel, null);
|
||||
}, 50);
|
||||
sendMessage(text, selectedModel, null, newSession); // ← pass directly, no setTimeout needed
|
||||
}
|
||||
|
||||
function handleNewProjectChat(text) {
|
||||
@@ -120,9 +118,7 @@ export default function App() {
|
||||
setViewHistory(prev => [...prev, view]);
|
||||
setView('chat');
|
||||
setLeftOpen(true);
|
||||
setTimeout(() => {
|
||||
sendMessage(text, selectedModel, activeProject?.id ?? null);
|
||||
}, 50);
|
||||
sendMessage(text, selectedModel, activeProject?.id ?? null, newSession); // ← direct, no timeout
|
||||
}
|
||||
|
||||
const canGoBack = view !== 'home';
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ async function searchEpisodes( vector, {limit = ORCHESTRATION.RECENT_EPISODE_LIM
|
||||
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 (
|
||||
`${BASE_URL}/collections/${COLLECTIONS.EPISODES}/points/search`,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user