Closed hortigado closed 7 months ago
Hi i implement GEMINI.CHAT but not work i get the error 400
void fromText({required String query}) async { print(6666); loading = true; chats.add(Message(content: Content(role: 'user', parts: [Parts(text: query)]))); update(); textController.clear(); scrollToTheEnd(); try { List<Content> contents = []; for (var chat in chats) { contents.add(chat.content); } contents.add(Content(role: 'user', parts: [Parts(text: query)])); await gemini.chat(contents).then((value) { chats.add(Message(content: Content(role: 'model', parts: [Parts(text: value?.output)]))); }); } catch (e) { loading = false; chats.add(Message(content: Content(role: 'model', parts: [Parts(text: e.toString())]))); update(); scrollToTheEnd(); } }
My mistake i add two time contents.add(Content(role: 'user', parts: [Parts(text: query)]));
contents.add(Content(role: 'user', parts: [Parts(text: query)]));
Hi i implement GEMINI.CHAT but not work i get the error 400