mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
refactor: extract all states to diagram-context.
This commit is contained in:
@@ -8,23 +8,22 @@ import ExamplePanel from "./chat-example-panel";
|
||||
import { Message } from "ai";
|
||||
import { convertToLegalXml, replaceNodes } from "@/lib/utils";
|
||||
|
||||
import { useDiagram } from "@/contexts/diagram-context";
|
||||
|
||||
interface ChatMessageDisplayProps {
|
||||
chartXML: string;
|
||||
messages: Message[];
|
||||
error?: Error | null;
|
||||
setInput: (input: string) => void;
|
||||
setFiles: (files: FileList | undefined) => void;
|
||||
onDisplayChart: (xml: string) => void;
|
||||
}
|
||||
|
||||
export function ChatMessageDisplay({
|
||||
chartXML,
|
||||
messages,
|
||||
error,
|
||||
setInput,
|
||||
setFiles,
|
||||
onDisplayChart,
|
||||
}: ChatMessageDisplayProps) {
|
||||
const { chartXML, loadDiagram: onDisplayChart } = useDiagram();
|
||||
const messagesEndRef = useRef<HTMLDivElement>(null);
|
||||
const previousXML = useRef<string>("");
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user