|
20 | 20 | from pipecat.transports.services.daily import DailyParams, DailyTransport |
21 | 21 | from pipecat.processors.frameworks.rtvi import RTVIConfig, RTVIProcessor |
22 | 22 | from pipecat.services.google.rtvi import GoogleRTVIObserver |
| 23 | +from app.services.mem0.memory import ImprovedMem0MemoryService |
23 | 24 |
|
24 | 25 | from app.core import config |
25 | 26 | from app.agents.voice.automatic.utils.session_context import create_session_context, set_current_session_id |
@@ -263,10 +264,23 @@ async def on_function_calls_started(service, function_calls): |
263 | 264 | ptt_vad_filter = PTTVADFilter("PTTVADFilter") |
264 | 265 | pipeline_components.append(ptt_vad_filter) # Filter VAD frames after STT |
265 | 266 |
|
266 | | - # Add remaining components |
267 | 267 | pipeline_components.extend([ |
268 | 268 | rtvi, |
269 | | - context_aggregator.user(), |
| 269 | + context_aggregator.user() |
| 270 | + ]) |
| 271 | + |
| 272 | + if config.MEM0_ENABLED: |
| 273 | + logger.info("Initializing Mem0 memory service") |
| 274 | + memory_params = ImprovedMem0MemoryService.InputParams() |
| 275 | + memory = ImprovedMem0MemoryService( |
| 276 | + api_key=config.MEM0_API_KEY, |
| 277 | + user_id=args.user_email or args.user_name or args.session_id, # Fallback: email → name → session_id |
| 278 | + params= memory_params, |
| 279 | + ) |
| 280 | + pipeline_components.append(memory) |
| 281 | + |
| 282 | + # Add remaining components |
| 283 | + pipeline_components.extend([ |
270 | 284 | llm, |
271 | 285 | tool_call_processor, |
272 | 286 | tts, |
|
0 commit comments