mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
refactor (this as any) usage
This commit is contained in:
@@ -148,9 +148,10 @@ interface DynamoDBSerializedChatMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
||||||
tableName = ''
|
private tableName = ''
|
||||||
partitionKey = ''
|
private partitionKey = ''
|
||||||
dynamoKey: Record<string, AttributeValue>
|
private dynamoKey: Record<string, AttributeValue>
|
||||||
|
private messageAttributeName: string
|
||||||
sessionId = ''
|
sessionId = ''
|
||||||
dynamodbClient: DynamoDBClient
|
dynamodbClient: DynamoDBClient
|
||||||
|
|
||||||
@@ -221,9 +222,9 @@ class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
|||||||
async getChatMessages(overrideSessionId = '', returnBaseMessages = false): Promise<IMessage[] | BaseMessage[]> {
|
async getChatMessages(overrideSessionId = '', returnBaseMessages = false): Promise<IMessage[] | BaseMessage[]> {
|
||||||
if (!this.dynamodbClient) return []
|
if (!this.dynamodbClient) return []
|
||||||
|
|
||||||
const dynamoKey = overrideSessionId ? this.overrideDynamoKey(overrideSessionId) : (this as any).dynamoKey
|
const dynamoKey = overrideSessionId ? this.overrideDynamoKey(overrideSessionId) : this.dynamoKey
|
||||||
const tableName = this.tableName
|
const tableName = this.tableName
|
||||||
const messageAttributeName = (this as any).messageAttributeName
|
const messageAttributeName = this.messageAttributeName
|
||||||
|
|
||||||
const params: GetItemCommandInput = {
|
const params: GetItemCommandInput = {
|
||||||
TableName: tableName,
|
TableName: tableName,
|
||||||
@@ -248,9 +249,9 @@ class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
|||||||
async addChatMessages(msgArray: { text: string; type: MessageType }[], overrideSessionId = ''): Promise<void> {
|
async addChatMessages(msgArray: { text: string; type: MessageType }[], overrideSessionId = ''): Promise<void> {
|
||||||
if (!this.dynamodbClient) return
|
if (!this.dynamodbClient) return
|
||||||
|
|
||||||
const dynamoKey = overrideSessionId ? this.overrideDynamoKey(overrideSessionId) : (this as any).dynamoKey
|
const dynamoKey = overrideSessionId ? this.overrideDynamoKey(overrideSessionId) : this.dynamoKey
|
||||||
const tableName = (this as any).tableName
|
const tableName = this.tableName
|
||||||
const messageAttributeName = (this as any).messageAttributeName
|
const messageAttributeName = this.messageAttributeName
|
||||||
|
|
||||||
const input = msgArray.find((msg) => msg.type === 'userMessage')
|
const input = msgArray.find((msg) => msg.type === 'userMessage')
|
||||||
const output = msgArray.find((msg) => msg.type === 'apiMessage')
|
const output = msgArray.find((msg) => msg.type === 'apiMessage')
|
||||||
@@ -271,8 +272,8 @@ class BufferMemoryExtended extends FlowiseMemory implements MemoryMethods {
|
|||||||
async clearChatMessages(overrideSessionId = ''): Promise<void> {
|
async clearChatMessages(overrideSessionId = ''): Promise<void> {
|
||||||
if (!this.dynamodbClient) return
|
if (!this.dynamodbClient) return
|
||||||
|
|
||||||
const dynamoKey = overrideSessionId ? this.overrideDynamoKey(overrideSessionId) : (this as any).dynamoKey
|
const dynamoKey = overrideSessionId ? this.overrideDynamoKey(overrideSessionId) : this.dynamoKey
|
||||||
const tableName = (this as any).tableName
|
const tableName = this.tableName
|
||||||
|
|
||||||
const params: DeleteItemCommandInput = {
|
const params: DeleteItemCommandInput = {
|
||||||
TableName: tableName,
|
TableName: tableName,
|
||||||
|
|||||||
Reference in New Issue
Block a user