Files
Momento/memento-note/lib/socket-emit.ts
Antigravity 1fcea6ed7d
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 7s
feat: brainstorm sessions, PDF document Q&A, embedding fixes, and UI improvements
- Add brainstorm feature with collaborative canvas, AI idea generation, live cursors, playback, and export
- Add PDF upload/extraction/ingestion pipeline with pgvector document search (RAG)
- Add document Q&A overlay with streaming chat and PDF preview
- Add note attachments UI with status polling, grid layout, and auto-scroll
- Add task extraction AI tool and agent executor improvements
- Fix NoteEmbedding missing updatedAt column, re-index 66 notes with 1536-dim embeddings
- Fix brainstorm 'Create Note' button: add success toast and redirect to created note
- Fix memory echo notification infinite polling
- Fix chat route to always include document_search tool
- Add brainstorm i18n keys across all 14 locales
- Add socket server for real-time brainstorm collaboration
- Add hierarchical notebook selector and organize notebook dialog improvements
- Add sidebar brainstorm section with session management
- Update prisma schema with brainstorm tables, attachments, and document chunks
2026-05-14 17:43:21 +00:00

28 lines
971 B
TypeScript

// [UPDATE - TEMPS RÉEL] Helper pour émettre des événements Socket.io depuis les API routes Next.js.
// Utilise un canal HTTP interne vers le process socket-server.ts séparé.
// Non-fatal : en cas d'échec, le client récupérera l'état via React Query polling.
export async function emitToSession(
sessionId: string,
event: string,
data: unknown
): Promise<void> {
const socketUrl = process.env.SOCKET_INTERNAL_URL || 'http://localhost:3003'
const internalKey = process.env.SOCKET_INTERNAL_KEY || ''
try {
await fetch(`${socketUrl}/emit`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-internal-key': internalKey,
},
body: JSON.stringify({ sessionId, event, data }),
signal: AbortSignal.timeout(2000), // 2s max — ne pas bloquer l'API
})
} catch {
// Non-fatal — le canal Socket est best-effort
// Le client se resynchronise via invalidation React Query
}
}