mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 07:00:49 +03:00
Merge branch 'main' into FEATURE/conversation-starters
# Conflicts: # packages/ui/src/views/chatmessage/ChatMessage.js
This commit is contained in:
@@ -32,8 +32,8 @@ import { baseURL, maxScroll } from 'store/constant'
|
||||
|
||||
import robotPNG from 'assets/images/robot.png'
|
||||
import userPNG from 'assets/images/account.png'
|
||||
import { isValidURL, removeDuplicateURL } from 'utils/genericHelper'
|
||||
import StarterPromptsCard from '../../ui-component/cards/StarterPromptsCard'
|
||||
import { isValidURL, removeDuplicateURL, setLocalStorageChatflow } from 'utils/genericHelper'
|
||||
|
||||
export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
const theme = useTheme()
|
||||
@@ -137,10 +137,9 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
|
||||
if (response.data) {
|
||||
const data = response.data
|
||||
if (!chatId) {
|
||||
setChatId(data.chatId)
|
||||
localStorage.setItem(`${chatflowid}_INTERNAL`, data.chatId)
|
||||
}
|
||||
|
||||
if (!chatId) setChatId(data.chatId)
|
||||
|
||||
if (!isChatFlowAvailableToStream) {
|
||||
let text = ''
|
||||
if (data.text) text = data.text
|
||||
@@ -158,7 +157,7 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
}
|
||||
])
|
||||
}
|
||||
|
||||
setLocalStorageChatflow(chatflowid, data.chatId, messages)
|
||||
setLoading(false)
|
||||
setUserInput('')
|
||||
setTimeout(() => {
|
||||
@@ -211,7 +210,6 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
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,
|
||||
@@ -223,6 +221,7 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
return obj
|
||||
})
|
||||
setMessages((prevMessages) => [...prevMessages, ...loadedMessages])
|
||||
setLocalStorageChatflow(chatflowid, chatId, messages)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
Reference in New Issue
Block a user