feat(learn): asking an assistant in a conversation
ConversationCubit asks the assistant chosen each question with the conversation so far (ADR 0021, D47), answers the model's lookups on the device within the question's scope, eight rounds at most, the ninth told to answer with what it found and the tenth ending the turn, every call given its result so the conversation can still be sent; and keeps each turn, sealed, once it is answered (D51): nothing of a question stopped or failed, which can be asked again, and nothing at all on a device that can't seal, which still answers (D52). The question and the parts sent along are texts of their own, so a kept turn shows as it was asked, with its lookups and its answer (TurnView). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
df89ff9998
commit
a125215942
1 changed files with 1250 additions and 124 deletions
|
|
@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||
import 'package:halkyon_learn_flutter/src/core/content/rich_content.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/assistant/data/assistant_lookups.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/assistant/model/assistant_conversation.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/assistant/model/assistant_lookup.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/model/card.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/model/card_content.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/note/model/note.dart';
|
||||
|
|
@ -201,6 +202,53 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
test('names the studyset asked on, or its top, only within reach '
|
||||
'(D8)', () async {
|
||||
Future<String?> title(AssistantScope scope) => lookups.titleOf(scope);
|
||||
|
||||
expect(
|
||||
await title(
|
||||
const AssistantScope(
|
||||
reach: AssistantReach.studyset,
|
||||
studysetId: 'verbs',
|
||||
),
|
||||
),
|
||||
'Verbs',
|
||||
);
|
||||
expect(
|
||||
await title(
|
||||
const AssistantScope(reach: AssistantReach.tree, studysetId: 'verbs'),
|
||||
),
|
||||
'Japanese',
|
||||
);
|
||||
expect(
|
||||
await title(
|
||||
const AssistantScope(
|
||||
reach: AssistantReach.studyset,
|
||||
studysetId: 'kanji',
|
||||
),
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
expect(
|
||||
await title(
|
||||
const AssistantScope(
|
||||
reach: AssistantReach.studyset,
|
||||
studysetId: 'kanji',
|
||||
includePrivate: true,
|
||||
),
|
||||
),
|
||||
'Kanji',
|
||||
);
|
||||
expect(await title(const AssistantScope(studysetId: 'verbs')), isNull);
|
||||
expect(
|
||||
await title(
|
||||
const AssistantScope(reach: AssistantReach.library, studysetId: 'ja'),
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test('finds cards by any of their parts, within the scope only', () async {
|
||||
final json = await _answer(
|
||||
lookups,
|
||||
|
|
|
|||
Loading…
Reference in a new issue