Изменил промпт
This commit is contained in:
@@ -100,9 +100,14 @@ async def start_scenario(callback: CallbackQuery, state: FSMContext):
|
||||
# Формируем сообщение (перевод скрыт, доступен по кнопке)
|
||||
ai_msg = conversation_start.get('message', '')
|
||||
if learn_lang.lower() == 'ja':
|
||||
fg = conversation_start.get('furigana')
|
||||
if fg:
|
||||
ai_msg = f"{ai_msg} ({fg})"
|
||||
annotated = conversation_start.get('message_annotated')
|
||||
if annotated:
|
||||
ai_msg = annotated
|
||||
else:
|
||||
# Фолбэк к старому формату с общим furigana
|
||||
fg = conversation_start.get('furigana')
|
||||
if fg:
|
||||
ai_msg = f"{ai_msg} ({fg})"
|
||||
|
||||
text = (
|
||||
f"<b>{SCENARIOS[scenario].get(ui_lang, SCENARIOS[scenario]['ru'])}</b>\n\n"
|
||||
@@ -112,7 +117,21 @@ async def start_scenario(callback: CallbackQuery, state: FSMContext):
|
||||
)
|
||||
|
||||
for suggestion in conversation_start.get('suggestions', []):
|
||||
text += f"<span class=\"tg-spoiler\">• {suggestion}</span>\n"
|
||||
if isinstance(suggestion, dict):
|
||||
# Для японского стараемся брать learn_annotated
|
||||
if learn_lang.lower() == 'ja':
|
||||
learn_text = suggestion.get('learn_annotated') or suggestion.get('learn') or ''
|
||||
else:
|
||||
learn_text = suggestion.get('learn') or ''
|
||||
trans_text = suggestion.get('trans') or ''
|
||||
else:
|
||||
learn_text = str(suggestion)
|
||||
trans_text = ''
|
||||
# В спойлере — язык изучения, в скобках — перевод на язык интерфейса
|
||||
if trans_text:
|
||||
text += f"<span class=\"tg-spoiler\">• {learn_text}</span> ({trans_text})\n"
|
||||
else:
|
||||
text += f"<span class=\"tg-spoiler\">• {learn_text}</span>\n"
|
||||
|
||||
text += t(ui_lang, 'practice.write_or_stop')
|
||||
|
||||
@@ -242,9 +261,13 @@ async def handle_conversation(message: Message, state: FSMContext):
|
||||
# Ответ AI (с фуриганой для японского)
|
||||
resp = ai_response.get('response', '')
|
||||
if learn_lang2.lower() == 'ja':
|
||||
fg = ai_response.get('furigana')
|
||||
if fg:
|
||||
resp = f"{resp} ({fg})"
|
||||
annotated = ai_response.get('response_annotated')
|
||||
if annotated:
|
||||
resp = annotated
|
||||
else:
|
||||
fg = ai_response.get('furigana')
|
||||
if fg:
|
||||
resp = f"{resp} ({fg})"
|
||||
text += f"<b>AI:</b> {resp}\n\n"
|
||||
|
||||
# Подсказки
|
||||
@@ -252,7 +275,19 @@ async def handle_conversation(message: Message, state: FSMContext):
|
||||
if suggestions:
|
||||
text += t(ui_lang2, 'practice.hints') + "\n"
|
||||
for suggestion in suggestions[:3]:
|
||||
text += f"<span class=\"tg-spoiler\">• {suggestion}</span>\n"
|
||||
if isinstance(suggestion, dict):
|
||||
if learn_lang2.lower() == 'ja':
|
||||
learn_text = suggestion.get('learn_annotated') or suggestion.get('learn') or ''
|
||||
else:
|
||||
learn_text = suggestion.get('learn') or ''
|
||||
trans_text = suggestion.get('trans') or ''
|
||||
else:
|
||||
learn_text = str(suggestion)
|
||||
trans_text = ''
|
||||
if trans_text:
|
||||
text += f"<span class=\"tg-spoiler\">• {learn_text}</span> ({trans_text})\n"
|
||||
else:
|
||||
text += f"<span class=\"tg-spoiler\">• {learn_text}</span>\n"
|
||||
|
||||
# Сохраняем перевод под новым индексом
|
||||
translations = data.get('translations', {}) or {}
|
||||
|
||||
Reference in New Issue
Block a user