diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 7dc8cb8c..c4594efa 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1077,7 +1077,7 @@ export class App { await this.addChatMessage(apiMessage) logger.debug(`[server]: Finished running ${nodeToExecuteData.label} (${nodeToExecuteData.id})`) - result.chatId = chatId + if (incomingInput.chatId) result.chatId = chatId return res.json(result) } catch (e: any) { logger.error('[server]: Error:', e) diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index 749d8c55..d636a6cd 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -931,6 +931,7 @@ export const redactCredentialWithPasswordType = ( export const checkMemorySessionId = (instance: any, chatId: string): string => { if (instance.memory && instance.memory.isSessionIdUsingChatMessageId && chatId) { instance.memory.sessionId = chatId + instance.memory.chatHistory.sessionId = chatId } return instance.memory.sessionId } diff --git a/packages/ui/src/views/chatflows/ShareChatbot.js b/packages/ui/src/views/chatflows/ShareChatbot.js index 0f05c28a..dc6c0621 100644 --- a/packages/ui/src/views/chatflows/ShareChatbot.js +++ b/packages/ui/src/views/chatflows/ShareChatbot.js @@ -57,6 +57,9 @@ const ShareChatbot = ({ isSessionMemory }) => { const [isPublicChatflow, setChatflowIsPublic] = useState(chatflow.isPublic ?? false) const [generateNewSession, setGenerateNewSession] = useState(chatbotConfig?.generateNewSession ?? false) + const [title, setTitle] = useState(chatbotConfig?.title ?? '') + const [titleAvatarSrc, setTitleAvatarSrc] = useState(chatbotConfig?.titleAvatarSrc ?? '') + const [welcomeMessage, setWelcomeMessage] = useState(chatbotConfig?.welcomeMessage ?? '') const [backgroundColor, setBackgroundColor] = useState(chatbotConfig?.backgroundColor ?? defaultConfig.backgroundColor) const [fontSize, setFontSize] = useState(chatbotConfig?.fontSize ?? defaultConfig.fontSize) @@ -108,6 +111,8 @@ const ShareChatbot = ({ isSessionMemory }) => { textInput: {}, overrideConfig: {} } + if (title) obj.title = title + if (titleAvatarSrc) obj.titleAvatarSrc = titleAvatarSrc if (welcomeMessage) obj.welcomeMessage = welcomeMessage if (backgroundColor) obj.backgroundColor = backgroundColor if (fontSize) obj.fontSize = fontSize @@ -252,6 +257,12 @@ const ShareChatbot = ({ isSessionMemory }) => { const onTextChanged = (value, fieldName) => { switch (fieldName) { + case 'title': + setTitle(value) + break + case 'titleAvatarSrc': + setTitleAvatarSrc(value) + break case 'welcomeMessage': setWelcomeMessage(value) break @@ -395,6 +406,14 @@ const ShareChatbot = ({ isSessionMemory }) => { /> + {textField(title, 'title', 'Title', 'string', 'Flowise Assistant')} + {textField( + titleAvatarSrc, + 'titleAvatarSrc', + 'Title Avatar Link', + 'string', + `https://raw.githubusercontent.com/FlowiseAI/Flowise/main/assets/FloWiseAI_dark.png` + )} {textField(welcomeMessage, 'welcomeMessage', 'Welcome Message', 'string', 'Hello! This is custom welcome message')} {colorField(backgroundColor, 'backgroundColor', 'Background Color')} {textField(fontSize, 'fontSize', 'Font Size', 'number')}