Skip to content

feat(memory): add internal/external memory separation for multi-channel support

zakariae yahya a demandé de fusionner feature/refactor_chat_memory vers develop

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 (uses userUuid + agentId)
  • Added getExternalMemory() methods for external channels (Slack, Teams, Telegram, WhatsApp) using chatId + channel + agentId
  • Removed deprecated getMemory() method

MemoryServiceConstants

  • Added INTERNAL_MEMORY_PATH and EXTERNAL_MEMORY_PATH constants
  • Added HEADER_CHAT_ID (x-chat-id) and HEADER_CHANNEL (x-channel) header constants
  • Added URL builders: buildInternalMemoryUrl(), buildExternalMemoryUrl()
  • Removed legacy buildMemoryUrl() and buildMemoryPath() 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.java
  • src/main/java/com/izemx/iavia/common/agent/common/memory/client/MemoryServiceClient.java
  • src/main/java/com/izemx/iavia/common/agent/common/memory/constants/MemoryServiceConstants.java
  • CHANGELOG.md

Breaking Changes

  • getMemory() method removed - use getInternalMemory() or getExternalMemory() instead
  • OkHttp3 dependency removed - now requires RestTemplate bean 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/**

Rapports de requête de fusion