({ open, chatflowid, isAgentCanvas, isDialog, previews, setPreviews })
| 186 | } |
| 187 | |
| 188 | const ChatMessage = ({ open, chatflowid, isAgentCanvas, isDialog, previews, setPreviews }) => { |
| 189 | const theme = useTheme() |
| 190 | const customization = useSelector((state) => state.customization) |
| 191 | |
| 192 | const ps = useRef() |
| 193 | |
| 194 | const dispatch = useDispatch() |
| 195 | const { onAgentflowNodeStatusUpdate, clearAgentflowNodeStatus } = useContext(flowContext) |
| 196 | |
| 197 | useNotifier() |
| 198 | const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args)) |
| 199 | const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args)) |
| 200 | |
| 201 | const [userInput, setUserInput] = useState('') |
| 202 | const [loading, setLoading] = useState(false) |
| 203 | const [messages, setMessages] = useState([ |
| 204 | { |
| 205 | message: 'Hi there! How can I help?', |
| 206 | type: 'apiMessage' |
| 207 | } |
| 208 | ]) |
| 209 | const [isChatFlowAvailableToStream, setIsChatFlowAvailableToStream] = useState(false) |
| 210 | const [isChatFlowAvailableForSpeech, setIsChatFlowAvailableForSpeech] = useState(false) |
| 211 | const [sourceDialogOpen, setSourceDialogOpen] = useState(false) |
| 212 | const [sourceDialogProps, setSourceDialogProps] = useState({}) |
| 213 | const [chatId, setChatId] = useState(uuidv4()) |
| 214 | const [isMessageStopping, setIsMessageStopping] = useState(false) |
| 215 | const [uploadedFiles, setUploadedFiles] = useState([]) |
| 216 | const [imageUploadAllowedTypes, setImageUploadAllowedTypes] = useState('') |
| 217 | const [fileUploadAllowedTypes, setFileUploadAllowedTypes] = useState('') |
| 218 | const [inputHistory] = useState(new ChatInputHistory(10)) |
| 219 | |
| 220 | const inputRef = useRef(null) |
| 221 | const getChatmessageApi = useApi(chatmessageApi.getInternalChatmessageFromChatflow) |
| 222 | const getAllExecutionsApi = useApi(executionsApi.getAllExecutions) |
| 223 | const getIsChatflowStreamingApi = useApi(chatflowsApi.getIsChatflowStreaming) |
| 224 | const getAllowChatFlowUploads = useApi(chatflowsApi.getAllowChatflowUploads) |
| 225 | const getChatflowConfig = useApi(chatflowsApi.getSpecificChatflow) |
| 226 | |
| 227 | const [starterPrompts, setStarterPrompts] = useState([]) |
| 228 | |
| 229 | // full file upload |
| 230 | const [fullFileUpload, setFullFileUpload] = useState(false) |
| 231 | const [fullFileUploadAllowedTypes, setFullFileUploadAllowedTypes] = useState('*') |
| 232 | |
| 233 | // feedback |
| 234 | const [chatFeedbackStatus, setChatFeedbackStatus] = useState(false) |
| 235 | const [feedbackId, setFeedbackId] = useState('') |
| 236 | const [showFeedbackContentDialog, setShowFeedbackContentDialog] = useState(false) |
| 237 | |
| 238 | // leads |
| 239 | const [leadsConfig, setLeadsConfig] = useState(null) |
| 240 | const [leadName, setLeadName] = useState('') |
| 241 | const [leadEmail, setLeadEmail] = useState('') |
| 242 | const [leadPhone, setLeadPhone] = useState('') |
| 243 | const [isLeadSaving, setIsLeadSaving] = useState(false) |
| 244 | const [isLeadSaved, setIsLeadSaved] = useState(false) |
| 245 |
nothing calls this directly
no test coverage detected