fluffychat/lib/pangea/translation/full_text_translation_response_model.dart
2025-11-06 12:08:20 -05:00

28 lines
757 B
Dart

import 'package:fluffychat/pangea/common/constants/model_keys.dart';
class FullTextTranslationResponseModel {
final List<String> translations;
final String source;
final String? deepL;
const FullTextTranslationResponseModel({
required this.translations,
required this.source,
required this.deepL,
});
factory FullTextTranslationResponseModel.fromJson(Map<String, dynamic> json) {
return FullTextTranslationResponseModel(
translations: (json["translations"] as Iterable)
.map<String>(
(e) => e,
)
.toList()
.cast<String>(),
source: json[ModelKey.srcLang],
deepL: json['deepl_res'],
);
}
String get bestTranslation => deepL ?? translations.first;
}