fix(chat): drop legacy GET /api/chats/{id}/artist caller (#1767)

Merged
AH
6mo ago
+135-77

Summary by cubic

Stop calling the legacy GET /api/chats/{id}/artist endpoint (which caused 404s on workflow chats). Resolve the chat’s artist from GET /api/sessions/{sessionId} and keep the selected artist in sync.

  • Bug Fixes

    • Added useArtistFromChat to fetch the session and select artistId with a user-scoped query; removed useArtistFromRoom.
    • Updated components/VercelChat/chat.tsx to pass sessionId, use the new hook, and memoize on sessionId.
    • Added lib/sessions/getSessionById.ts with zod-validated response and better error handling; removed lib/chats/getChatArtist.ts.
    • Dropped the conversations-cache fallback and /chat/:id deep-link handling; all chats use /sessions/{sessionId}/chats/{chatId}.
  • Refactors

    • Extracted shared lib/api/safeJsonParse.ts and used it in getSessionById.

Summary by CodeRabbit

  • Improvements

    • Chat artist management now properly integrated with session data for improved synchronization
  • Refactor

    • Migrated from room-based to session-based artist selection
    • Session ID now properly tracked throughout the chat interface