mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Conversation Starters: - Updates to use the chatbot config for persistence.
This commit is contained in:
@@ -13,7 +13,7 @@ const settings = {
|
||||
children: [
|
||||
{
|
||||
id: 'conversationStarters',
|
||||
title: 'Set Starter Prompts',
|
||||
title: 'Starter Prompts',
|
||||
type: 'item',
|
||||
url: '',
|
||||
icon: icons.IconPictureInPictureOff
|
||||
|
||||
@@ -57,7 +57,9 @@ const ConversationStarterDialog = ({ show, dialogProps, onCancel }) => {
|
||||
const onSave = async () => {
|
||||
try {
|
||||
const saveResp = await chatflowsApi.updateChatflow(dialogProps.chatflow.id, {
|
||||
starterPrompt: JSON.stringify(inputFields)
|
||||
chatbotConfig: {
|
||||
starterPrompts: JSON.stringify(inputFields)
|
||||
}
|
||||
})
|
||||
if (saveResp.data) {
|
||||
enqueueSnackbar({
|
||||
@@ -94,9 +96,9 @@ const ConversationStarterDialog = ({ show, dialogProps, onCancel }) => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (dialogProps.chatflow && dialogProps.chatflow.starterPrompt) {
|
||||
if (dialogProps.chatflow && dialogProps.chatbotConfig.starterPrompts) {
|
||||
try {
|
||||
setInputFields(JSON.parse(dialogProps.chatflow.starterPrompt))
|
||||
setInputFields(JSON.parse(dialogProps.chatbotConfig.starterPrompts))
|
||||
} catch (e) {
|
||||
setInputFields([
|
||||
{
|
||||
@@ -126,7 +128,7 @@ const ConversationStarterDialog = ({ show, dialogProps, onCancel }) => {
|
||||
aria-describedby='alert-dialog-description'
|
||||
>
|
||||
<DialogTitle sx={{ fontSize: '1rem' }} id='alert-dialog-title'>
|
||||
Set Conversation Starter Prompts
|
||||
{dialogProps.title || 'Conversation Starter Prompts'}
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<Box sx={{ p: 2 }}>
|
||||
|
||||
@@ -61,7 +61,7 @@ const CanvasHeader = ({ chatflow, handleSaveFlow, handleDeleteFlow, handleLoadFl
|
||||
handleDeleteFlow()
|
||||
} else if (setting === 'conversationStarters') {
|
||||
setConversationStartersDialogProps({
|
||||
title: 'Set Conversation Starters - ' + chatflow.name,
|
||||
title: 'Starter Prompts - ' + chatflow.name,
|
||||
chatflow: chatflow
|
||||
})
|
||||
setConversationStartersDialogOpen(true)
|
||||
|
||||
@@ -210,8 +210,11 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (getChatflowConfig.data) {
|
||||
if (getChatflowConfig.data?.starterPrompt && JSON.parse(getChatflowConfig.data?.starterPrompt)) {
|
||||
setStarterPrompts(JSON.parse(getChatflowConfig.data?.starterPrompt))
|
||||
if (
|
||||
getChatflowConfig.data?.chatbotConfig?.starterPrompts &&
|
||||
JSON.parse(getChatflowConfig.data?.chatbotConfig?.starterPrompts)
|
||||
) {
|
||||
setStarterPrompts(JSON.parse(getChatflowConfig.data?.chatbotConfig?.starterPrompts))
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
Reference in New Issue
Block a user