feat: improve AI dialogue evaluation and capability boundaries

This commit is contained in:
shen
2026-09-19 18:58:14 -07:00
parent 335d0304b1
commit 7306dc0f85
23 changed files with 1308 additions and 452 deletions
+69 -1
View File
@@ -26,6 +26,58 @@ enum EvidenceKind {
pending,
}
/// Local dialogue matching is intentionally tri-state. A natural English
/// reply that does not match a strict taught-language rule is unknown, not
/// automatically wrong.
enum LocalDialogueVerdict { accepted, rejected, uncertain }
enum DialogueAiVerdict { accepted, correctable, offTopic, uncertain }
enum DialogueValidationSource {
local,
ai,
localAndAi,
disagreement,
unavailable,
}
enum DialogueSupportLevel {
none,
validationOnly,
hint,
translation,
correction,
skipped,
}
/// The application-owned result of combining local rules with advisory AI.
/// Conversation progress and mastery evidence are deliberately separate.
class DialogueTurnDecision {
const DialogueTurnDecision({
required this.canAdvance,
required this.evidenceOutcome,
required this.validationSource,
required this.supportLevel,
this.feedback,
this.suggestion,
});
final bool canAdvance;
final EvidenceKind evidenceOutcome;
final DialogueValidationSource validationSource;
final DialogueSupportLevel supportLevel;
final String? feedback;
final String? suggestion;
bool get assisted => switch (supportLevel) {
DialogueSupportLevel.hint ||
DialogueSupportLevel.translation ||
DialogueSupportLevel.correction ||
DialogueSupportLevel.skipped => true,
_ => false,
};
}
class AttemptEvidence {
const AttemptEvidence({
required this.id,
@@ -117,7 +169,12 @@ class DialogueAiIntervention {
required this.accepted,
this.suggestion,
required this.explanation,
});
this.schemaVersion = 'dialogue-intervention-1',
this.turnId,
this.verdict = DialogueAiVerdict.uncertain,
bool? goalSatisfied,
this.reasonCode = 'unspecified',
}) : goalSatisfied = goalSatisfied ?? accepted;
/// Whether the learner's response is semantically acceptable for the turn.
final bool accepted;
@@ -127,6 +184,11 @@ class DialogueAiIntervention {
/// Encouraging, concise Chinese explanation of the situation and recommendation.
final String explanation;
final String schemaVersion;
final String? turnId;
final DialogueAiVerdict verdict;
final bool goalSatisfied;
final String reasonCode;
}
class AssessmentRecord {
@@ -169,11 +231,17 @@ class DialogueDraft {
required this.stage,
required this.turns,
required this.usedHelp,
this.currentTurnHintUsed = false,
this.currentTurnTranslationUsed = false,
this.currentTurnCorrectionUsed = false,
});
final String lessonId;
final int stage;
final List<DialogueTurn> turns;
final bool usedHelp;
final bool currentTurnHintUsed;
final bool currentTurnTranslationUsed;
final bool currentTurnCorrectionUsed;
}
class LessonSummary {