Merge branch 'main' into usability-5-14

This commit is contained in:
ggurdin 2024-05-15 15:06:04 -04:00
commit 48445a5bf9
10 changed files with 284 additions and 139 deletions

View file

@ -2504,7 +2504,7 @@
"type": "text",
"placeholders": {}
},
"interactiveTranslatorAllowedDesc": "Students can choose whether to use translation assistance in space group chats in Settings > Learning Settings.",
"interactiveTranslatorAllowedDesc": "Students can choose whether to use translation assistance in space group chats in Main Menu > My Learning Settings.",
"@interactiveTranslatorAllowedDesc": {
"type": "text",
"placeholders": {}
@ -2984,9 +2984,9 @@
"errorDisableLanguageAssistanceClassDesc": "Translation assistance and grammar assistance are turned off for the space that this chat is in.",
"itIsDisabled": "Interactive Translation is disabled",
"igcIsDisabled": "Interactive Grammar Checking is disabled",
"goToLearningSettings": "Go to Learning Settings",
"goToLearningSettings": "Go to My Learning Settings",
"error405Title": "Languages not set",
"error405Desc": "Please set your languages in Settings > Learning Settings",
"error405Desc": "Please set your languages in Main Menu > My Learning Settings.",
"loginOrSignup": "Sign in with",
"@loginOrSignup": {
"type": "text",
@ -3049,7 +3049,7 @@
"type": "text",
"placeholders": {}
},
"learningSettings": "Learning Settings",
"learningSettings": "My Learning Settings",
"classNameRequired": "Please enter a space name",
"@classNameRequired": {
"type": "text",
@ -3945,5 +3945,6 @@
"accuracy": "Accuracy",
"points": "Points",
"noPaymentInfo": "No payment info necessary!",
"updatePhoneOS": "You may need to update your device's OS version."
}
"updatePhoneOS": "You may need to update your device's OS version.",
"wordsPerMinute": "Words per minute"
}

View file

@ -4587,5 +4587,52 @@
"refresh": "Actualizar",
"joinToView": "Únete a esta sala para ver los detalles",
"autoPlayTitle": "Reproducción automática de mensajes",
"autoPlayDesc": "Cuando está activado, el audio de texto a voz de los mensajes se reproducirá automáticamente cuando se seleccione."
}
"autoPlayDesc": "Cuando está activado, el audio de texto a voz de los mensajes se reproducirá automáticamente cuando se seleccione.",
"presenceStyle": "Presencia:",
"presencesToggle": "Mostrar mensajes de estado de otros usuarios",
"writeAMessageFlag": "Escribe un mensaje en {l1flag} o {l2flag}...",
"@writeAMessageFlag": {
"type": "text",
"placeholders": {
"l1flag": {},
"l2flag": {}
}
},
"youInvitedToBy": "📩 Has sido invitado a través de un enlace a:\n{alias}",
"@youInvitedToBy": {
"placeholders": {
"alias": {}
}
},
"hidePresences": "¿Ocultar la lista de estados?",
"sendReadReceipts": "Enviar recibos de lectura",
"sendTypingNotificationsDescription": "Los demás participantes en un chat pueden ver cuándo estás escribiendo un nuevo mensaje.",
"sendReadReceiptsDescription": "Los demás participantes en un chat pueden ver cuándo has leído un mensaje.",
"formattedMessages": "Mensajes con formato",
"formattedMessagesDescription": "Mostrar contenido de mensajes enriquecido como texto en negrita utilizando markdown.",
"verifyOtherUser": "🔐 Verificar otro usuario",
"verifyOtherUserDescription": "Si verificas a otro usuario, puedes estar seguro de saber a quién estás escribiendo realmente. 💪\n\nCuando inicies una verificación, tú y el otro usuario veréis una ventana emergente en la aplicación. Allí veréis una serie de emojis o números que tendréis que comparar entre vosotros.\n\nLa mejor forma de hacerlo es quedar o iniciar una videollamada. 👭",
"verifyOtherDevice": "🔐 Verificar otro dispositivo",
"verifyOtherDeviceDescription": "Cuando verificas otro dispositivo, esos dispositivos pueden intercambiar claves, aumentando tu seguridad general. 💪 Cuando inicies una verificación, aparecerá una ventana emergente en la app de ambos dispositivos. Allí verás entonces una serie de emojis o números que tienes que comparar entre sí. Lo mejor es que tengas ambos dispositivos a mano antes de iniciar la verificación. 🤳",
"transparent": "Transparente",
"incomingMessages": "Mensajes entrantes",
"stickers": "Pegatinas",
"commandHint_ignore": "Ignorar el ID de matriz dado",
"commandHint_unignore": "Designorar el ID de matriz dado",
"unreadChatsInApp": "{appname}: {unread} chats no leídos",
"@unreadChatsInApp": {
"type": "text",
"placeholders": {
"appname": {},
"unread": {}
}
},
"messageAnalytics": "Análisis de mensajes",
"words": "Palabras",
"score": "Puntuación",
"accuracy": "Precisión",
"points": "Puntos",
"noPaymentInfo": "No se necesitan datos de pago.",
"updatePhoneOS": "Puede que necesites actualizar la versión del sistema operativo de tu dispositivo.",
"wordsPerMinute": "Palabras por minuto"
}

View file

@ -29,6 +29,8 @@ abstract class AppConfig {
static const Color primaryColorLight = Color(0xFFDBC9FF);
static const Color secondaryColor = Color(0xFF41a2bc);
static const Color activeToggleColor = Color(0xFF33D057);
static const Color success = Color(0xFF33D057);
static const Color warning = Color.fromARGB(255, 210, 124, 12);
// static String _privacyUrl =
// 'https://gitlab.com/famedly/fluffychat/-/blob/main/PRIVACY.md';
static String _privacyUrl = "https://www.pangeachat.com/privacy";

View file

@ -154,6 +154,18 @@ class ClientChooserButton extends StatelessWidget {
],
),
),
// #Pangea
PopupMenuItem(
value: SettingsAction.learning,
child: Row(
children: [
const Icon(Icons.psychology_outlined),
const SizedBox(width: 18),
Expanded(child: Text(L10n.of(context)!.learningSettings)),
],
),
),
// Pangea#
PopupMenuItem(
value: SettingsAction.settings,
child: Row(
@ -382,6 +394,9 @@ class ClientChooserButton extends StatelessWidget {
case SettingsAction.setStatus:
controller.setStatus();
// #Pangea
case SettingsAction.learning:
context.go('/rooms/settings/learning');
break;
case SettingsAction.newClass:
context.go('/rooms/newspace');
break;
@ -493,6 +508,7 @@ enum SettingsAction {
settings,
archive,
// #Pangea
learning,
joinWithClassCode,
classAnalytics,
myAnalytics,

View file

@ -181,14 +181,6 @@ class SettingsView extends StatelessWidget {
trailing: const Icon(Icons.chevron_right_outlined),
),
// #Pangea
ListTile(
leading: const Icon(Icons.account_circle_outlined),
title: Text(L10n.of(context)!.learningSettings),
onTap: () => context.go('/rooms/settings/learning'),
trailing: const Icon(
Icons.chevron_right_outlined,
),
),
ListTile(
leading: const Icon(Icons.account_circle_outlined),
title: Text(L10n.of(context)!.subscriptionManagement),

View file

@ -74,18 +74,21 @@ class SpeechToTextController {
}
debugPrint('Saving transcript as matrix event');
requestModel.audioEvent?.room.sendPangeaEvent(
content: PangeaRepresentation(
langCode: response.langCode,
text: response.transcript.text,
originalSent: false,
originalWritten: false,
speechToText: response,
).toJson(),
parentEventId: requestModel.audioEvent!.eventId,
type: PangeaEventTypes.representation,
);
debugPrint('Transcript saved as matrix event');
requestModel.audioEvent?.room
.sendPangeaEvent(
content: PangeaRepresentation(
langCode: response.langCode,
text: response.transcript.text,
originalSent: false,
originalWritten: false,
speechToText: response,
).toJson(),
parentEventId: requestModel.audioEvent!.eventId,
type: PangeaEventTypes.representation,
)
.then(
(_) => debugPrint('Transcript saved as matrix event'),
);
return Future.value(null);
}

View file

@ -60,7 +60,7 @@ class PangeaToken {
static const String _lemmaKey = ModelKey.lemma;
Map<String, dynamic> toJson() => {
_textKey: text,
_textKey: text.toJson(),
_hasInfoKey: hasInfo,
_lemmaKey: lemmas.map((e) => e.toJson()).toList(),
};

View file

@ -1,11 +1,14 @@
import 'dart:convert';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/enum/audio_encoding_enum.dart';
import 'package:fluffychat/pangea/models/pangea_token_model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';
const int THRESHOLD_FOR_GREEN = 80;
class SpeechToTextAudioConfigModel {
final AudioEncodingEnum encoding;
final int sampleRateHertz;
@ -93,13 +96,10 @@ class STTToken {
? Colors.white
: Colors.black);
}
if (confidence! > 80) {
return const Color.fromARGB(255, 0, 152, 0);
if (confidence! > THRESHOLD_FOR_GREEN) {
return AppConfig.success;
}
if (confidence! > 50) {
return const Color.fromARGB(255, 184, 142, 43);
}
return Colors.red;
return AppConfig.warning;
}
factory STTToken.fromJson(Map<String, dynamic> json) {
@ -117,7 +117,7 @@ class STTToken {
}
Map<String, dynamic> toJson() => {
"token": token,
"token": token.toJson(),
"start_time": startTime?.inMilliseconds,
"end_time": endTime?.inMilliseconds,
"confidence": confidence,
@ -148,6 +148,7 @@ class STTToken {
class Transcript {
final String text;
final int confidence;
final int wordsPerMinute;
final List<STTToken> sttTokens;
final String langCode;
@ -156,6 +157,7 @@ class Transcript {
required this.confidence,
required this.sttTokens,
required this.langCode,
required this.wordsPerMinute,
});
factory Transcript.fromJson(Map<String, dynamic> json) => Transcript(
@ -167,6 +169,7 @@ class Transcript {
.map((e) => STTToken.fromJson(e))
.toList(),
langCode: json['lang_code'],
wordsPerMinute: json['words_per_minute'].round(),
);
Map<String, dynamic> toJson() => {
@ -174,7 +177,15 @@ class Transcript {
"confidence": confidence,
"stt_tokens": sttTokens.map((e) => e.toJson()).toList(),
"lang_code": langCode,
"words_per_minute": wordsPerMinute,
};
Color color(BuildContext context) {
if (confidence > THRESHOLD_FOR_GREEN) {
return AppConfig.success;
}
return AppConfig.warning;
}
}
class SpeechToTextResult {

View file

@ -1,9 +1,13 @@
import 'dart:developer';
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
import 'package:fluffychat/pangea/models/speech_to_text_models.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/pangea/widgets/chat/toolbar_content_loading_indicator.dart';
import 'package:fluffychat/pangea/widgets/common/icon_number_widget.dart';
import 'package:fluffychat/pangea/widgets/igc/card_error_widget.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -41,27 +45,27 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
// look for transcription in message event
// if not found, call API to transcribe audio
Future<void> getSpeechToText() async {
// try {
if (l1Code == null || l2Code == null) {
throw Exception('Language selection not found');
}
speechToTextResponse ??=
await widget.messageEvent.getSpeechToText(l1Code!, l2Code!);
try {
if (l1Code == null || l2Code == null) {
throw Exception('Language selection not found');
}
speechToTextResponse ??=
await widget.messageEvent.getSpeechToText(l1Code!, l2Code!);
debugPrint(
'Speech to text transcript: ${speechToTextResponse?.transcript.text}',
);
// } catch (e, s) {
// debugger(when: kDebugMode);
// error = e;
// ErrorHandler.logError(
// e: e,
// s: s,
// data: widget.messageEvent.event.content,
// );
// } finally {
setState(() => _fetchingTranscription = false);
// }
debugPrint(
'Speech to text transcript: ${speechToTextResponse?.transcript.text}',
);
} catch (e, s) {
debugger(when: kDebugMode);
error = e;
ErrorHandler.logError(
e: e,
s: s,
data: widget.messageEvent.event.content,
);
} finally {
setState(() => _fetchingTranscription = false);
}
}
TextSpan _buildTranscriptText(BuildContext context) {
@ -133,6 +137,9 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
getSpeechToText();
}
String? get wordsPerMinuteString =>
speechToTextResponse?.transcript.wordsPerMinute?.toString();
@override
Widget build(BuildContext context) {
if (_fetchingTranscription) {
@ -158,11 +165,11 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconNumberWidget(
icon: Icons.abc,
number: (selectedToken == null ? words : 1).toString(),
toolTip: L10n.of(context)!.words,
),
// IconNumberWidget(
// icon: Icons.abc,
// number: (selectedToken == null ? words : 1).toString(),
// toolTip: L10n.of(context)!.words,
// ),
IconNumberWidget(
icon: Symbols.target,
number:
@ -171,8 +178,9 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
),
IconNumberWidget(
icon: Icons.speed,
number: (selectedToken?.confidence ?? total).toString(),
toolTip: L10n.of(context)!.points,
number:
wordsPerMinuteString != null ? "$wordsPerMinuteString" : "??",
toolTip: L10n.of(context)!.wordsPerMinute,
),
],
),

View file

@ -820,7 +820,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"be": [
@ -2239,7 +2241,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"bn": [
@ -3120,7 +3124,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"bo": [
@ -4001,7 +4007,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ca": [
@ -4882,7 +4890,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"cs": [
@ -5763,7 +5773,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"de": [
@ -6591,7 +6603,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"el": [
@ -7472,7 +7486,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"eo": [
@ -8353,36 +8369,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
],
"es": [
"presenceStyle",
"presencesToggle",
"writeAMessageFlag",
"youInvitedToBy",
"hidePresences",
"sendReadReceipts",
"sendTypingNotificationsDescription",
"sendReadReceiptsDescription",
"formattedMessages",
"formattedMessagesDescription",
"verifyOtherUser",
"verifyOtherUserDescription",
"verifyOtherDevice",
"verifyOtherDeviceDescription",
"transparent",
"incomingMessages",
"stickers",
"commandHint_ignore",
"commandHint_unignore",
"unreadChatsInApp",
"messageAnalytics",
"words",
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"et": [
@ -9206,7 +9195,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"eu": [
@ -10030,7 +10021,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"fa": [
@ -10911,7 +10904,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"fi": [
@ -11792,7 +11787,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"fr": [
@ -12673,7 +12670,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ga": [
@ -13554,7 +13553,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"gl": [
@ -14378,7 +14379,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"he": [
@ -15259,7 +15262,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"hi": [
@ -16140,7 +16145,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"hr": [
@ -17008,7 +17015,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"hu": [
@ -17889,7 +17898,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ia": [
@ -19294,7 +19305,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"id": [
@ -20175,7 +20188,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ie": [
@ -21056,7 +21071,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"it": [
@ -21922,7 +21939,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ja": [
@ -22803,7 +22822,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ko": [
@ -23684,7 +23705,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"lt": [
@ -24565,7 +24588,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"lv": [
@ -25446,7 +25471,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"nb": [
@ -26327,7 +26354,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"nl": [
@ -27208,7 +27237,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"pl": [
@ -28089,7 +28120,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"pt": [
@ -28970,7 +29003,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"pt_BR": [
@ -29820,7 +29855,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"pt_PT": [
@ -30701,7 +30738,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ro": [
@ -31582,7 +31621,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ru": [
@ -32406,7 +32447,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"sk": [
@ -33287,7 +33330,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"sl": [
@ -34168,7 +34213,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"sr": [
@ -35049,7 +35096,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"sv": [
@ -35895,7 +35944,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"ta": [
@ -36776,7 +36827,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"th": [
@ -37657,7 +37710,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"tr": [
@ -38523,7 +38578,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"uk": [
@ -39347,7 +39404,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"vi": [
@ -40228,7 +40287,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"zh": [
@ -41052,7 +41113,9 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
],
"zh_Hant": [
@ -41933,6 +41996,8 @@
"score",
"accuracy",
"points",
"noPaymentInfo"
"noPaymentInfo",
"updatePhoneOS",
"wordsPerMinute"
]
}