Repository: FlowiseAI/Flowise
File: packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts (TypeScript)

Code before:
                type: 'string',
                optional: true,
                description: 'To use the online version, leave the URL blank. More details at https://getmetal.io.'
            },
            {
                label: 'Memory Key',
                name: 'memoryKey',
                type: 'string',
                default: 'chat_history'
            },
            {
                label: 'Session Id',
                name: 'sessionId',
                type: 'string',
                description: 'if empty, chatId will be used automatically',
                default: '',
                additionalParams: true,
                optional: true
            },
            {
                label: 'API Key',
                name: 'apiKey',
                type: 'string',
                optional: true
            },
            {
                label: 'Client ID',
                name: 'clientId',
                type: 'string',
                optional: true
            }
        ]
    }

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        const memoryKey = nodeData.inputs?.memoryKey as string
        const baseURL = nodeData.inputs?.baseURL as string
        const sessionId = nodeData.inputs?.sessionId as string
        const apiKey = nodeData.inputs?.apiKey as string
        const clientId = nodeData.inputs?.clientId as string

        const chatId = options?.chatId as string

        console.log(chatId)

        let obj: MotorheadMemoryInput = {
            returnMessages: true,
            sessionId: sessionId ? sessionId : chatId,
            memoryKey
        }


Review comment (suggestion):
can we add `additionalParams: true` and `description: 'Only needed when using hosted solution - https://getmetal.io'`

Code after:
                type: 'string',
                optional: true,
                description: 'To use the online version, leave the URL blank. More details at https://getmetal.io.'
            },
            {
                label: 'Memory Key',
                name: 'memoryKey',
                type: 'string',
                default: 'chat_history'
            },
            {
                label: 'Session Id',
                name: 'sessionId',
                type: 'string',
                description: 'if empty, chatId will be used automatically',
                default: '',
                additionalParams: true,
                optional: true
            },
            {
                label: 'API Key',
                name: 'apiKey',
                type: 'string',
                description: 'Only needed when using hosted solution - https://getmetal.io',
                additionalParams: true,
                optional: true
            },
            {
                label: 'Client ID',
                name: 'clientId',
                type: 'string',
                description: 'Only needed when using hosted solution - https://getmetal.io',
                additionalParams: true,
                optional: true
            }
        ]
    }

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        const memoryKey = nodeData.inputs?.memoryKey as string
        const baseURL = nodeData.inputs?.baseURL as string
        const sessionId = nodeData.inputs?.sessionId as string
        const apiKey = nodeData.inputs?.apiKey as string
        const clientId = nodeData.inputs?.clientId as string

        const chatId = options?.chatId as string

        let obj: MotorheadMemoryInput = {
            returnMessages: true,
            sessionId: sessionId ? sessionId : chatId,
            memoryKey