QOL: Mzansi AI Chat Look and Feel & Startup question pt5

This commit is contained in:
2025-11-10 14:48:15 +02:00
parent a6f6cdaace
commit 9a8f157451
2 changed files with 10 additions and 4 deletions

View File

@@ -119,8 +119,9 @@ class _MihAiChatState extends State<MihAiChat> {
} }
} }
void stopTTS() { void stopTTS(MzansiAiProvider aiProvider) {
_flutterTts.stop(); _flutterTts.stop();
aiProvider.setTTSstate(false);
} }
Future<void> initTts(MzansiAiProvider aiProvider) async { Future<void> initTts(MzansiAiProvider aiProvider) async {
@@ -203,6 +204,11 @@ class _MihAiChatState extends State<MihAiChat> {
builder: builder:
(BuildContext context, MzansiAiProvider aiProvider, Widget? child) { (BuildContext context, MzansiAiProvider aiProvider, Widget? child) {
bool hasHistory = aiProvider.ollamaProvider.history.isNotEmpty; bool hasHistory = aiProvider.ollamaProvider.history.isNotEmpty;
String? lastMessage;
if (hasHistory) {
final histroyList = aiProvider.ollamaProvider.history.toList();
lastMessage = histroyList[histroyList.length - 1].text;
}
return Stack( return Stack(
children: [ children: [
@@ -220,7 +226,7 @@ class _MihAiChatState extends State<MihAiChat> {
"What are the features of MIH?" "What are the features of MIH?"
], ],
), ),
if (hasHistory) if (hasHistory && lastMessage != null)
Positioned( Positioned(
bottom: 80, bottom: 80,
left: 10, left: 10,
@@ -231,7 +237,7 @@ class _MihAiChatState extends State<MihAiChat> {
if (!aiProvider.ttsOn) { if (!aiProvider.ttsOn) {
speakLastMessage(aiProvider); speakLastMessage(aiProvider);
} else { } else {
stopTTS(); stopTTS(aiProvider);
} }
}, },
buttonColor: !aiProvider.ttsOn buttonColor: !aiProvider.ttsOn

View File

@@ -1,7 +1,7 @@
name: mzansi_innovation_hub name: mzansi_innovation_hub
description: "" description: ""
publish_to: 'none' # Remove this line if you wish to publish to pub.dev 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 # version: 1.1.1+97 #--- Updated version for upgrader package testing
environment: environment: