fix: improve Matrix session detection to prevent API calls in DMs

- Fixed hasMatrixMapping logic to properly detect Matrix-backed sessions
- Matrix room IDs check for direct mappings
- Regular session IDs check if they're mapped FROM Matrix rooms
- This prevents DM sessions from making OpenAI API calls
- Only @goose mentions should trigger AI responses in DMs
This commit is contained in:
spencrmartin
2025-11-17 16:17:24 -05:00
parent f1db6c2dc3
commit d633cdcd1f
+5 -1
View File
@@ -88,7 +88,11 @@ export const useChatEngine = ({
const matrixRoomId = sessionMappingService.getMatrixRoomId(chat.sessionId);
// Check if this session has a Matrix mapping (indicating it's a Matrix-backed session)
const hasMatrixMapping = sessionMappingService.getMapping(chat.sessionId) !== null;
// For Matrix room IDs, check if a mapping exists
// For regular session IDs, check if they're mapped FROM a Matrix room
const hasMatrixMapping = isMatrixRoom
? sessionMappingService.getMapping(chat.sessionId) !== null
: matrixRoomId !== null;
// A session is collaborative if:
// 1. It's a Matrix room ID (starts with !)