* docs: add PT v2 and token-info-feedback design docs - Add phonetic-transcription-v2-design.instructions.md (client PT v2 migration) - Add token-info-feedback-v2.instructions.md (client token feedback v2 migration) * fix: update applyTo path for token info feedback v2 migration * feat: Refactor phonetic transcription to v2 models and repository (in progress) * feat: PT v2 migration - tts_phoneme rename, v1 cleanup, disambiguation, TTS integration * feat: Update phonetic transcription v2 design document for endpoint changes and response structure * docs: fix stale _storageKeys claim in pt-v2 design doc * style: reformat PT v2 files with Dart 3.10 formatter (Flutter 3.38) * feat: add speakingRate to TTS request model (default 0.85) Passes speaking_rate to the choreo TTS endpoint. Default preserves current behavior; can be overridden for single-word playback later. * feat: use normal speed (1.0) for single-word TTS playback The 0.85x slowdown is helpful for full sentences but makes single words sound unnaturally slow. tts_controller._speakFromChoreo now sends speakingRate=1.0. Full-sentence TTS via pangea_message_event still defaults to 0.85. * style: clean up formatting and reduce line breaks in TtsController * fix: env goofiness * formatting, fix linter issues * don't return widgets from functions --------- Co-authored-by: ggurdin <ggurdin@gmail.com> Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com>
67 lines
2.3 KiB
Dart
67 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluffychat/l10n/l10n.dart';
|
|
import 'package:fluffychat/pangea/constructs/construct_identifier.dart';
|
|
import 'package:fluffychat/pangea/languages/language_model.dart';
|
|
import 'package:fluffychat/pangea/lemmas/lemma_info_response.dart';
|
|
import 'package:fluffychat/pangea/lemmas/lemma_meaning_builder.dart';
|
|
import 'package:fluffychat/pangea/phonetic_transcription/phonetic_transcription_builder.dart';
|
|
import 'package:fluffychat/pangea/phonetic_transcription/pt_v2_models.dart';
|
|
|
|
class TokenFeedbackButton extends StatelessWidget {
|
|
final LanguageModel textLanguage;
|
|
final ConstructIdentifier constructId;
|
|
final String text;
|
|
|
|
final Function(LemmaInfoResponse, PTRequest, PTResponse) onFlagTokenInfo;
|
|
final Map<String, dynamic> messageInfo;
|
|
|
|
const TokenFeedbackButton({
|
|
super.key,
|
|
required this.textLanguage,
|
|
required this.constructId,
|
|
required this.text,
|
|
required this.onFlagTokenInfo,
|
|
required this.messageInfo,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LemmaMeaningBuilder(
|
|
langCode: textLanguage.langCode,
|
|
constructId: constructId,
|
|
messageInfo: messageInfo,
|
|
builder: (context, lemmaController) {
|
|
return PhoneticTranscriptionBuilder(
|
|
textLanguage: textLanguage,
|
|
text: text,
|
|
builder: (context, transcriptController) {
|
|
final enabled =
|
|
(lemmaController.lemmaInfo != null ||
|
|
lemmaController.isError) &&
|
|
(transcriptController.ptResponse != null ||
|
|
transcriptController.isError);
|
|
|
|
final lemmaInfo =
|
|
lemmaController.lemmaInfo ?? LemmaInfoResponse.error;
|
|
|
|
return IconButton(
|
|
color: Theme.of(context).iconTheme.color,
|
|
icon: const Icon(Icons.flag_outlined),
|
|
onPressed: enabled && transcriptController.ptResponse != null
|
|
? () {
|
|
onFlagTokenInfo(
|
|
lemmaInfo,
|
|
transcriptController.ptRequest,
|
|
transcriptController.ptResponse!,
|
|
);
|
|
}
|
|
: null,
|
|
tooltip: enabled ? L10n.of(context).reportWordIssueTooltip : null,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|