chat sessions in project view
This commit is contained in:
@@ -8,7 +8,7 @@ export function useChat({ activeSession, appendMessage, updateLastMessage, refre
|
||||
const [lastModel, setLastModel] = useState(null);
|
||||
const cancelRef = useRef(null);
|
||||
|
||||
const sendMessage = useCallback(async (text, model) => {
|
||||
const sendMessage = useCallback(async (text, model, projectId = null) => {
|
||||
if (!activeSession || !text.trim() || streaming) return;
|
||||
|
||||
setError(null);
|
||||
@@ -56,6 +56,12 @@ export function useChat({ activeSession, appendMessage, updateLastMessage, refre
|
||||
|
||||
// Delayed refresh
|
||||
setTimeout( () => refreshSessions(), 3000);
|
||||
|
||||
// Assign project after first message if one was set
|
||||
if (projectId) {
|
||||
updateSession(activeSession.external_id, { projectId })
|
||||
.catch(err => console.warn('[useChat] Failed to assign project:', err.message));
|
||||
}
|
||||
},
|
||||
|
||||
onError: (err) => {
|
||||
|
||||
@@ -82,6 +82,7 @@ export function useSession() {
|
||||
|
||||
return {
|
||||
sessions,
|
||||
setSessions,
|
||||
activeSession,
|
||||
messages,
|
||||
loadingHistory,
|
||||
|
||||
Reference in New Issue
Block a user