update credentials

This commit is contained in:
Henry
2023-07-15 19:43:09 +01:00
parent d76a47b894
commit ff755c3d1b
75 changed files with 911 additions and 461 deletions
@@ -1,4 +1,4 @@
import { ICommonObject, INode, INodeData, INodeParams, getBaseClasses } from '../../../src'
import { ICommonObject, INode, INodeData, INodeParams, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src'
import { DynamoDBChatMessageHistory } from 'langchain/stores/message/dynamodb'
import { BufferMemory } from 'langchain/memory'
@@ -10,6 +10,7 @@ class DynamoDb_Memory implements INode {
icon: string
category: string
baseClasses: string[]
credential: INodeParams
inputs: INodeParams[]
constructor() {
@@ -20,6 +21,12 @@ class DynamoDb_Memory implements INode {
this.category = 'Memory'
this.description = 'Stores the conversation in dynamo db table'
this.baseClasses = [this.type, ...getBaseClasses(BufferMemory)]
this.credential = {
label: 'Connect Credential',
name: 'credential',
type: 'credential',
credentialNames: ['dynamodbMemoryApi']
}
this.inputs = [
{
label: 'Table Name',
@@ -31,6 +38,13 @@ class DynamoDb_Memory implements INode {
name: 'partitionKey',
type: 'string'
},
{
label: 'Region',
name: 'region',
type: 'string',
description: 'The aws region in which table is located',
placeholder: 'us-east-1'
},
{
label: 'Session ID',
name: 'sessionId',
@@ -40,28 +54,12 @@ class DynamoDb_Memory implements INode {
additionalParams: true,
optional: true
},
{
label: 'Region',
name: 'region',
type: 'string',
description: 'The aws region in which table is located',
placeholder: 'us-east-1'
},
{
label: 'Access Key',
name: 'accessKey',
type: 'password'
},
{
label: 'Secret Access Key',
name: 'secretAccessKey',
type: 'password'
},
{
label: 'Memory Key',
name: 'memoryKey',
type: 'string',
default: 'chat_history'
default: 'chat_history',
additionalParams: true
}
]
}
@@ -70,12 +68,14 @@ class DynamoDb_Memory implements INode {
const partitionKey = nodeData.inputs?.partitionKey as string
const sessionId = nodeData.inputs?.sessionId as string
const region = nodeData.inputs?.region as string
const accessKey = nodeData.inputs?.accessKey as string
const secretAccessKey = nodeData.inputs?.secretAccessKey as string
const memoryKey = nodeData.inputs?.memoryKey as string
const chatId = options.chatId
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const accessKey = getCredentialParam('accessKey', credentialData, nodeData)
const secretAccessKey = getCredentialParam('secretAccessKey', credentialData, nodeData)
const dynamoDb = new DynamoDBChatMessageHistory({
tableName,
partitionKey,
@@ -20,7 +20,7 @@ class MotorMemory_Memory implements INode {
this.type = 'MotorheadMemory'
this.icon = 'motorhead.png'
this.category = 'Memory'
this.description = 'Remembers previous conversational back and forths directly'
this.description = 'Use Motorhead Memory to store chat conversations'
this.baseClasses = [this.type, ...getBaseClasses(MotorheadMemory)]
this.credential = {
label: 'Connect Credential',
@@ -38,12 +38,6 @@ class MotorMemory_Memory implements INode {
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',
@@ -52,6 +46,13 @@ class MotorMemory_Memory implements INode {
default: '',
additionalParams: true,
optional: true
},
{
label: 'Memory Key',
name: 'memoryKey',
type: 'string',
default: 'chat_history',
additionalParams: true
}
]
}
@@ -1,29 +0,0 @@
import { INodeParams, INodeCredential } from '../../../src/Interface'
class MotorheadMemoryApi implements INodeCredential {
label: string
name: string
description: string
inputs: INodeParams[]
constructor() {
this.label = 'Motorhead Memory API'
this.name = 'motorheadMemoryApi'
this.description =
'Refer to <a target="_blank" href="https://docs.getmetal.io/misc-get-keys">official guide</a> on how to create API key and Client ID on Motorhead Memory'
this.inputs = [
{
label: 'Client ID',
name: 'clientId',
type: 'string'
},
{
label: 'API Key',
name: 'apiKey',
type: 'password'
}
]
}
}
module.exports = { credClass: MotorheadMemoryApi }
@@ -44,13 +44,15 @@ class RedisBackedChatMemory_Memory implements INode {
name: 'sessionTTL',
type: 'number',
description: 'Omit this parameter to make sessions never expire',
additionalParams: true,
optional: true
},
{
label: 'Memory Key',
name: 'memoryKey',
type: 'string',
default: 'chat_history'
default: 'chat_history',
additionalParams: true
}
]
}
@@ -1,24 +0,0 @@
import { INodeParams, INodeCredential } from '../../../src/Interface'
class ZepMemoryApi implements INodeCredential {
label: string
name: string
description: string
inputs: INodeParams[]
constructor() {
this.label = 'Zep Memory Api'
this.name = 'zepMemoryApi'
this.description =
'Refer to <a target="_blank" href="https://docs.getzep.com/deployment/auth/">official guide</a> on how to create API key on Zep'
this.inputs = [
{
label: 'API Key',
name: 'apiKey',
type: 'password'
}
]
}
}
module.exports = { credClass: ZepMemoryApi }