feat: мини-игры, premium подписка, улучшенные контексты
Мини-игры (/games): - Speed Round: 10 раундов, 10 секунд на ответ, очки за скорость - Match Pairs: 5 слов + 5 переводов, соединить пары Premium-функции: - Поля is_premium и premium_until для пользователей - AI режим проверки ответов (учитывает синонимы) - Batch проверка всех ответов одним запросом Улучшения: - Примеры использования для всех добавляемых слов - Разбиение переводов по запятой на отдельные записи - Полные предложения в контекстах (без ___) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -375,7 +375,7 @@ async def story_addword_callback(callback: CallbackQuery):
|
||||
|
||||
# Добавляем слово
|
||||
translation_lang = get_user_translation_lang(user)
|
||||
await VocabularyService.add_word(
|
||||
new_word = await VocabularyService.add_word(
|
||||
session=session,
|
||||
user_id=user.id,
|
||||
word_original=word,
|
||||
@@ -386,6 +386,16 @@ async def story_addword_callback(callback: CallbackQuery):
|
||||
difficulty_level=story.level,
|
||||
source=WordSource.IMPORT
|
||||
)
|
||||
|
||||
# Добавляем переводы в word_translations (разбиваем по запятой)
|
||||
await VocabularyService.add_translation_split(
|
||||
session=session,
|
||||
vocabulary_id=new_word.id,
|
||||
translation=translation,
|
||||
context=word_data.get('example') or word_data.get('context'),
|
||||
context_translation=word_data.get('example_translation') or word_data.get('context_translation'),
|
||||
is_primary=True
|
||||
)
|
||||
await session.commit()
|
||||
|
||||
await callback.answer(t(lang, 'story.word_added', word=word), show_alert=True)
|
||||
@@ -419,7 +429,7 @@ async def story_addall_callback(callback: CallbackQuery):
|
||||
)
|
||||
|
||||
if not existing:
|
||||
await VocabularyService.add_word(
|
||||
new_word = await VocabularyService.add_word(
|
||||
session=session,
|
||||
user_id=user.id,
|
||||
word_original=word,
|
||||
@@ -430,6 +440,16 @@ async def story_addall_callback(callback: CallbackQuery):
|
||||
difficulty_level=story.level,
|
||||
source=WordSource.IMPORT
|
||||
)
|
||||
|
||||
# Добавляем переводы в word_translations (разбиваем по запятой)
|
||||
await VocabularyService.add_translation_split(
|
||||
session=session,
|
||||
vocabulary_id=new_word.id,
|
||||
translation=translation,
|
||||
context=word_data.get('example') or word_data.get('context'),
|
||||
context_translation=word_data.get('example_translation') or word_data.get('context_translation'),
|
||||
is_primary=True
|
||||
)
|
||||
added += 1
|
||||
|
||||
await session.commit()
|
||||
|
||||
Reference in New Issue
Block a user