clear button created
This commit is contained in:
parent
15996793f1
commit
04a23b5965
1 changed files with 16 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ import {
|
|||
PaperAirplaneIcon,
|
||||
XMarkIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { MouseEventHandler, useContext, useEffect, useRef, useState } from "react";
|
||||
import { sendAll } from "../../controllers/NodesServices";
|
||||
import { alertContext } from "../../contexts/alertContext";
|
||||
import { classNames, nodeColors } from "../../utils";
|
||||
|
|
@ -109,6 +109,10 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) {
|
|||
});
|
||||
}
|
||||
}
|
||||
function clearChat() {
|
||||
setChatHistory([])
|
||||
updateFlow({ ..._.cloneDeep(flow), chat: []});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -137,6 +141,14 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) {
|
|||
/>
|
||||
Chat
|
||||
</div>
|
||||
<button className="hover:text-blue-500"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
clearChat();
|
||||
}}
|
||||
>
|
||||
clear
|
||||
</button>
|
||||
</div>
|
||||
<div className="w-full h-[400px] flex gap-3 mb-auto overflow-y-auto scrollbar-hide flex-col bg-gray-50 dark:bg-gray-900 p-3 py-5">
|
||||
{chatHistory.map((c, i) => (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue