feat: Random.org dice and daily word matrix, interpreter voices, curated lexicon

Wire cleromancy rolls and the once-per-UTC-day 000-999 word shuffle to RANDOM.ORG JSON-RPC, with a local CSPRNG fallback. Add settings for interpreter personas and a cleaner default oracle prompt. Replace proper names and bureaucratic filler in the 1000-word lexicon with sacred symbols.
This commit is contained in:
2026-09-08 13:46:11 +05:00
parent fbf04d90db
commit 7f91366201
26 changed files with 8904 additions and 7077 deletions
+55
View File
@@ -0,0 +1,55 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:words999/models/history_entry_model.dart';
import 'package:words999/models/interpreter_persona.dart';
import 'package:words999/services/ai_oracle_service.dart';
import 'package:words999/services/settings_repository.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() async {
SharedPreferences.setMockInitialValues({});
await SettingsRepository().init();
await SettingsRepository().setPersonaId(InterpreterPersona.defaultId);
await SettingsRepository().setRandomOrgApiKey('');
});
test('unknown persona id falls back to clear oracle', () {
expect(InterpreterPersona.byId('nope').id, InterpreterPersona.clear.id);
});
test('settings persist the selected interpreter voice', () async {
await SettingsRepository().setPersonaId(InterpreterPersona.orc.id);
expect(SettingsRepository().persona.id, InterpreterPersona.orc.id);
SharedPreferences.setMockInitialValues({
'oracle_interpreter_persona_v1': InterpreterPersona.techpriest.id,
});
await SettingsRepository().init();
expect(SettingsRepository().persona.title, 'Техножрец');
});
test('interpretation prompt uses the selected voice and asks for a concrete step', () async {
await SettingsRepository().setPersonaId(InterpreterPersona.analyst.id);
final messages = AiOracleService().buildInterpretationMessages(
question: 'Стоит ли уходить?',
words: const [
SessionWord(
word: 'огонь',
sessionNumber: 0,
partOfSpeech: 'существительное',
category: 'Образ / Архетип',
symbolicMeaning: 'Очищающее пламя',
),
],
);
expect(messages.first.role.name, 'system');
expect(messages.first.content, contains('психоаналитик'));
expect(messages.last.content, contains('проверяемый шаг'));
expect(messages.last.content, contains('ОГОНЬ'));
expect(messages.last.content, contains('Стоит ли уходить?'));
expect(messages.first.content.toLowerCase(), isNot(contains('голос самой вечности')));
});
}