mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 17:01:16 +03:00
Renaming of Category, Class Names and File names from LLMCache to Cache as this functionality is applicable to both LLM and Chat Models.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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 }
|
||||
Reference in New Issue
Block a user