mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Removing InMemoryCache and code cleanup in MomentoCache
This commit is contained in:
@@ -1,36 +0,0 @@
|
|||||||
import { INode, INodeParams } from '../../../src/Interface'
|
|
||||||
import { InMemoryCache as LangchainInMemoryCache } from 'langchain/cache'
|
|
||||||
import { getBaseClasses } from '../../../src'
|
|
||||||
|
|
||||||
class InMemoryCache implements INode {
|
|
||||||
label: string
|
|
||||||
name: string
|
|
||||||
version: number
|
|
||||||
description: string
|
|
||||||
type: string
|
|
||||||
icon: string
|
|
||||||
category: string
|
|
||||||
baseClasses: string[]
|
|
||||||
inputs: INodeParams[]
|
|
||||||
inMemoryCache: any
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.label = 'Local (Builtin) Cache'
|
|
||||||
this.name = 'localCache'
|
|
||||||
this.version = 1.0
|
|
||||||
this.type = 'Cache'
|
|
||||||
this.icon = 'memorycache.png'
|
|
||||||
this.category = 'Cache'
|
|
||||||
this.baseClasses = [this.type, ...getBaseClasses(InMemoryCache)]
|
|
||||||
this.inputs = []
|
|
||||||
}
|
|
||||||
|
|
||||||
async init(): Promise<any> {
|
|
||||||
if (!this.inMemoryCache) {
|
|
||||||
this.inMemoryCache = LangchainInMemoryCache.global()
|
|
||||||
}
|
|
||||||
return this.inMemoryCache
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { nodeClass: InMemoryCache }
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -36,7 +36,6 @@ class MomentoCache implements INode {
|
|||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const apiKey = getCredentialParam('momentoApiKey', credentialData, nodeData)
|
const apiKey = getCredentialParam('momentoApiKey', credentialData, nodeData)
|
||||||
const cacheName = getCredentialParam('momentoCache', credentialData, nodeData)
|
const cacheName = getCredentialParam('momentoCache', credentialData, nodeData)
|
||||||
const endPoint = getCredentialParam('momentoEndpoint', credentialData, nodeData)
|
|
||||||
|
|
||||||
// See https://github.com/momentohq/client-sdk-javascript for connection options
|
// See https://github.com/momentohq/client-sdk-javascript for connection options
|
||||||
const client = new CacheClient({
|
const client = new CacheClient({
|
||||||
|
|||||||
Reference in New Issue
Block a user