feat: 重做阅读找答案题与 AI 情境对话,并归拢本地识别、查词等既有改动
阅读"在对话里找到答案": - 16 道题全部重写,干扰项真实出现在对话里,靠说话人归属或否定句才能作答 - 选项按题目内容确定性打乱,答案不再固定排第一;听力环节同样处理 - 去掉超纲干扰项、重复题干,收紧自由作答匹配(过去单个字母也能判对) AI 情境对话: - 提示词区分"AI 这一句要做什么"与"学习者随后要完成什么",并下发已教词句清单 - JSON 只强制 reply,translation/feedback 可选;不再索要用不上的 slots/evidence - AI 不可用时页面明确提示当前回复来自内置示范脚本 - 删掉按 stage 下标猜中文翻译的兜底,避免译文与英文对不上 - 整课对话改用逐轮必需表达校验,替换"关键词沾边就算过";修正自由场景正则误伤 - 总结的"完成任务"按实际通过的轮次生成;模型点评只在结束页呈现一次 - 自由场景支持草稿续练(独立存储槽);修正回答轮数文案与永不解锁的场景标注 同时提交此前工作区中累积的改动:SenseVoice 本地识别、查词/句型解析卡、 复习与测评页调整等,并补充对话校验、选项分布和句子解析的测试。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,9 +78,9 @@ enum ContentSource { builtInOriginal, aiGenerated, importedReference }
|
||||
class DialogueAiResponse {
|
||||
const DialogueAiResponse({
|
||||
required this.reply,
|
||||
required this.slots,
|
||||
required this.evidence,
|
||||
required this.suggestsComplete,
|
||||
this.slots = const {},
|
||||
this.evidence = const [],
|
||||
this.suggestsComplete = false,
|
||||
this.translation,
|
||||
this.feedback,
|
||||
});
|
||||
@@ -210,6 +210,92 @@ class TemporaryLexiconEntry {
|
||||
final DateTime createdAt;
|
||||
}
|
||||
|
||||
/// Represents an extracted key phrase or vocabulary item within a sentence.
|
||||
class PhraseBreakdownItem {
|
||||
const PhraseBreakdownItem({
|
||||
required this.phrase,
|
||||
required this.meaning,
|
||||
this.ipa,
|
||||
this.usageNote,
|
||||
});
|
||||
|
||||
final String phrase;
|
||||
final String meaning;
|
||||
final String? ipa;
|
||||
final String? usageNote;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'phrase': phrase,
|
||||
'meaning': meaning,
|
||||
if (ipa != null) 'ipa': ipa,
|
||||
if (usageNote != null) 'usageNote': usageNote,
|
||||
};
|
||||
|
||||
factory PhraseBreakdownItem.fromJson(Map<String, dynamic> json) =>
|
||||
PhraseBreakdownItem(
|
||||
phrase: json['phrase'] as String? ?? '',
|
||||
meaning: json['meaning'] as String? ?? '',
|
||||
ipa: json['ipa'] as String?,
|
||||
usageNote: json['usageNote'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
/// Structured multi-dimensional analysis for a sentence or phrase, including
|
||||
/// translation, sentence pattern, grammar note, pronunciation tips, and extracted phrases.
|
||||
class SentenceAnalysisResult {
|
||||
const SentenceAnalysisResult({
|
||||
required this.originalText,
|
||||
required this.translation,
|
||||
this.sentencePattern,
|
||||
this.grammarNote,
|
||||
this.pronunciationTips,
|
||||
this.phrases = const [],
|
||||
this.provider = 'unknown',
|
||||
this.model = '',
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
final String originalText;
|
||||
final String translation;
|
||||
final String? sentencePattern;
|
||||
final String? grammarNote;
|
||||
final String? pronunciationTips;
|
||||
final List<PhraseBreakdownItem> phrases;
|
||||
final String provider;
|
||||
final String model;
|
||||
final DateTime createdAt;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'originalText': originalText,
|
||||
'translation': translation,
|
||||
if (sentencePattern != null) 'sentencePattern': sentencePattern,
|
||||
if (grammarNote != null) 'grammarNote': grammarNote,
|
||||
if (pronunciationTips != null) 'pronunciationTips': pronunciationTips,
|
||||
'phrases': phrases.map((p) => p.toJson()).toList(),
|
||||
'provider': provider,
|
||||
'model': model,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
};
|
||||
|
||||
factory SentenceAnalysisResult.fromJson(Map<String, dynamic> json) =>
|
||||
SentenceAnalysisResult(
|
||||
originalText: json['originalText'] as String? ?? '',
|
||||
translation: json['translation'] as String? ?? '',
|
||||
sentencePattern: json['sentencePattern'] as String?,
|
||||
grammarNote: json['grammarNote'] as String?,
|
||||
pronunciationTips: json['pronunciationTips'] as String?,
|
||||
phrases: (json['phrases'] as List<dynamic>? ?? const [])
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(PhraseBreakdownItem.fromJson)
|
||||
.toList(),
|
||||
provider: json['provider'] as String? ?? 'unknown',
|
||||
model: json['model'] as String? ?? '',
|
||||
createdAt: json['createdAt'] != null
|
||||
? DateTime.tryParse(json['createdAt'] as String) ?? DateTime.now()
|
||||
: DateTime.now(),
|
||||
);
|
||||
}
|
||||
|
||||
class ReviewItem {
|
||||
const ReviewItem({
|
||||
required this.id,
|
||||
@@ -329,9 +415,14 @@ class DialogueSummaryData {
|
||||
required this.completedTasks,
|
||||
required this.personalSentence,
|
||||
required this.usedHelp,
|
||||
this.improvement,
|
||||
});
|
||||
|
||||
final List<String> completedTasks;
|
||||
final String personalSentence;
|
||||
final bool usedHelp;
|
||||
|
||||
/// One improvement point collected during the dialogue and shown only at the
|
||||
/// end, per "对话中不逐句打断" in the conversation spec.
|
||||
final String? improvement;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user