draw a diagram in tutor answers: validated JSON from the model, rendered by the app; add the fourth companion tedi
The model ends a shape question with <diagram>{json}</diagram>; rag/services/diagram.py
splits it off before mathtext, validates it against a whitelist and stores it on
Message.diagram (ai_tutor.0006). It reaches the app in the SSE done event and in
conversation history. Prompt tutor-v6-diagrams; a hint next to the question (shape
words only) raised gpt-4.1-mini from 3/12 to 12/12 diagrams, 0/8 on arithmetic.
progress.0005 adds tedi (600 xp) to the companion catalog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
25
progress/migrations/0005_tedi_character.py
Normal file
25
progress/migrations/0005_tedi_character.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
همراهِ چهارم: «تدی»، شکلکِ زردِ پیشنمایشِ موبایل (mobile-preview/mascot-pack) که
|
||||
حالا در فرانت کنارِ سهیار است و همان شش حالتِ چهره را دارد.
|
||||
|
||||
نام و امتیازِ باز شدن تصمیمِ محصولیاند و از ادمین قابلِ تغییرند؛ ۶۰۰ یعنی بعد از
|
||||
پی (۳۰۰)، حدودِ ۶۰ جوابِ درست. get_or_create است، پس ویرایشِ بعدیِ ادمین را
|
||||
برنمیگرداند. فرانت فقط slugِ tedi را به این شکلک نگاشت میکند.
|
||||
"""
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create(apps, schema_editor):
|
||||
apps.get_model('progress', 'Character').objects.get_or_create(
|
||||
slug='tedi',
|
||||
defaults={'name': 'تدی', 'icon': 'tedi', 'unlock_xp': 600, 'order': 4},
|
||||
)
|
||||
|
||||
|
||||
def remove(apps, schema_editor):
|
||||
apps.get_model('progress', 'Character').objects.filter(slug='tedi').delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [('progress', '0004_seyar_characters')]
|
||||
operations = [migrations.RunPython(create, remove)]
|
||||
@@ -255,3 +255,14 @@ class RebuildLeaderboardCommandTests(TestCase):
|
||||
call_command('rebuild_leaderboard', '--period', 'all_time', '--dry-run', verbosity=0)
|
||||
|
||||
self.assertEqual(LeaderboardEntry.objects.count(), 0)
|
||||
|
||||
|
||||
class FourCompanionsCatalogTests(TestCase):
|
||||
"""migrationهای 0004 و 0005: سهیار و تدی همان چهار slugیاند که فرانت میشناسد."""
|
||||
|
||||
def test_catalog_has_the_four_companions_in_order(self):
|
||||
rows = list(
|
||||
Character.objects.filter(slug__in=['sigma', 'delta', 'pi', 'tedi'])
|
||||
.order_by('order').values_list('slug', 'unlock_xp')
|
||||
)
|
||||
self.assertEqual(rows, [('sigma', 0), ('delta', 100), ('pi', 300), ('tedi', 600)])
|
||||
|
||||
Reference in New Issue
Block a user