mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
modify delete chat message method
This commit is contained in:
@@ -163,6 +163,7 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
|
||||
if (!chatId) {
|
||||
setChatId(data.chatId)
|
||||
localStorage.setItem(`${chatflowid}_INTERNAL`, data.chatId)
|
||||
}
|
||||
if (!isChatFlowAvailableToStream) {
|
||||
setMessages((prevMessages) => [
|
||||
@@ -200,8 +201,10 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
|
||||
// Get chatmessages successful
|
||||
useEffect(() => {
|
||||
if (getChatmessageApi.data) {
|
||||
setChatId(getChatmessageApi.data[0]?.chatId)
|
||||
if (getChatmessageApi.data?.length) {
|
||||
const chatId = getChatmessageApi.data[0]?.chatId
|
||||
setChatId(chatId)
|
||||
localStorage.setItem(`${chatflowid}_INTERNAL`, chatId)
|
||||
const loadedMessages = getChatmessageApi.data.map((message) => {
|
||||
const obj = {
|
||||
message: message.content,
|
||||
|
||||
@@ -85,7 +85,9 @@ export const ChatPopUp = ({ chatflowid }) => {
|
||||
|
||||
if (isConfirmed) {
|
||||
try {
|
||||
await chatmessageApi.deleteChatmessage(chatflowid)
|
||||
const chatId = localStorage.getItem(`${chatflowid}_INTERNAL`)
|
||||
await chatmessageApi.deleteChatmessage(chatId)
|
||||
localStorage.removeItem(`${chatflowid}_INTERNAL`)
|
||||
resetChatDialog()
|
||||
enqueueSnackbar({
|
||||
message: 'Succesfully cleared all chat history',
|
||||
|
||||
Reference in New Issue
Block a user