mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Chore/refractor (#4454)
* markdown files and env examples cleanup * components update * update jsonlines description * server refractor * update telemetry * add execute custom node * add ui refractor * add username and password authenticate * correctly retrieve past images in agentflowv2 * disable e2e temporarily * add existing username and password authenticate * update migration to default workspace * update todo * blob storage migrating * throw error on agent tool call error * add missing execution import * add referral * chore: add error message when importData is undefined * migrate api keys to db * fix: data too long for column executionData * migrate api keys from json to db at init * add info on account setup * update docstore missing fields --------- Co-authored-by: chungyau97 <chungyau97@gmail.com>
This commit is contained in:
@@ -125,6 +125,8 @@ const initializeDynamoDB = async (nodeData: INodeData, options: ICommonObject):
|
||||
config
|
||||
})
|
||||
|
||||
const orgId = options.orgId as string
|
||||
|
||||
const memory = new BufferMemoryExtended({
|
||||
memoryKey: memoryKey ?? 'chat_history',
|
||||
chatHistory: dynamoDb,
|
||||
@@ -132,7 +134,8 @@ const initializeDynamoDB = async (nodeData: INodeData, options: ICommonObject):
|
||||
dynamodbClient: client,
|
||||
tableName,
|
||||
partitionKey,
|
||||
dynamoKey: { [partitionKey]: { S: sessionId } }
|
||||
dynamoKey: { [partitionKey]: { S: sessionId } },
|
||||
orgId
|
||||
})
|
||||
return memory
|
||||
}
|
||||
@@ -143,6 +146,7 @@ interface BufferMemoryExtendedInput {
|
||||
tableName: string
|
||||
partitionKey: string
|
||||
dynamoKey: Record<string, AttributeValue>
|
||||
orgId: string
|
||||
}
|
||||
|
||||
interface DynamoDBSerializedChatMessage {
|
||||
@@ -165,6 +169,7 @@ class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
||||
private dynamoKey: Record<string, AttributeValue>
|
||||
private messageAttributeName: string
|
||||
sessionId = ''
|
||||
orgId = ''
|
||||
dynamodbClient: DynamoDBClient
|
||||
|
||||
constructor(fields: BufferMemoryInput & BufferMemoryExtendedInput) {
|
||||
@@ -174,6 +179,7 @@ class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
||||
this.tableName = fields.tableName
|
||||
this.partitionKey = fields.partitionKey
|
||||
this.dynamoKey = fields.dynamoKey
|
||||
this.orgId = fields.orgId
|
||||
}
|
||||
|
||||
overrideDynamoKey(overrideSessionId = '') {
|
||||
@@ -260,7 +266,7 @@ class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
||||
.filter((x): x is StoredMessage => x.type !== undefined && x.data.content !== undefined)
|
||||
const baseMessages = messages.map(mapStoredMessageToChatMessage)
|
||||
if (prependMessages?.length) {
|
||||
baseMessages.unshift(...(await mapChatMessageToBaseMessage(prependMessages)))
|
||||
baseMessages.unshift(...(await mapChatMessageToBaseMessage(prependMessages, this.orgId)))
|
||||
}
|
||||
return returnBaseMessages ? baseMessages : convertBaseMessagetoIMessage(baseMessages)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user