feat: improve AI dialogue evaluation and capability boundaries
This commit is contained in:
@@ -28,8 +28,9 @@ List<VocabularyItem> get courseLexiconEntries {
|
||||
...allLessons.expand((lesson) => lesson.vocabulary),
|
||||
];
|
||||
final seen = <String>{};
|
||||
_cachedEntries = entries.where((item) => seen.add(item.word.toLowerCase())).toList()
|
||||
..sort((a, b) => b.word.length.compareTo(a.word.length));
|
||||
_cachedEntries =
|
||||
entries.where((item) => seen.add(item.word.toLowerCase())).toList()
|
||||
..sort((a, b) => b.word.length.compareTo(a.word.length));
|
||||
return _cachedEntries!;
|
||||
}
|
||||
|
||||
@@ -385,12 +386,13 @@ class _LexiconLookupSheetState extends State<_LexiconLookupSheet> {
|
||||
sentenceAnalysisError = null;
|
||||
});
|
||||
|
||||
final result = await AiService.instance.analyzeSentence(
|
||||
provider: widget.state.aiProvider,
|
||||
endpoint: widget.state.aiEndpoint,
|
||||
model: widget.state.aiModel,
|
||||
text: text,
|
||||
);
|
||||
final result = await AiService.instance.capabilities.lexicon
|
||||
.analyzeSentence(
|
||||
provider: widget.state.aiProvider,
|
||||
endpoint: widget.state.aiEndpoint,
|
||||
model: widget.state.aiModel,
|
||||
text: text,
|
||||
);
|
||||
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
@@ -418,7 +420,7 @@ class _LexiconLookupSheetState extends State<_LexiconLookupSheet> {
|
||||
requestingTemporaryDefinition = true;
|
||||
temporaryError = null;
|
||||
});
|
||||
final definition = await AiService.instance.temporaryDefinition(
|
||||
final definition = await AiService.instance.capabilities.lexicon.define(
|
||||
provider: widget.state.aiProvider,
|
||||
endpoint: widget.state.aiEndpoint,
|
||||
model: widget.state.aiModel,
|
||||
|
||||
@@ -76,7 +76,7 @@ mixin VoiceAnswerMixin<T extends StatefulWidget> on State<T> {
|
||||
});
|
||||
if (path == null) return;
|
||||
final config = voiceState.aiConfig;
|
||||
final transcribed = await AiService.instance.transcribeAudio(
|
||||
final transcribed = await AiService.instance.capabilities.speech.transcribe(
|
||||
filePath: path,
|
||||
provider: config.provider,
|
||||
endpoint: config.endpoint,
|
||||
|
||||
Reference in New Issue
Block a user