Skip to content

Commit

Permalink
Merge pull request #1258 from FlowiseAI/bugfix/SessionId
Browse files Browse the repository at this point in the history
Bugfix/fix sessionid undefined
  • Loading branch information
HenryHengZJ authored Nov 21, 2023
2 parents 10c3066 + 9a3be5f commit 65304bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/server/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,14 @@ export const redactCredentialWithPasswordType = (
* @param {any} instance
* @param {string} chatId
*/
export const checkMemorySessionId = (instance: any, chatId: string): string => {
export const checkMemorySessionId = (instance: any, chatId: string): string | undefined => {
if (instance.memory && instance.memory.isSessionIdUsingChatMessageId && chatId) {
instance.memory.sessionId = chatId
instance.memory.chatHistory.sessionId = chatId
}
return instance.memory ? instance.memory.sessionId ?? instance.memory.chatHistory.sessionId : undefined

if (instance.memory && instance.memory.sessionId) return instance.memory.sessionId
else if (instance.memory && instance.memory.chatHistory && instance.memory.chatHistory.sessionId)
return instance.memory.chatHistory.sessionId
return undefined
}

0 comments on commit 65304bb

Please sign in to comment.