Upload app.py
Browse files
app.py
CHANGED
|
@@ -1632,6 +1632,11 @@ def plot_graph(problem: str, sympy_info: dict):
|
|
| 1632 |
plt.tight_layout()
|
| 1633 |
st.pyplot(fig)
|
| 1634 |
plt.close(fig) # free memory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1635 |
|
| 1636 |
except Exception:
|
| 1637 |
pass # silent fallback β never crash the app
|
|
@@ -1741,8 +1746,17 @@ def ask_ai(problem: str, sympy_info: dict, history: list) -> str:
|
|
| 1741 |
" β
**Final Answer:** $$\\boxed{answer}$$\n"
|
| 1742 |
" β Never skip this structure. Never merge steps. Never jump to answer without showing work.\n"
|
| 1743 |
" β If user says plot/draw/graph/sketch/visualize: a real graph renders automatically.\n"
|
| 1744 |
-
" Do NOT
|
| 1745 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1746 |
|
| 1747 |
"RULE 2 β LATEX (zero exceptions):\n"
|
| 1748 |
" - Inline math (inside a sentence): $expression$\n"
|
|
|
|
| 1632 |
plt.tight_layout()
|
| 1633 |
st.pyplot(fig)
|
| 1634 |
plt.close(fig) # free memory
|
| 1635 |
+
# Caption below graph
|
| 1636 |
+
deriv_label = " π f'(x)" if sympy_info.get("type") == "Derivative" else ""
|
| 1637 |
+
st.caption(f"π $y = {sp.latex(expr_sym)}$ "
|
| 1638 |
+
f"| x β [{x_min}, {x_max}]"
|
| 1639 |
+
f"{deriv_label}")
|
| 1640 |
|
| 1641 |
except Exception:
|
| 1642 |
pass # silent fallback β never crash the app
|
|
|
|
| 1746 |
" β
**Final Answer:** $$\\boxed{answer}$$\n"
|
| 1747 |
" β Never skip this structure. Never merge steps. Never jump to answer without showing work.\n"
|
| 1748 |
" β If user says plot/draw/graph/sketch/visualize: a real graph renders automatically.\n"
|
| 1749 |
+
" Do NOT draw ASCII art. Do NOT say you cannot draw.\n"
|
| 1750 |
+
" Give this SHORT response only β then graph renders below automatically:\n"
|
| 1751 |
+
" π **Function:** state f(x) clearly in LaTeX\n"
|
| 1752 |
+
" π **Key Features:**\n"
|
| 1753 |
+
" - Domain and range\n"
|
| 1754 |
+
" - x-intercepts: solve f(x)=0\n"
|
| 1755 |
+
" - y-intercept: f(0)\n"
|
| 1756 |
+
" - Turning points / vertex if any\n"
|
| 1757 |
+
" - Behavior as $x \\to \\pm\\infty$\n"
|
| 1758 |
+
" π **Graph** is shown below.\n"
|
| 1759 |
+
" Keep it SHORT β max 8 lines. No long paragraphs. No step-by-step for graph requests.\n\n"
|
| 1760 |
|
| 1761 |
"RULE 2 β LATEX (zero exceptions):\n"
|
| 1762 |
" - Inline math (inside a sentence): $expression$\n"
|