mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 13:00:56 +03:00
Chore/LC v0.3 (#3517)
* bump langchain version to 0.3, upgrades on all chat models * update all docs loader to have documents and text output options * fix pnpm lock file
This commit is contained in:
@@ -92,11 +92,11 @@ export const utilGetUploadsConfig = async (chatflowid: string): Promise<IUploadC
|
||||
'supervisor',
|
||||
'seqStart'
|
||||
]
|
||||
const imgUploadLLMNodes = ['chatOpenAI', 'chatAnthropic', 'awsChatBedrock', 'azureChatOpenAI', 'chatGoogleGenerativeAI', 'chatOllama']
|
||||
|
||||
if (nodes.some((node) => imgUploadAllowedNodes.includes(node.data.name))) {
|
||||
nodes.forEach((node: IReactFlowNode) => {
|
||||
if (imgUploadLLMNodes.indexOf(node.data.name) > -1) {
|
||||
const data = node.data
|
||||
if (data.category === 'Chat Models' && data.inputs?.['allowImageUploads'] === true) {
|
||||
// TODO: for now the maxUploadSize is hardcoded to 5MB, we need to add it to the node properties
|
||||
node.data.inputParams.map((param: INodeParams) => {
|
||||
if (param.name === 'allowImageUploads' && node.data.inputs?.['allowImageUploads']) {
|
||||
|
||||
@@ -1269,6 +1269,7 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], component
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNodeData: INodeData) => {
|
||||
/** Deprecated, add streaming input param to the component instead **/
|
||||
const streamAvailableLLMs = {
|
||||
'Chat Models': [
|
||||
'azureChatOpenAI',
|
||||
@@ -1299,9 +1300,18 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
|
||||
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
|
||||
if (data.inputs?.streaming === false || data.inputs?.streaming === 'false') {
|
||||
return false
|
||||
}
|
||||
if (data.inputs?.streaming === true || data.inputs?.streaming === 'true') {
|
||||
isChatOrLLMsExist = true // passed, proceed to next check
|
||||
}
|
||||
/** Deprecated, add streaming input param to the component instead **/
|
||||
if (!Object.prototype.hasOwnProperty.call(data.inputs, 'streaming') && !data.inputs?.streaming) {
|
||||
isChatOrLLMsExist = true
|
||||
const validLLMs = streamAvailableLLMs[data.category]
|
||||
if (!validLLMs.includes(data.name)) return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1312,29 +1322,9 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
|
||||
isValidChainOrAgent = !blacklistChains.includes(endingNodeData.name)
|
||||
} else if (endingNodeData.category === 'Agents') {
|
||||
// Agent that are available to stream
|
||||
const whitelistAgents = [
|
||||
'openAIFunctionAgent',
|
||||
'mistralAIToolAgent',
|
||||
'csvAgent',
|
||||
'airtableAgent',
|
||||
'conversationalRetrievalAgent',
|
||||
'openAIToolAgent',
|
||||
'toolAgent',
|
||||
'conversationalRetrievalToolAgent',
|
||||
'openAIToolAgentLlamaIndex'
|
||||
]
|
||||
const whitelistAgents = ['csvAgent', 'airtableAgent', 'toolAgent', 'conversationalRetrievalToolAgent', 'openAIToolAgentLlamaIndex']
|
||||
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name)
|
||||
|
||||
// Anthropic streaming has some bug where the log is being sent, temporarily disabled
|
||||
const model = endingNodeData.inputs?.model
|
||||
if (endingNodeData.name.includes('toolAgent')) {
|
||||
if (typeof model === 'string' && model.includes('chatAnthropic')) {
|
||||
return false
|
||||
} else if (typeof model === 'object' && 'id' in model && model['id'].includes('chatAnthropic')) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// If agent is openAIAssistant, streaming is enabled
|
||||
if (endingNodeData.name === 'openAIAssistant') return true
|
||||
} else if (endingNodeData.category === 'Engine') {
|
||||
|
||||
Reference in New Issue
Block a user