fix: AI 复习变式请求字段与校验一致;转写后删除不保留的录音
- generateReviewVariant 的指令要求 stimulus/answer/acceptedAnswers 等字段, 而 decodeGeneratedReviewVariant 只接受 schemaVersion、variantId、 targetItemId、prompt、expectedAnswer 五个字段,导致 AI 变式始终校验失败。 现在指令只要求这五个字段,并补充了请求与解码一致性的测试。 - finishVoiceInput(keepAudio: false) 转写完成(或页面已关闭)后删除音频, 补练页和测评页的语音输入不再在本机残留录音文件。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,7 @@ mixin VoiceAnswerMixin<T extends StatefulWidget> on State<T> {
|
||||
/// [onTranscript] runs inside `setState` with the trimmed, non-empty text.
|
||||
/// [afterTranscribe] runs once transcription has finished, whether or not
|
||||
/// anything was recognized. With [keepAudio] the answer audio also becomes
|
||||
/// the playback [recordingPath].
|
||||
/// the playback [recordingPath]; otherwise it is deleted once transcribed.
|
||||
Future<void> finishVoiceInput({
|
||||
required void Function(String text) onTranscript,
|
||||
VoidCallback? afterTranscribe,
|
||||
@@ -64,7 +64,10 @@ mixin VoiceAnswerMixin<T extends StatefulWidget> on State<T> {
|
||||
String noSpeech = noSpeechMessage,
|
||||
}) async {
|
||||
final path = await VoiceService.instance.stopRecording();
|
||||
if (!mounted) return;
|
||||
if (!mounted) {
|
||||
if (!keepAudio) await VoiceService.instance.deleteRecording(path);
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
aiVoiceRecording = false;
|
||||
listening = false;
|
||||
@@ -79,6 +82,8 @@ mixin VoiceAnswerMixin<T extends StatefulWidget> on State<T> {
|
||||
endpoint: config.endpoint,
|
||||
model: config.model,
|
||||
);
|
||||
// Without [keepAudio] the audio only served transcription.
|
||||
if (!keepAudio) await VoiceService.instance.deleteRecording(path);
|
||||
if (!mounted) return;
|
||||
final text = transcribed?.trim() ?? '';
|
||||
setState(() {
|
||||
|
||||
Reference in New Issue
Block a user