mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
enable faiss streaming
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
IComponentCredentials,
|
||||
ICredentialReqBody
|
||||
} from '../Interface'
|
||||
import { cloneDeep, get, omit, merge, isEqual } from 'lodash'
|
||||
import { cloneDeep, get, isEqual } from 'lodash'
|
||||
import {
|
||||
ICommonObject,
|
||||
getInputVariables,
|
||||
@@ -393,25 +393,6 @@ export const getVariableValue = (
|
||||
return returnVal
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily disable streaming if vectorStore is Faiss
|
||||
* @param {INodeData} flowNodeData
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isVectorStoreFaiss = (flowNodeData: INodeData) => {
|
||||
if (flowNodeData.inputs && flowNodeData.inputs.vectorStoreRetriever) {
|
||||
const vectorStoreRetriever = flowNodeData.inputs.vectorStoreRetriever
|
||||
if (typeof vectorStoreRetriever === 'string' && vectorStoreRetriever.includes('faiss')) return true
|
||||
if (
|
||||
typeof vectorStoreRetriever === 'object' &&
|
||||
vectorStoreRetriever.vectorStore &&
|
||||
vectorStoreRetriever.vectorStore.constructor.name === 'FaissStore'
|
||||
)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop through each inputs and resolve variable if neccessary
|
||||
* @param {INodeData} reactFlowNodeData
|
||||
@@ -426,11 +407,6 @@ export const resolveVariables = (
|
||||
chatHistory: IMessage[]
|
||||
): INodeData => {
|
||||
let flowNodeData = cloneDeep(reactFlowNodeData)
|
||||
if (reactFlowNodeData.instance && isVectorStoreFaiss(reactFlowNodeData)) {
|
||||
// omit and merge because cloneDeep of instance gives "Illegal invocation" Exception
|
||||
const flowNodeDataWithoutInstance = cloneDeep(omit(reactFlowNodeData, ['instance']))
|
||||
flowNodeData = merge(flowNodeDataWithoutInstance, { instance: reactFlowNodeData.instance })
|
||||
}
|
||||
const types = 'inputs'
|
||||
|
||||
const getParamValues = (paramsObj: ICommonObject) => {
|
||||
@@ -819,7 +795,7 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
|
||||
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name)
|
||||
}
|
||||
|
||||
return isChatOrLLMsExist && isValidChainOrAgent && !isVectorStoreFaiss(endingNodeData)
|
||||
return isChatOrLLMsExist && isValidChainOrAgent
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user