Skip to content

Commit c951dcf

Browse files
committed
fix on chat uuid this removes the error
1 parent 5ab7b6a commit c951dcf

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

app/lib/presentation/ui/pages/geminichat/geminichat_page.dart

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:firebase_vertexai/firebase_vertexai.dart';
2-
import 'package:flutter/cupertino.dart';
32
import 'package:flutter/material.dart';
43
import 'package:flutter_chat_ui/flutter_chat_ui.dart';
54
import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
@@ -25,9 +24,8 @@ class _GeminiChatState extends State<GeminiChatPage> {
2524

2625
model = FirebaseVertexAI.instance.generativeModel(
2726
model: 'gemini-1.5-pro',
28-
generationConfig: GenerationConfig(
29-
temperature: 0, responseMimeType: 'text/plain'));
30-
27+
generationConfig:
28+
GenerationConfig(temperature: 0, responseMimeType: 'text/plain'));
3129
}
3230

3331
void _addMessage(types.Message message) {
@@ -37,7 +35,6 @@ class _GeminiChatState extends State<GeminiChatPage> {
3735
}
3836

3937
void _handleSendPressed(types.PartialText text) {
40-
4138
final textMessage = types.TextMessage(
4239
author: _user,
4340
text: text.text,
@@ -50,7 +47,6 @@ class _GeminiChatState extends State<GeminiChatPage> {
5047
}
5148

5249
Future<void> _sendVertexMessage(types.PartialText meesageToSend) async {
53-
5450
_loading = true;
5551

5652
final messageContent = Content.multi(
@@ -65,9 +61,7 @@ class _GeminiChatState extends State<GeminiChatPage> {
6561
print("RESPONSE FROM API");
6662
print(text);
6763

68-
69-
if (text != null ) {
70-
64+
if (text != null) {
7165
final textMessage = types.TextMessage(
7266
author: _agent,
7367
text: text,
@@ -77,23 +71,20 @@ class _GeminiChatState extends State<GeminiChatPage> {
7771
_addMessage(textMessage);
7872
}
7973

80-
8174
setState(() {
8275
_loading = false;
8376
});
84-
85-
8677
}
8778

8879
@override
8980
Widget build(BuildContext context) => Scaffold(
90-
body: Chat(
91-
showUserAvatars: true,
92-
showUserNames: true,
93-
typingIndicatorOptions: TypingIndicatorOptions(typingUsers: _loading ? [_agent] : []),
94-
messages: _messages,
95-
onSendPressed: _handleSendPressed,
96-
user: _user
97-
),
98-
) ;
81+
body: Chat(
82+
showUserAvatars: true,
83+
showUserNames: true,
84+
typingIndicatorOptions:
85+
TypingIndicatorOptions(typingUsers: _loading ? [_agent] : []),
86+
messages: _messages,
87+
onSendPressed: _handleSendPressed,
88+
user: _user),
89+
);
9990
}

0 commit comments

Comments
 (0)