speech detect with gemini
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:mensaapp/modules/SpeechDetect.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -84,6 +85,20 @@ class DatabaseService {
|
||||
|
||||
Future<void> sendDataToSupabase(Map<String, dynamic> data) async {
|
||||
try {
|
||||
String llmPrompt = data["page1"]["t1"] + data["page2"]["t1"] + data["page3"]["t1"];
|
||||
|
||||
bool notNice = await SpeechDetect.prompt(llmPrompt);
|
||||
|
||||
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11");
|
||||
print(llmPrompt);
|
||||
print(notNice);
|
||||
|
||||
if (notNice) {
|
||||
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
print("not nice text cancel culturedXD");
|
||||
return;
|
||||
}
|
||||
|
||||
final response = await supabase.from('ratings_database').insert({"ratings": data});
|
||||
print("Antwort von Supabase: $response");
|
||||
|
||||
@@ -152,7 +167,7 @@ class DatabaseService {
|
||||
? null // Button deaktivieren
|
||||
: () async {
|
||||
Navigator.of(dialogContext).pop(); // Dialog schließen
|
||||
await sendDataToSupabase(data);
|
||||
sendDataToSupabase(data);
|
||||
Provider.of<EssenProvider>(context, listen: false).resetAllFields();
|
||||
Provider.of<ServiceProvider>(context, listen: false).resetAllFields();
|
||||
Provider.of<SpezielleErnaehrungProvider>(context, listen: false).resetAllFields();
|
||||
|
||||
Reference in New Issue
Block a user