MCPcopy Create free account
hub / github.com/enowdev/enowX-Coder / handleNewChat

Function handleNewChat

src/components/layout/ChatHeader.tsx:89–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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);

Callers 1

ChatHeaderFunction · 0.85

Calls 1

generateIdFunction · 0.90

Tested by

no test coverage detected