MCPcopy
hub / github.com/FlowiseAI/Flowise / getMemorySessionId

Function getMemorySessionId

packages/server/src/utils/index.ts:1823–1847  ·  view source on GitHub ↗
(
    memoryNode: IReactFlowNode | undefined,
    incomingInput: IncomingInput,
    chatId: string,
    isInternal: boolean
)

Source from the content-addressed store, hash-verified

1821 * @returns {string}
1822 */
1823export const getMemorySessionId = (
1824 memoryNode: IReactFlowNode | undefined,
1825 incomingInput: IncomingInput,
1826 chatId: string,
1827 isInternal: boolean
1828): string => {
1829 if (!isInternal) {
1830 // Provided in API body - incomingInput.overrideConfig: { sessionId: 'abc' }
1831 if (incomingInput.overrideConfig?.sessionId) {
1832 return incomingInput.overrideConfig?.sessionId
1833 }
1834 // Provided in API body - incomingInput.chatId
1835 if (incomingInput.chatId) {
1836 return incomingInput.chatId
1837 }
1838 }
1839
1840 // Hard-coded sessionId in UI
1841 if (memoryNode && memoryNode.data.inputs?.sessionId) {
1842 return memoryNode.data.inputs.sessionId
1843 }
1844
1845 // Default chatId
1846 return chatId
1847}
1848
1849/**
1850 * Get chat messages from sessionId

Callers 3

executeUpsertFunction · 0.90
getChatHistoryFunction · 0.90
executeFlowFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected