mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
enable streaming
This commit is contained in:
@@ -610,3 +610,28 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[]) => {
|
||||
|
||||
return configs
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if flow valid for stream
|
||||
* @param {IReactFlowNode[]} reactFlowNodes
|
||||
* @param {INodeData} endingNodeData
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNodeData: INodeData) => {
|
||||
const streamAvailableLLMs = {
|
||||
'Chat Models': ['azureChatOpenAI', 'chatOpenAI', 'chatAnthropic'],
|
||||
LLMs: ['azureOpenAI', 'openAI']
|
||||
}
|
||||
|
||||
let isChatOrLLMsExist = false
|
||||
for (const flowNode of reactFlowNodes) {
|
||||
const data = flowNode.data
|
||||
if (data.category === 'Chat Models' || data.category === 'LLMs') {
|
||||
isChatOrLLMsExist = true
|
||||
const validLLMs = streamAvailableLLMs[data.category]
|
||||
if (!validLLMs.includes(data.name)) return false
|
||||
}
|
||||
}
|
||||
|
||||
return isChatOrLLMsExist && endingNodeData.category === 'Chains'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user