From 9a8f157451f33311cdcc60dc9b8713d6c066cf7f Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 10 Nov 2025 14:48:15 +0200 Subject: [PATCH] QOL: Mzansi AI Chat Look and Feel & Startup question pt5 --- .../mzansi_ai/package_tools/mih_ai_chat.dart | 12 +++++++++--- Frontend/pubspec.yaml | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Frontend/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart b/Frontend/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart index e801bc46..98cbca56 100644 --- a/Frontend/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart +++ b/Frontend/lib/mih_packages/mzansi_ai/package_tools/mih_ai_chat.dart @@ -119,8 +119,9 @@ class _MihAiChatState extends State { } } - void stopTTS() { + void stopTTS(MzansiAiProvider aiProvider) { _flutterTts.stop(); + aiProvider.setTTSstate(false); } Future initTts(MzansiAiProvider aiProvider) async { @@ -203,6 +204,11 @@ class _MihAiChatState extends State { builder: (BuildContext context, MzansiAiProvider aiProvider, Widget? child) { bool hasHistory = aiProvider.ollamaProvider.history.isNotEmpty; + String? lastMessage; + if (hasHistory) { + final histroyList = aiProvider.ollamaProvider.history.toList(); + lastMessage = histroyList[histroyList.length - 1].text; + } return Stack( children: [ @@ -220,7 +226,7 @@ class _MihAiChatState extends State { "What are the features of MIH?" ], ), - if (hasHistory) + if (hasHistory && lastMessage != null) Positioned( bottom: 80, left: 10, @@ -231,7 +237,7 @@ class _MihAiChatState extends State { if (!aiProvider.ttsOn) { speakLastMessage(aiProvider); } else { - stopTTS(); + stopTTS(aiProvider); } }, buttonColor: !aiProvider.ttsOn diff --git a/Frontend/pubspec.yaml b/Frontend/pubspec.yaml index 251d4ae1..c0aa09bd 100644 --- a/Frontend/pubspec.yaml +++ b/Frontend/pubspec.yaml @@ -1,7 +1,7 @@ name: mzansi_innovation_hub description: "" publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.2.3+111 +version: 1.2.3+112 # version: 1.1.1+97 #--- Updated version for upgrader package testing environment: