mirror of
https://github.com/Shchoholiev/shopping-assistant-mobile-client.git
synced 2025-04-11 01:18:51 +00:00
deleted display "\n"
This commit is contained in:
parent
84268619fd
commit
a47a5ba490
@ -128,25 +128,30 @@ class ChatScreenState extends State<ChatScreen> {
|
|||||||
final lastMessage = messages.isNotEmpty ? messages.last : null;
|
final lastMessage = messages.isNotEmpty ? messages.last : null;
|
||||||
message.isProduct = _searchService.checkerForProduct();
|
message.isProduct = _searchService.checkerForProduct();
|
||||||
message.isSuggestion = _searchService.checkerForSuggestion();
|
message.isSuggestion = _searchService.checkerForSuggestion();
|
||||||
bool checker = false;
|
|
||||||
logger.d("Product status: ${message.isProduct}");
|
|
||||||
logger.d("Suggestion status: ${message.isSuggestion}");
|
|
||||||
if(message.isSuggestion){
|
if(message.isSuggestion){
|
||||||
suggestions.add(message.text);
|
suggestions.add(message.text);
|
||||||
}
|
}
|
||||||
if (lastMessage != null && lastMessage.role != "User" && message.role != "User" && !message.isSuggestion && message.text != "/n") {
|
logger.d("Product status: ${message.isProduct}");
|
||||||
|
logger.d("Suggestion status: ${message.isSuggestion}");
|
||||||
|
logger.d("Message text: ${message.text}");
|
||||||
|
if (lastMessage != null && lastMessage.role != "User" && message.role != "User" && !message.isSuggestion) {
|
||||||
|
String fullMessageText = lastMessage.text + message.text;
|
||||||
|
fullMessageText = fullMessageText.replaceAll("\\n", "");
|
||||||
|
logger.d("fullMessageText: $fullMessageText");
|
||||||
final updatedMessage = Message(
|
final updatedMessage = Message(
|
||||||
text: "${lastMessage.text}${message.text}",
|
text: fullMessageText,
|
||||||
role: "Application",
|
role: "Application",
|
||||||
isProduct: message.isProduct);
|
isProduct: message.isProduct);
|
||||||
messages.removeLast();
|
messages.removeLast();
|
||||||
messages.add(updatedMessage);
|
messages.add(updatedMessage);
|
||||||
} else {
|
} else {
|
||||||
if(!message.isSuggestion && message.text != "/n"){
|
String messageText = message.text.replaceAll("\\n", "");
|
||||||
messages.add(message);
|
if (!message.isSuggestion) {
|
||||||
|
messages.add(Message(text: messageText, role: message.role, isProduct: message.isProduct, isSuggestion: message.isSuggestion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
isWaitingForResponse = false;
|
isWaitingForResponse = false;
|
||||||
});
|
});
|
||||||
@ -209,6 +214,7 @@ class ChatScreenState extends State<ChatScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_messageController.clear();
|
_messageController.clear();
|
||||||
|
suggestions.clear();
|
||||||
_scrollToBottom();
|
_scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user