Skip to content

Commit

Permalink
Adding LaTeX Support
Browse files Browse the repository at this point in the history
  • Loading branch information
ArhanAnsari committed Nov 26, 2024
1 parent 7ef0dfc commit a2a258c
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,31 @@ export default function Dashboard() {
<h2 className="text-lg md:text-xl font-semibold mb-4">Previously Generated Content</h2>
{previousContent.length ? (
<div className="flex flex-col space-y-4">
{previousContent.map((content) => (
<div key={content.id} className="border p-4 rounded break-words overflow-x-auto">
<h3 className="font-semibold">{content.question}</h3>
<MarkdownRenderer content={content.response} />
<p className="text-sm text-gray-500">
Generated on {new Date(content.createdAt).toLocaleString()}
</p>
</div>
))}
{previousContent.map((content) => {
const isMathContent =
content.response.trim().startsWith("$$") &&
content.response.trim().endsWith("$$");

return (
<div
key={content.id}
className="border p-4 rounded break-words overflow-x-auto"
>
<h3 className="font-semibold">{content.question}</h3>
{isMathContent ? (
<MathRenderer
content={content.response.slice(2, -2).trim()}
displayMode={true}
/>
) : (
<MarkdownRenderer content={content.response} />
)}
<p className="text-sm text-gray-500">
Generated on {new Date(content.createdAt).toLocaleString()}
</p>
</div>
);
})}
</div>
) : (
<p>No previous content found.</p>
Expand Down

0 comments on commit a2a258c

Please sign in to comment.