feat(memory): add internal/external memory separation for multi-channel support
feat(memory): Add internal/external memory separation with RestTemplate client
Description
Summary
- Add multi-channel memory support to distinguish between internal platform users and external channel users
- Replace OkHttp3 with Spring RestTemplate for API Gateway pattern
Changes
MemoryService Interface
- Added
getInternalMemory()methods for IAVIA platform users (usesuserUuid+agentId) - Added
getExternalMemory()methods for external channels (Slack, Teams, Telegram, WhatsApp) usingchatId+channel+agentId - Removed deprecated
getMemory()method
MemoryServiceConstants
- Added
INTERNAL_MEMORY_PATHandEXTERNAL_MEMORY_PATHconstants - Added
HEADER_CHAT_ID(x-chat-id) andHEADER_CHANNEL(x-channel) header constants - Added URL builders:
buildInternalMemoryUrl(),buildExternalMemoryUrl() - Removed legacy
buildMemoryUrl()andbuildMemoryPath()methods
MemoryServiceClient
- Replaced OkHttp3 with Spring RestTemplate
- Implements API Gateway pattern via
gatewayUrl+RestTemplate - Simplified HTTP client with
RestTemplate.exchange()
Files Modified
src/main/java/com/izemx/iavia/common/agent/common/memory/service/MemoryService.javasrc/main/java/com/izemx/iavia/common/agent/common/memory/client/MemoryServiceClient.javasrc/main/java/com/izemx/iavia/common/agent/common/memory/constants/MemoryServiceConstants.javaCHANGELOG.md
Breaking Changes
-
getMemory()method removed - usegetInternalMemory()orgetExternalMemory()instead - OkHttp3 dependency removed - now requires
RestTemplatebean injection
Test Plan
-
Verify internal memory retrieval with userUuid -
Verify external memory retrieval with chatId + channel (SLACK, TEAMS, TELEGRAM) -
Confirm RestTemplate correctly calls API Gateway endpoint /api/memory/**