mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
Merge branch 'main' into feature/Credential
This commit is contained in:
@@ -77,6 +77,9 @@ class ConversationChain_Chains implements INode {
|
|||||||
finalText += finalDocs[i].pageContent
|
finalText += finalDocs[i].pageContent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const replaceChar: string[] = ['{', '}']
|
||||||
|
for (const char of replaceChar) finalText = finalText.replaceAll(char, '')
|
||||||
|
|
||||||
if (finalText) systemMessage = `${systemMessage}\nThe AI has the following context:\n${finalText}`
|
if (finalText) systemMessage = `${systemMessage}\nThe AI has the following context:\n${finalText}`
|
||||||
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ class ChatAnthropic_ChatModels implements INode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maxTokensToSample) obj.maxTokensToSample = parseInt(maxTokensToSample, 10)
|
if (maxTokensToSample) obj.maxTokensToSample = parseInt(maxTokensToSample, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (topK) obj.topK = parseInt(topK, 10)
|
if (topK) obj.topK = parseFloat(topK)
|
||||||
|
|
||||||
const model = new ChatAnthropic(obj)
|
const model = new ChatAnthropic(obj)
|
||||||
return model
|
return model
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ class ChatHuggingFace_ChatModels implements INode {
|
|||||||
|
|
||||||
if (temperature) obj.temperature = parseFloat(temperature)
|
if (temperature) obj.temperature = parseFloat(temperature)
|
||||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (hfTopK) obj.topK = parseInt(hfTopK, 10)
|
if (hfTopK) obj.topK = parseFloat(hfTopK)
|
||||||
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
||||||
if (endpoint) obj.endpoint = endpoint
|
if (endpoint) obj.endpoint = endpoint
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class ChatLocalAI_ChatModels implements INode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (timeout) obj.timeout = parseInt(timeout, 10)
|
if (timeout) obj.timeout = parseInt(timeout, 10)
|
||||||
|
|
||||||
const model = new OpenAIChat(obj, { basePath })
|
const model = new OpenAIChat(obj, { basePath })
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class ChatOpenAI_ChatModels implements INode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
||||||
if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10)
|
if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10)
|
||||||
if (timeout) obj.timeout = parseInt(timeout, 10)
|
if (timeout) obj.timeout = parseInt(timeout, 10)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class AzureOpenAI_LLMs implements INode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
||||||
if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10)
|
if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10)
|
||||||
if (timeout) obj.timeout = parseInt(timeout, 10)
|
if (timeout) obj.timeout = parseInt(timeout, 10)
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ class HuggingFaceInference_LLMs implements INode {
|
|||||||
|
|
||||||
if (temperature) obj.temperature = parseFloat(temperature)
|
if (temperature) obj.temperature = parseFloat(temperature)
|
||||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (hfTopK) obj.topK = parseInt(hfTopK, 10)
|
if (hfTopK) obj.topK = parseFloat(hfTopK)
|
||||||
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
||||||
if (endpoint) obj.endpoint = endpoint
|
if (endpoint) obj.endpoint = endpoint
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class OpenAI_LLMs implements INode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseInt(topP, 10)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10)
|
||||||
if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10)
|
if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10)
|
||||||
if (timeout) obj.timeout = parseInt(timeout, 10)
|
if (timeout) obj.timeout = parseInt(timeout, 10)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class Chroma_Existing_VectorStores implements INode {
|
|||||||
const chromaURL = nodeData.inputs?.chromaURL as string
|
const chromaURL = nodeData.inputs?.chromaURL as string
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const obj: {
|
const obj: {
|
||||||
collectionName: string
|
collectionName: string
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class ChromaUpsert_VectorStores implements INode {
|
|||||||
const chromaURL = nodeData.inputs?.chromaURL as string
|
const chromaURL = nodeData.inputs?.chromaURL as string
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||||
const finalDocs = []
|
const finalDocs = []
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class Faiss_Existing_VectorStores implements INode {
|
|||||||
const basePath = nodeData.inputs?.basePath as string
|
const basePath = nodeData.inputs?.basePath as string
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const vectorStore = await FaissStore.load(basePath, embeddings)
|
const vectorStore = await FaissStore.load(basePath, embeddings)
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class FaissUpsert_VectorStores implements INode {
|
|||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const basePath = nodeData.inputs?.basePath as string
|
const basePath = nodeData.inputs?.basePath as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||||
const finalDocs = []
|
const finalDocs = []
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class InMemoryVectorStore_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||||
const finalDocs = []
|
const finalDocs = []
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class OpenSearch_Existing_VectorStores implements INode {
|
|||||||
const indexName = nodeData.inputs?.indexName as string
|
const indexName = nodeData.inputs?.indexName as string
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
nodes: [opensearchURL]
|
nodes: [opensearchURL]
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class OpenSearchUpsert_VectorStores implements INode {
|
|||||||
const indexName = nodeData.inputs?.indexName as string
|
const indexName = nodeData.inputs?.indexName as string
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||||
const finalDocs = []
|
const finalDocs = []
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Pinecone_Existing_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class PineconeUpsert_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Qdrant_Existing_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData)
|
const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class QdrantUpsert_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData)
|
const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class SingleStoreExisting_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
let vectorStore: SingleStoreVectorStore
|
let vectorStore: SingleStoreVectorStore
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class SingleStoreUpsert_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||||
const finalDocs = []
|
const finalDocs = []
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class Supabase_Existing_VectorStores implements INode {
|
|||||||
const supabaseMetadataFilter = nodeData.inputs?.supabaseMetadataFilter
|
const supabaseMetadataFilter = nodeData.inputs?.supabaseMetadataFilter
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData)
|
const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class SupabaseUpsert_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData)
|
const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class Weaviate_Existing_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData)
|
const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData)
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class WeaviateUpsert_VectorStores implements INode {
|
|||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const output = nodeData.outputs?.output as string
|
const output = nodeData.outputs?.output as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const k = topK ? parseInt(topK, 10) : 4
|
const k = topK ? parseFloat(topK) : 4
|
||||||
|
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData)
|
const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData)
|
||||||
|
|||||||
Reference in New Issue
Block a user