fix namings, update description, show badge and node info

This commit is contained in:
Henry 2023-11-22 19:48:01 +00:00
parent 44cadc1cc3
commit 7d13b6323f
30 changed files with 214 additions and 123 deletions

View File

@ -104,7 +104,7 @@ class HydeRetriever_Retrievers implements INode {
const promptKey = nodeData.inputs?.promptKey as PromptKey const promptKey = nodeData.inputs?.promptKey as PromptKey
const customPrompt = nodeData.inputs?.customPrompt as string const customPrompt = nodeData.inputs?.customPrompt 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: HydeRetrieverOptions<any> = { const obj: HydeRetrieverOptions<any> = {
llm, llm,

View File

@ -27,7 +27,7 @@ class Chroma_VectorStores implements INode {
this.type = 'Chroma' this.type = 'Chroma'
this.icon = 'chroma.svg' this.icon = 'chroma.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Chroma Vector Database' this.description = 'Upsert embedded data and perform similarity search upon query using Chroma, an open-source embedding database'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {

View File

@ -24,7 +24,8 @@ class Elasticsearch_VectorStores implements INode {
this.label = 'Elasticsearch' this.label = 'Elasticsearch'
this.name = 'elasticsearch' this.name = 'elasticsearch'
this.version = 1.0 this.version = 1.0
this.description = 'Upsert or Load data to Elasticsearch Vector Database' this.description =
'Upsert embedded data and perform similarity search upon query using Elasticsearch, a distributed search and analytics engine'
this.type = 'Elasticsearch' this.type = 'Elasticsearch'
this.icon = 'elasticsearch.png' this.icon = 'elasticsearch.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'

View File

@ -25,7 +25,7 @@ class Faiss_VectorStores implements INode {
this.type = 'Faiss' this.type = 'Faiss'
this.icon = 'faiss.svg' this.icon = 'faiss.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Faiss Vector Store' this.description = 'Upsert embedded data and perform similarity search upon query using Faiss library from Meta'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.inputs = [ this.inputs = [

View File

@ -31,7 +31,7 @@ class Milvus_VectorStores implements INode {
this.type = 'Milvus' this.type = 'Milvus'
this.icon = 'milvus.svg' this.icon = 'milvus.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Milvus Vector Database' this.description = `Upsert embedded data and perform similarity search upon query using Milvus, world's most advanced open-source vector database`
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {
@ -159,7 +159,7 @@ class Milvus_VectorStores implements INode {
const output = nodeData.outputs?.output as string const output = nodeData.outputs?.output as string
// format data // format data
const k = topK ? parseInt(topK, 10) : 4 const k = topK ? parseFloat(topK) : 4
// credential // credential
const credentialData = await getCredentialData(nodeData.credential ?? '', options) const credentialData = await getCredentialData(nodeData.credential ?? '', options)

View File

@ -26,7 +26,7 @@ class OpenSearch_VectorStores implements INode {
this.type = 'OpenSearch' this.type = 'OpenSearch'
this.icon = 'opensearch.png' this.icon = 'opensearch.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to OpenSearch Vector Database' this.description = `Upsert embedded data and perform similarity search upon query using OpenSearch, an open-source, all-in-one vector database`
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.inputs = [ this.inputs = [

View File

@ -27,7 +27,7 @@ class Pinecone_VectorStores implements INode {
this.type = 'Pinecone' this.type = 'Pinecone'
this.icon = 'pinecone.png' this.icon = 'pinecone.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Pinecone Vector Database' this.description = `Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database`
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {

View File

@ -28,7 +28,7 @@ class Postgres_VectorStores implements INode {
this.type = 'Postgres' this.type = 'Postgres'
this.icon = 'postgres.svg' this.icon = 'postgres.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Postgres using pgvector' this.description = 'Upsert embedded data and perform similarity search upon query using pgvector on Postgres'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {

View File

@ -30,7 +30,8 @@ class Qdrant_VectorStores implements INode {
this.type = 'Qdrant' this.type = 'Qdrant'
this.icon = 'qdrant.png' this.icon = 'qdrant.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Qdrant Vector Database' this.description =
'Upsert embedded data and perform similarity search upon query using Qdrant, a scalable open source vector database written in Rust'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {

View File

@ -25,7 +25,8 @@ class Redis_VectorStores implements INode {
this.label = 'Redis' this.label = 'Redis'
this.name = 'redis' this.name = 'redis'
this.version = 1.0 this.version = 1.0
this.description = 'Upsert or Load data to Redis' this.description =
'Upsert embedded data and perform similarity search upon query using Redis, an open source, in-memory data structure store'
this.type = 'Redis' this.type = 'Redis'
this.icon = 'redis.svg' this.icon = 'redis.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'

View File

@ -26,7 +26,8 @@ class SingleStore_VectorStores implements INode {
this.type = 'SingleStore' this.type = 'SingleStore'
this.icon = 'singlestore.svg' this.icon = 'singlestore.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to SingleStore Vector Database' this.description =
'Upsert embedded data and perform similarity search upon query using SingleStore, a fast and distributed cloud relational database'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {
@ -180,9 +181,7 @@ class SingleStore_VectorStores implements INode {
const topK = nodeData.inputs?.topK as string const topK = nodeData.inputs?.topK as string
const k = topK ? parseFloat(topK) : 4 const k = topK ? parseFloat(topK) : 4
let vectorStore: SingleStoreVectorStore const vectorStore = new SingleStoreVectorStore(embeddings, singleStoreConnectionConfig)
vectorStore = new SingleStoreVectorStore(embeddings, singleStoreConnectionConfig)
if (output === 'retriever') { if (output === 'retriever') {
const retriever = vectorStore.asRetriever(k) const retriever = vectorStore.asRetriever(k)

View File

@ -27,7 +27,7 @@ class Supabase_VectorStores implements INode {
this.type = 'Supabase' this.type = 'Supabase'
this.icon = 'supabase.svg' this.icon = 'supabase.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Supabase using pgvector' this.description = 'Upsert embedded data and perform similarity search upon query using Supabase via pgvector extension'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {
@ -112,7 +112,9 @@ class Supabase_VectorStores implements INode {
const flattenDocs = docs && docs.length ? flatten(docs) : [] const flattenDocs = docs && docs.length ? flatten(docs) : []
const finalDocs = [] const finalDocs = []
for (let i = 0; i < flattenDocs.length; i += 1) { for (let i = 0; i < flattenDocs.length; i += 1) {
finalDocs.push(new Document(flattenDocs[i])) if (flattenDocs[i] && flattenDocs[i].pageContent) {
finalDocs.push(new Document(flattenDocs[i]))
}
} }
try { try {

View File

@ -26,7 +26,7 @@ class Vectara_VectorStores implements INode {
this.type = 'Vectara' this.type = 'Vectara'
this.icon = 'vectara.png' this.icon = 'vectara.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Vectara Vector Database' this.description = 'Upsert embedded data and perform similarity search upon query using Vectara, a LLM-powered search-as-a-service'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {
@ -65,6 +65,7 @@ class Vectara_VectorStores implements INode {
name: 'sentencesBefore', name: 'sentencesBefore',
description: 'Number of sentences to fetch before the matched sentence. Defaults to 2.', description: 'Number of sentences to fetch before the matched sentence. Defaults to 2.',
type: 'number', type: 'number',
default: 2,
additionalParams: true, additionalParams: true,
optional: true optional: true
}, },
@ -73,6 +74,7 @@ class Vectara_VectorStores implements INode {
name: 'sentencesAfter', name: 'sentencesAfter',
description: 'Number of sentences to fetch after the matched sentence. Defaults to 2.', description: 'Number of sentences to fetch after the matched sentence. Defaults to 2.',
type: 'number', type: 'number',
default: 2,
additionalParams: true, additionalParams: true,
optional: true optional: true
}, },
@ -189,7 +191,7 @@ class Vectara_VectorStores implements INode {
const lambda = nodeData.inputs?.lambda as number const lambda = nodeData.inputs?.lambda as number
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 vectaraArgs: VectaraLibArgs = { const vectaraArgs: VectaraLibArgs = {
apiKey: apiKey, apiKey: apiKey,

View File

@ -27,7 +27,8 @@ class Weaviate_VectorStores implements INode {
this.type = 'Weaviate' this.type = 'Weaviate'
this.icon = 'weaviate.png' this.icon = 'weaviate.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Weaviate Vector Database' this.description =
'Upsert embedded data and perform similarity search upon query using Weaviate, a scalable open-source vector database'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {

View File

@ -27,7 +27,8 @@ class Zep_VectorStores implements INode {
this.type = 'Zep' this.type = 'Zep'
this.icon = 'zep.png' this.icon = 'zep.png'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = 'Upsert or Load data to Zep Vector Database' this.description =
'Upsert embedded data and perform similarity search upon query using Zep, a fast and scalable building block for LLM apps'
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {

View File

@ -511,7 +511,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -166,7 +166,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -301,7 +301,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -553,7 +553,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -555,7 +555,7 @@
"type": "Faiss", "type": "Faiss",
"baseClasses": ["Faiss", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Faiss", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Faiss Vector Store", "description": "Upsert embedded data and perform similarity search upon query using Faiss library from Meta",
"inputParams": [ "inputParams": [
{ {
"label": "Base Path to load", "label": "Base Path to load",

View File

@ -351,7 +351,7 @@
"type": "Qdrant", "type": "Qdrant",
"baseClasses": ["Qdrant", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Qdrant", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Qdrant Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Qdrant, a scalable open source vector database written in Rust",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -634,7 +634,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -560,7 +560,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -678,7 +678,7 @@
"type": "Chroma", "type": "Chroma",
"baseClasses": ["Chroma", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Chroma", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Chroma Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Chroma, an open-source embedding database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -796,7 +796,7 @@
"type": "Supabase", "type": "Supabase",
"baseClasses": ["Supabase", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Supabase", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Supabase using pgvector", "description": "Upsert embedded data and perform similarity search upon query using Supabase via pgvector extension",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -634,7 +634,7 @@
"type": "Redis", "type": "Redis",
"baseClasses": ["Redis", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Redis", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Redis", "description": "Upsert embedded data and perform similarity search upon query using Redis, an open source, in-memory data structure store",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -776,7 +776,7 @@
"type": "Faiss", "type": "Faiss",
"baseClasses": ["Faiss", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Faiss", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Faiss Vector Store", "description": "Upsert embedded data and perform similarity search upon query using Faiss library from Meta",
"inputParams": [ "inputParams": [
{ {
"label": "Base Path to load", "label": "Base Path to load",

View File

@ -792,7 +792,7 @@
"type": "SingleStore", "type": "SingleStore",
"baseClasses": ["SingleStore", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["SingleStore", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to SingleStore Vector Database", "description": "Upsert embedded data and perform similarity search upon query using SingleStore, a fast and distributed cloud relational database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -305,7 +305,7 @@
"type": "Vectara", "type": "Vectara",
"baseClasses": ["Vectara", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Vectara", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Vectara Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Vectara, a LLM-powered search-as-a-service",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -654,7 +654,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert or Load data to Pinecone Vector Database", "description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",

View File

@ -106,6 +106,32 @@ const NodeInfoDialog = ({ show, dialogProps, onCancel }) => {
<span style={{ color: '#606c38', fontSize: '0.825rem' }}>version {dialogProps.data.version}</span> <span style={{ color: '#606c38', fontSize: '0.825rem' }}>version {dialogProps.data.version}</span>
</div> </div>
)} )}
{dialogProps.data.badge && (
<div
style={{
display: 'flex',
flexDirection: 'row',
width: 'max-content',
borderRadius: 15,
background: dialogProps.data.badge === 'DEPRECATING' ? '#ffe57f' : '#52b69a',
padding: 5,
paddingLeft: 10,
paddingRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5
}}
>
<span
style={{
color: dialogProps.data.badge !== 'DEPRECATING' ? 'white' : 'inherit',
fontSize: '0.825rem'
}}
>
{dialogProps.data.badge}
</span>
</div>
)}
</div> </div>
</div> </div>
</div> </div>

View File

@ -57,6 +57,22 @@ const AddNodes = ({ nodesData, node }) => {
const prevOpen = useRef(open) const prevOpen = useRef(open)
const ps = useRef() const ps = useRef()
// Temporary method to handle Deprecating Vector Store and New ones
const categorizeVectorStores = (nodes) => {
const obj = { ...nodes }
const vsNodes = obj['Vector Stores'] ?? []
const deprecatingNodes = []
const newNodes = []
for (const vsNode of vsNodes) {
if (vsNode.badge === 'DEPRECATING') deprecatingNodes.push(vsNode)
else newNodes.push(vsNode)
}
delete obj['Vector Stores']
obj['Vector Stores;DEPRECATING'] = deprecatingNodes
obj['Vector Stores;NEW'] = newNodes
setNodes(obj)
}
const scrollTop = () => { const scrollTop = () => {
const curr = ps.current const curr = ps.current
if (curr) { if (curr) {
@ -96,6 +112,7 @@ const AddNodes = ({ nodesData, node }) => {
return r return r
}, Object.create(null)) }, Object.create(null))
setNodes(result) setNodes(result)
categorizeVectorStores(result)
setCategoryExpanded(accordianCategories) setCategoryExpanded(accordianCategories)
} }
@ -138,6 +155,8 @@ const AddNodes = ({ nodesData, node }) => {
groupByCategory(nodesData) groupByCategory(nodesData)
dispatch({ type: SET_COMPONENT_NODES, componentNodes: nodesData }) dispatch({ type: SET_COMPONENT_NODES, componentNodes: nodesData })
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [nodesData, dispatch]) }, [nodesData, dispatch])
return ( return (
@ -250,99 +269,135 @@ const AddNodes = ({ nodesData, node }) => {
> >
{Object.keys(nodes) {Object.keys(nodes)
.sort() .sort()
.map((category) => ( .map((category) =>
<Accordion category === 'Vector Stores' ? (
expanded={categoryExpanded[category] || false} <></>
onChange={handleAccordionChange(category)} ) : (
key={category} <Accordion
disableGutters expanded={categoryExpanded[category] || false}
> onChange={handleAccordionChange(category)}
<AccordionSummary key={category}
expandIcon={<ExpandMoreIcon />} disableGutters
aria-controls={`nodes-accordian-${category}`}
id={`nodes-accordian-header-${category}`}
> >
<Typography variant='h5'>{category}</Typography> <AccordionSummary
</AccordionSummary> expandIcon={<ExpandMoreIcon />}
<AccordionDetails> aria-controls={`nodes-accordian-${category}`}
{nodes[category].map((node, index) => ( id={`nodes-accordian-header-${category}`}
<div >
key={node.name} {category.split(';').length > 1 ? (
onDragStart={(event) => onDragStart(event, node)} <div
draggable style={{
> display: 'flex',
<ListItemButton flexDirection: 'row',
sx={{ alignItems: 'center'
p: 0,
borderRadius: `${customization.borderRadius}px`,
cursor: 'move'
}} }}
> >
<ListItem alignItems='center'> <Typography variant='h5'>{category.split(';')[0]}</Typography>
<ListItemAvatar> &nbsp;
<div <Chip
style={{ sx={{
width: 50, width: 'max-content',
height: 50, fontWeight: 700,
borderRadius: '50%', fontSize: '0.65rem',
backgroundColor: 'white' background:
}} category.split(';')[1] === 'DEPRECATING'
> ? theme.palette.warning.main
<img : theme.palette.teal.main,
style={{ color:
width: '100%', category.split(';')[1] !== 'DEPRECATING'
height: '100%', ? 'white'
padding: 10, : 'inherit'
objectFit: 'contain' }}
}} size='small'
alt={node.name} label={category.split(';')[1]}
src={`${baseURL}/api/v1/node-icon/${node.name}`} />
/> </div>
</div> ) : (
</ListItemAvatar> <Typography variant='h5'>{category}</Typography>
<ListItemText )}
sx={{ ml: 1 }} </AccordionSummary>
primary={ <AccordionDetails>
{nodes[category].map((node, index) => (
<div
key={node.name}
onDragStart={(event) => onDragStart(event, node)}
draggable
>
<ListItemButton
sx={{
p: 0,
borderRadius: `${customization.borderRadius}px`,
cursor: 'move'
}}
>
<ListItem alignItems='center'>
<ListItemAvatar>
<div <div
style={{ style={{
display: 'flex', width: 50,
flexDirection: 'row', height: 50,
alignItems: 'center' borderRadius: '50%',
backgroundColor: 'white'
}} }}
> >
<span>{node.label}</span> <img
&nbsp; style={{
{node.badge && ( width: '100%',
<Chip height: '100%',
sx={{ padding: 10,
width: 'max-content', objectFit: 'contain'
fontWeight: 700, }}
fontSize: '0.65rem', alt={node.name}
background: src={`${baseURL}/api/v1/node-icon/${node.name}`}
node.badge === 'DEPRECATING' />
? theme.palette.warning.main
: theme.palette.teal.main,
color:
node.badge !== 'DEPRECATING'
? 'white'
: 'inherit'
}}
size='small'
label={node.badge}
/>
)}
</div> </div>
} </ListItemAvatar>
secondary={node.description} <ListItemText
/> sx={{ ml: 1 }}
</ListItem> primary={
</ListItemButton> <div
{index === nodes[category].length - 1 ? null : <Divider />} style={{
</div> display: 'flex',
))} flexDirection: 'row',
</AccordionDetails> alignItems: 'center'
</Accordion> }}
))} >
<span>{node.label}</span>
&nbsp;
{node.badge && (
<Chip
sx={{
width: 'max-content',
fontWeight: 700,
fontSize: '0.65rem',
background:
node.badge === 'DEPRECATING'
? theme.palette.warning
.main
: theme.palette.teal
.main,
color:
node.badge !== 'DEPRECATING'
? 'white'
: 'inherit'
}}
size='small'
label={node.badge}
/>
)}
</div>
}
secondary={node.description}
/>
</ListItem>
</ListItemButton>
{index === nodes[category].length - 1 ? null : <Divider />}
</div>
))}
</AccordionDetails>
</Accordion>
)
)}
</List> </List>
</Box> </Box>
</PerfectScrollbar> </PerfectScrollbar>

View File

@ -83,8 +83,10 @@ const CanvasNode = ({ data }) => {
if (componentNode) { if (componentNode) {
if (!data.version) { if (!data.version) {
setWarningMessage(nodeVersionEmptyMessage(componentNode.version)) setWarningMessage(nodeVersionEmptyMessage(componentNode.version))
} else { } else if (data.version && componentNode.version > data.version) {
if (componentNode.version > data.version) setWarningMessage(nodeOutdatedMessage(data.version, componentNode.version)) setWarningMessage(nodeOutdatedMessage(data.version, componentNode.version))
} else if (componentNode.badge === 'DEPRECATING') {
setWarningMessage('This node will be deprecated in the next release. Change to a new node tagged with NEW')
} }
} }
}, [canvas.componentNodes, data.name, data.version]) }, [canvas.componentNodes, data.name, data.version])