clear cache on send and before getting language help, update span data hashcode

pull/1183/head
ggurdin 1 year ago
parent 83d7842e94
commit 01dc89f199

@ -55,6 +55,9 @@ class IgcController {
try { try {
if (choreographer.currentText.isEmpty) return clear(); if (choreographer.currentText.isEmpty) return clear();
// the error spans are going to be reloaded, so clear the cache
_clearCache();
debugPrint('getIGCTextData called with ${choreographer.currentText}'); debugPrint('getIGCTextData called with ${choreographer.currentText}');
debugPrint('getIGCTextData called with tokensOnly = $tokensOnly'); debugPrint('getIGCTextData called with tokensOnly = $tokensOnly');
@ -287,6 +290,7 @@ class IgcController {
clear() { clear() {
igcTextData = null; igcTextData = null;
_clearCache();
// Not sure why this is here // Not sure why this is here
// MatrixState.pAnyState.closeOverlay(); // MatrixState.pAnyState.closeOverlay();
} }

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:fluffychat/pangea/config/environment.dart'; import 'package:fluffychat/pangea/config/environment.dart';
import 'package:fluffychat/pangea/enum/span_choice_type.dart'; import 'package:fluffychat/pangea/enum/span_choice_type.dart';
import 'package:fluffychat/pangea/enum/span_data_type.dart'; import 'package:fluffychat/pangea/enum/span_data_type.dart';
@ -84,13 +85,16 @@ class SpanDetailsRepoReqAndRes {
if (other.userL2 != userL2) return false; if (other.userL2 != userL2) return false;
if (other.enableIT != enableIT) return false; if (other.enableIT != enableIT) return false;
if (other.enableIGC != enableIGC) return false; if (other.enableIGC != enableIGC) return false;
if (other.span.message != span.message) return false; if (other.span.choices
// if (other.span.shortMessage != span.shortMessage) return false; ?.firstWhere(
if (other.span.offset != span.offset) return false; (choice) => choice.type == SpanChoiceType.bestCorrection,
if (other.span.length != span.length) return false; )
if (other.span.fullText != span.fullText) return false; .value !=
// if (other.span.type != span.type) return false; span.choices
// if (other.span.context != span.context) return false; ?.firstWhere(
(choice) => choice.type == SpanChoiceType.bestCorrection,
)
.value) return false;
return true; return true;
} }
@ -103,13 +107,12 @@ class SpanDetailsRepoReqAndRes {
userL2.hashCode, userL2.hashCode,
enableIT.hashCode, enableIT.hashCode,
enableIGC.hashCode, enableIGC.hashCode,
span.message.hashCode, span.choices
// span.shortMessage.hashCode, ?.firstWhereOrNull(
span.offset.hashCode, (choice) => choice.type == SpanChoiceType.bestCorrection,
span.length.hashCode, )
span.fullText.hashCode, ?.value
// span.type.hashCode, .hashCode,
// span.context.hashCode,
]); ]);
} }
} }

Loading…
Cancel
Save