diff --git a/components/chat-input.tsx b/components/chat-input.tsx index 4be3980..ad775f4 100644 --- a/components/chat-input.tsx +++ b/components/chat-input.tsx @@ -23,11 +23,11 @@ interface ChatInputProps { status: "submitted" | "streaming" | "ready" | "error"; onSubmit: (e: React.FormEvent) => void; onChange: (e: React.ChangeEvent) => void; - setMessages: (messages: any[]) => void; + onClearChat: () => void; files?: FileList; onFileChange?: (files: FileList | undefined) => void; showHistory?: boolean; - setShowHistory?: (show: boolean) => void; + onToggleHistory?: (show: boolean) => void; } export function ChatInput({ @@ -35,11 +35,11 @@ export function ChatInput({ status, onSubmit, onChange, - setMessages, + onClearChat, files, onFileChange, showHistory = false, - setShowHistory = () => {}, + onToggleHistory = () => {}, }: ChatInputProps) { const { loadDiagram: onDisplayChart, diagramHistory } = useDiagram(); const textareaRef = useRef(null); @@ -132,7 +132,7 @@ export function ChatInput({ // Handle clearing conversation and diagram const handleClear = () => { - setMessages([]); + onClearChat(); onDisplayChart(` @@ -221,7 +221,7 @@ export function ChatInput({
@@ -230,7 +230,7 @@ export function ChatInput({ type="button" variant="outline" size="icon" - onClick={() => setShowHistory(true)} + onClick={() => onToggleHistory(true)} disabled={ status === "streaming" || diagramHistory.length === 0 diff --git a/components/chat-panel.tsx b/components/chat-panel.tsx index c817909..ad1a10c 100644 --- a/components/chat-panel.tsx +++ b/components/chat-panel.tsx @@ -116,11 +116,11 @@ export default function ChatPanel() { status={status} onSubmit={onFormSubmit} onChange={handleInputChange} - setMessages={setMessages} + onClearChat={() => setMessages([])} files={files} onFileChange={handleFileChange} showHistory={showHistory} - setShowHistory={setShowHistory} + onToggleHistory={setShowHistory} /> diff --git a/components/history-dialog.tsx b/components/history-dialog.tsx index a027598..e0c96ca 100644 --- a/components/history-dialog.tsx +++ b/components/history-dialog.tsx @@ -14,17 +14,17 @@ import { useDiagram } from "@/contexts/diagram-context"; interface HistoryDialogProps { showHistory: boolean; - setShowHistory: (show: boolean) => void; + onToggleHistory: (show: boolean) => void; } export function HistoryDialog({ showHistory, - setShowHistory, + onToggleHistory, }: HistoryDialogProps) { const { loadDiagram: onDisplayChart, diagramHistory } = useDiagram(); return ( - + Diagram History @@ -48,7 +48,7 @@ export function HistoryDialog({ className="border rounded-md p-2 cursor-pointer hover:border-primary transition-colors" onClick={() => { onDisplayChart(item.xml); - setShowHistory(false); + onToggleHistory(false); }} >
@@ -71,7 +71,7 @@ export function HistoryDialog({