assistant markdown update

This commit is contained in:
Logan
2026-06-21 14:38:53 -04:00
parent 21268ab477
commit 21d15d0426
3 changed files with 22 additions and 2 deletions
+19 -1
View File
@@ -1,6 +1,7 @@
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
import ReactMarkdown from "react-markdown";
import { useParams, useRouter } from "next/navigation";
import { useAuth } from "@/components/AuthProvider";
import { c2api } from "@/lib/c2api";
@@ -614,7 +615,24 @@ function AssistantPanel({
: "bg-gray-800 text-gray-200"
}`}
>
{msg.content}
{msg.role === "user" ? msg.content : (
<ReactMarkdown
components={{
p: ({ children }) => <p className="mb-1 last:mb-0">{children}</p>,
ul: ({ children }) => <ul className="list-disc list-inside space-y-0.5 my-1">{children}</ul>,
ol: ({ children }) => <ol className="list-decimal list-inside space-y-0.5 my-1">{children}</ol>,
li: ({ children }) => <li>{children}</li>,
strong: ({ children }) => <strong className="font-semibold text-white">{children}</strong>,
a: ({ href, children }) => (
<a href={href} target="_blank" rel="noopener noreferrer" className="text-indigo-400 hover:text-indigo-300 underline">
{children}
</a>
),
}}
>
{msg.content}
</ReactMarkdown>
)}
</div>
{/* Suggestion cards */}