mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 09:00:52 +03:00
Feature: Collect contact information from users inside the chatbot (#1948)
* Add leads settings to chatflow configuration * Add leads tab to chatflow configuration with options for lead capture * Add database entity and migrations for leads * Add endpoint for adding and fetching leads * Show lead capture form in UI chat window when enabled * Add view leads dialog * Make export leads functional * Add input for configuring message on successful lead capture * Add migrations for adding lead email in chat message if available * show lead email in view messages * ui touch up * Remove unused code and update how lead email is shown in view messages dialog * Fix lead not getting saved * Disable input when lead form is shown and save lead info to localstorage * Fix lead capture form not working * disabled lead save button until at least one form field is turned on, get rid of local storage _LEAD * add leads API to as whitelist public endpoint * Send leadEmail in internal chat inputs * Fix condition for disabling input field and related buttons when lead is enabled/disabled and when lead is saved * update leads ui * update error message and alter table add column sqlite migration --------- Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
@@ -519,9 +519,9 @@ export const formatDataGridRows = (rows) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const setLocalStorageChatflow = (chatflowid, chatId) => {
|
||||
export const setLocalStorageChatflow = (chatflowid, chatId, saveObj = {}) => {
|
||||
const chatDetails = localStorage.getItem(`${chatflowid}_INTERNAL`)
|
||||
const obj = {}
|
||||
const obj = { ...saveObj }
|
||||
if (chatId) obj.chatId = chatId
|
||||
|
||||
if (!chatDetails) {
|
||||
@@ -538,6 +538,34 @@ export const setLocalStorageChatflow = (chatflowid, chatId) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const getLocalStorageChatflow = (chatflowid) => {
|
||||
const chatDetails = localStorage.getItem(`${chatflowid}_INTERNAL`)
|
||||
if (!chatDetails) return {}
|
||||
try {
|
||||
return JSON.parse(chatDetails)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
export const removeLocalStorageChatHistory = (chatflowid) => {
|
||||
const chatDetails = localStorage.getItem(`${chatflowid}_INTERNAL`)
|
||||
if (!chatDetails) return
|
||||
try {
|
||||
const parsedChatDetails = JSON.parse(chatDetails)
|
||||
if (parsedChatDetails.lead) {
|
||||
// Dont remove lead when chat is cleared
|
||||
const obj = { lead: parsedChatDetails.lead }
|
||||
localStorage.removeItem(`${chatflowid}_INTERNAL`)
|
||||
localStorage.setItem(`${chatflowid}_INTERNAL`, JSON.stringify(obj))
|
||||
} else {
|
||||
localStorage.removeItem(`${chatflowid}_INTERNAL`)
|
||||
}
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
export const unshiftFiles = (configData) => {
|
||||
const filesConfig = configData.find((config) => config.name === 'files')
|
||||
if (filesConfig) {
|
||||
|
||||
Reference in New Issue
Block a user