From 431546e2d284724f723bbeb0ebb0fa19b34e47bf Mon Sep 17 00:00:00 2001 From: Nik Shevchenko Date: Sat, 10 Jan 2026 21:30:10 -0800 Subject: [PATCH] fix: fetch conversation after onboarding complete event (PR #3960 feature) The onboarding conversation was not being shown because the SpeechProfileProvider was not fetching the conversation when receiving OnboardingCompleteEvent. Changes: - Added conversations_api import - Added _handleOnboardingComplete async method to fetch the conversation - When OnboardingCompleteEvent is received with a conversationId, the conversation is now fetched using getConversationById before finalize() is called - This populates the conversation property so ConversationCreatedWidget can display it --- .../providers/speech_profile_provider.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/lib/providers/speech_profile_provider.dart b/app/lib/providers/speech_profile_provider.dart index 47c22f6704..435395f773 100644 --- a/app/lib/providers/speech_profile_provider.dart +++ b/app/lib/providers/speech_profile_provider.dart @@ -4,6 +4,7 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_provider_utilities/flutter_provider_utilities.dart'; +import 'package:omi/backend/http/api/conversations.dart' as conversations_api; import 'package:omi/backend/http/api/speech_profile.dart'; import 'package:omi/backend/http/api/users.dart'; import 'package:omi/backend/preferences.dart'; @@ -481,6 +482,22 @@ class SpeechProfileProvider extends ChangeNotifier } } + /// Handles onboarding complete event - fetches the created conversation and finalizes + Future _handleOnboardingComplete(OnboardingCompleteEvent event) async { + // Fetch the created conversation before finalizing + if (event.conversationId != null) { + try { + debugPrint('Fetching onboarding conversation: ${event.conversationId}'); + conversation = await conversations_api.getConversationById(event.conversationId!); + debugPrint('Fetched onboarding conversation: ${conversation?.id}, title: ${conversation?.structured?.title}'); + } catch (e) { + debugPrint('Error fetching onboarding conversation: $e'); + } + } + + finalize(); + } + @override void onMessageEventReceived(MessageEvent event) { debugPrint('onMessageEventReceived: ${event.eventType}'); @@ -496,7 +513,7 @@ class SpeechProfileProvider extends ChangeNotifier notifyInfo('NEXT_QUESTION'); } else if (event is OnboardingCompleteEvent) { debugPrint('Onboarding complete from backend: conversationId=${event.conversationId}'); - finalize(); + _handleOnboardingComplete(event); } }