redraw the figure on follow-ups that only change the numbers; add a local fake OpenAI server
"What if 6 were 4?" has no shape word, so the diagram hint never went next to it and the tutor would answer without a new figure. When the previous user question in the conversation had one, a soft hint (redraw only if this continues that problem) and the same catalog sections now go along. tools/fake_openai.py stands in for GapGPT locally so the whole tutor path can be exercised without credit: 12 scripted answers across grades 6-12 went through streaming, block splitting, repair, storage, history and rendering in the real chat screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,27 @@ DIAGRAM_HINT = (
|
||||
)
|
||||
|
||||
|
||||
FOLLOW_UP_HINT = (
|
||||
'اگر این سوال ادامهی همان مسئلهی شکلدارِ قبلی است (عدد یا اندازه عوض شده، یا توضیحِ بیشتر '
|
||||
'خواسته)، در پایانِ پاسخ شکلِ تازه را با عددهای تازه در بلوکِ <diagram>…</diagram> بکش؛ '
|
||||
'اگر نیست، شکل نگذار.'
|
||||
)
|
||||
|
||||
|
||||
def follow_up_hint_for(question: str, previous: str) -> str:
|
||||
"""
|
||||
سوالِ ادامهای بیکلمهی شکلدار («اگه بهجای ۶ بذاریم ۴ چی؟») بعد از یک سوالِ شکلدار:
|
||||
یادآوریِ نرم (نه «این سوال شکل دارد») و بخشهای کاتالوگِ همان سوالِ قبلی. نرم است چون
|
||||
«مرسی» بعد از یک سوالِ هندسه نباید شکل بگیرد.
|
||||
"""
|
||||
if not previous or not (question or '').strip():
|
||||
return ''
|
||||
parts = [section for pattern, section in SECTIONS if pattern.search(previous)]
|
||||
if not parts:
|
||||
return ''
|
||||
return '\n'.join([FOLLOW_UP_HINT, _HEAD, *parts])
|
||||
|
||||
|
||||
def hint_for(question: str) -> str:
|
||||
"""یادآوری و فقط آن بخشهایی از کاتالوگ که به همین سوال میخورند؛ سوالِ بیشکل → ''."""
|
||||
text = question or ''
|
||||
|
||||
Reference in New Issue
Block a user