mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
refactor: Relocate handleClear Logic: Move the chat and diagram clearing logic to ChatPanel (or a Server Action) and have ChatInput call the onClearChat prop. Introduce a clearDiagram method in DiagramContext.
This commit is contained in:
@@ -20,6 +20,7 @@ export default function ChatPanel() {
|
||||
loadDiagram: onDisplayChart,
|
||||
handleExport: onExport,
|
||||
resolverRef,
|
||||
clearDiagram,
|
||||
} = useDiagram();
|
||||
|
||||
const onFetchChart = () => {
|
||||
@@ -123,7 +124,10 @@ export default function ChatPanel() {
|
||||
status={status}
|
||||
onSubmit={onFormSubmit}
|
||||
onChange={handleInputChange}
|
||||
onClearChat={() => setMessages([])}
|
||||
onClearChat={() => {
|
||||
setMessages([]);
|
||||
clearDiagram();
|
||||
}}
|
||||
files={files}
|
||||
onFileChange={handleFileChange}
|
||||
showHistory={showHistory}
|
||||
|
||||
Reference in New Issue
Block a user