MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / setLocalStorageChatflow

Function setLocalStorageChatflow

packages/ui/src/utils/genericHelper.js:883–900  ·  view source on GitHub ↗
(chatflowid, chatId, saveObj = {})

Source from the content-addressed store, hash-verified

881}
882
883export const setLocalStorageChatflow = (chatflowid, chatId, saveObj = {}) => {
884 const chatDetails = localStorage.getItem(`${chatflowid}_INTERNAL`)
885 const obj = { ...saveObj }
886 if (chatId) obj.chatId = chatId
887
888 if (!chatDetails) {
889 localStorage.setItem(`${chatflowid}_INTERNAL`, JSON.stringify(obj))
890 } else {
891 try {
892 const parsedChatDetails = JSON.parse(chatDetails)
893 localStorage.setItem(`${chatflowid}_INTERNAL`, JSON.stringify({ ...parsedChatDetails, ...obj }))
894 } catch (e) {
895 const chatId = chatDetails
896 obj.chatId = chatId
897 localStorage.setItem(`${chatflowid}_INTERNAL`, JSON.stringify(obj))
898 }
899 }
900}
901
902export const getLocalStorageChatflow = (chatflowid) => {
903 const chatDetails = localStorage.getItem(`${chatflowid}_INTERNAL`)

Callers 4

handleSubmitFunction · 0.90
onmessageFunction · 0.90
ChatMessageFunction · 0.90
handleLeadCaptureSubmitFunction · 0.90

Calls 2

stringifyMethod · 0.80
parseMethod · 0.65

Tested by

no test coverage detected