feat(api): migrate GET /api/chats to session-scoped shape
Merged
AR
5mo ago+704+704+012345678901234567890123456789-482-482-012345678901234567890123456789
Rewrites GET /api/chats (and the MCP get_chats tool) to read from chats ⋈ sessions and emit { id, title, accountId, sessionId, updatedAt } so the chat sidebar can render canonical /sessions/{sid}/chats/{cid} URLs. artist_account_id is accepted-but-ignored for backward compat.
Test plan
- On a Vercel preview, call
GET /api/chatswith a personal Bearer token and confirm the response carriessessionIdandaccountIdper row. - Hit
GET /api/chats?artist_account_id=<uuid>and confirm the param is accepted (200) but does not filter. - As a Recoup admin key, confirm the response includes chats across accounts.
- Invoke the
get_chatsMCP tool and confirm the same projection.
Summary by CodeRabbit
- API Changes
- Chat retrieval endpoint now returns sessionId and accountId for each chat to support canonical session-based URLs.
- Query parameter clarification: artist_account_id is accepted for backward compatibility but no longer affects authorization or results.