Merge pull request #12 from Shchoholiev/bug/SA-242-messages-not-sent

bug/SA-242-messages-not-sent
This commit is contained in:
Serhii Shchoholiev 2023-12-17 06:15:12 -08:00 committed by GitHub
commit 2fb39776e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -62,7 +62,7 @@ class SearchService {
}
Future<String> 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<void> sendMessages(String message) async {
logger.d('WISHLIST ID: $wishlistId');
if (wishlistId != null) {
final sseStream = client.getServerSentEventStream(
'api/productssearch/search/$wishlistId',

View File

@ -114,6 +114,7 @@ class ChatScreenState extends State<ChatScreen> {
Future<void> _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<ChatScreen> {
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<ChatScreen> {
setState(() {
messages.add(Message(text: message, role: "User"));
});
_searchService.wishlistId = widget.wishlistId.toString();
_sendMessageToAPI(message);
}