diff --git a/lib/network/search_service.dart b/lib/network/search_service.dart index 3d63048..e3556a0 100644 --- a/lib/network/search_service.dart +++ b/lib/network/search_service.dart @@ -62,7 +62,7 @@ class SearchService { } Future startPersonalWishlist(String message) async { - + logger.d('WISHLIST ID: $wishlistId'); if (wishlistId == null) { final options = MutationOptions( document: gql(startPersonalWishlistMutations), @@ -81,7 +81,7 @@ class SearchService { } Future sendMessages(String message) async { - + logger.d('WISHLIST ID: $wishlistId'); if (wishlistId != null) { final sseStream = client.getServerSentEventStream( 'api/productssearch/search/$wishlistId', diff --git a/lib/screens/chat.dart b/lib/screens/chat.dart index 6fae431..7d487f4 100644 --- a/lib/screens/chat.dart +++ b/lib/screens/chat.dart @@ -114,6 +114,7 @@ class ChatScreenState extends State { Future _loadPreviousMessages() async { final pageNumber = 1; final pageSize = 200; + logger.d('WISH LIST ID: $widget.wishlistId'); appBarTitle = Text(widget.wishlistName, style: TextStyle(fontSize: 18.0)); try { final previousMessages = await _searchService.getMessagesFromPersonalWishlist(widget.wishlistId, pageNumber, pageSize); @@ -220,7 +221,7 @@ class ChatScreenState extends State { void _sendMessage() { final message = _messageController.text; - + logger.d('WISH LIST ID: $widget.wishlistId'); if (widget.wishlistId.isEmpty) { setState(() { messages.add(Message(text: "What are you looking for?", role: "Application")); @@ -231,6 +232,7 @@ class ChatScreenState extends State { setState(() { messages.add(Message(text: message, role: "User")); }); + _searchService.wishlistId = widget.wishlistId.toString(); _sendMessageToAPI(message); }