diff --git a/lib/main.dart b/lib/main.dart index 9f5e656bd..847b012b2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,7 +23,7 @@ void main() async { // #Pangea try { - await dotenv.load(fileName: ".env"); + await dotenv.load(fileName: ".env.local_choreo"); } catch (e) { Logs().e('Failed to load .env file', e); } diff --git a/lib/pangea/choreographer/controllers/span_data_controller.dart b/lib/pangea/choreographer/controllers/span_data_controller.dart index 24470454c..6f5be4f4f 100644 --- a/lib/pangea/choreographer/controllers/span_data_controller.dart +++ b/lib/pangea/choreographer/controllers/span_data_controller.dart @@ -81,7 +81,7 @@ class SpanDataController { choreographer.igc.igcTextData!.matches[matchIndex].match = (await response).span; } catch (err, s) { - ErrorHandler.logError(e: err, s: s); + ErrorHandler.logError(e: err, s: s, data: req.toJson()); } choreographer.setState(); diff --git a/lib/pangea/constants/match_rule_ids.dart b/lib/pangea/constants/match_rule_ids.dart index 7f3a924de..72fa8c6cc 100644 --- a/lib/pangea/constants/match_rule_ids.dart +++ b/lib/pangea/constants/match_rule_ids.dart @@ -1,5 +1,8 @@ class MatchRuleIds { static const interactiveTranslation = "interactive_translation"; + + /// note these are not currently being passed by the server + /// we may bring them back at some point static const tokenNeedsTranslation = "token_needs_translation"; static const tokenSpanNeedsTranslation = "token_span_needs_translation"; static const l1SpanAndGrammar = "l1_span_and_grammar"; diff --git a/lib/pangea/models/pangea_match_model.dart b/lib/pangea/models/pangea_match_model.dart index b27221e1a..5d2a74307 100644 --- a/lib/pangea/models/pangea_match_model.dart +++ b/lib/pangea/models/pangea_match_model.dart @@ -65,7 +65,8 @@ class PangeaMatch { bool get isITStart => match.rule?.id == MatchRuleIds.interactiveTranslation || - match.type.typeName == SpanDataTypeEnum.itStart; + [SpanDataTypeEnum.itStart, SpanDataTypeEnum.itStart.name] + .contains(match.type.typeName); bool get needsTranslation => match.rule?.id != null ? [ diff --git a/lib/pangea/models/span_data.dart b/lib/pangea/models/span_data.dart index 8b7aaddac..5722dc4e8 100644 --- a/lib/pangea/models/span_data.dart +++ b/lib/pangea/models/span_data.dart @@ -19,7 +19,6 @@ class SpanData { required this.choices, required this.offset, required this.length, - required this.context, required this.fullText, required this.type, required this.rule, @@ -37,8 +36,6 @@ class SpanData { .toList(), offset: json['offset'] as int, length: json['length'] as int, - context: - json['context'] != null ? Context.fromJson(json['context']) : null, fullText: json['sentence'] ?? json['full_text'] ?? json['fullText'] as String, type: SpanDataType.fromJson(json['type'] as Map), @@ -53,7 +50,6 @@ class SpanData { List? choices; int offset; int length; - Context? context; String fullText; SpanDataType type; Rule? rule; @@ -66,40 +62,12 @@ class SpanData { : null, 'offset': offset, 'length': length, - 'context': context?.toJson(), 'full_text': fullText, 'type': type.toJson(), 'rule': rule?.toJson(), }; } -class Context { - Context({ - required this.text, - required this.offset, - required this.length, - }); - - factory Context.fromJson(Map json) { - return Context( - text: json['text'] as String, - offset: json['offset'] as int, - length: json['length'] as int, - ); - } - - /// full text of the message - String text; - int offset; - int length; - - Map toJson() => { - 'text': text, - 'offset': offset, - 'length': length, - }; -} - class SpanChoice { String value; SpanChoiceType type; diff --git a/lib/pangea/repo/span_data_repo.dart b/lib/pangea/repo/span_data_repo.dart index 7073581a1..850411d17 100644 --- a/lib/pangea/repo/span_data_repo.dart +++ b/lib/pangea/repo/span_data_repo.dart @@ -119,7 +119,6 @@ final spanDataRepomockSpan = SpanData( length: 2, fullText: "This be a sample text", type: SpanDataType(typeName: SpanDataTypeEnum.correction), - context: null, choices: [SpanChoice(value: "is", type: SpanChoiceType.bestCorrection)], message: null, rule: null,