()
| 87 | }; |
| 88 | |
| 89 | const handleNewChat = async () => { |
| 90 | setMenuOpen(false); |
| 91 | if (!activeProjectId) return; |
| 92 | const now = new Date().toISOString(); |
| 93 | const tempSession = { id: generateId(), projectId: activeProjectId, title: 'New Chat', createdAt: now, updatedAt: now }; |
| 94 | addSession(tempSession); |
| 95 | setActiveSessionId(tempSession.id); |
| 96 | try { |
| 97 | const created = await invoke<Session>('create_session', { projectId: activeProjectId, title: 'New Chat' }); |
| 98 | const currentSessions = useSessionStore.getState().sessions; |
| 99 | setSessions(currentSessions.map(s => s.id === tempSession.id ? created : s)); |
| 100 | setActiveSessionId(created.id); |
| 101 | } catch (e) { |
| 102 | console.error('Failed to create session:', e); |
| 103 | } |
| 104 | }; |
| 105 | |
| 106 | const handleDeleteChat = () => { |
| 107 | setMenuOpen(false); |
no test coverage detected