(
memoryNode: IReactFlowNode | undefined,
incomingInput: IncomingInput,
chatId: string,
isInternal: boolean
)
| 1821 | * @returns {string} |
| 1822 | */ |
| 1823 | export 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 |
no outgoing calls
no test coverage detected