mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
update credentials
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { TextSplitter } from 'langchain/text_splitter'
|
||||
import { ConfluencePagesLoader, ConfluencePagesLoaderParams } from 'langchain/document_loaders/web/confluence'
|
||||
import { getCredentialData, getCredentialParam } from '../../../src'
|
||||
|
||||
class Confluence_DocumentLoaders implements INode {
|
||||
label: string
|
||||
@@ -10,6 +11,7 @@ class Confluence_DocumentLoaders implements INode {
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
@@ -20,6 +22,12 @@ class Confluence_DocumentLoaders implements INode {
|
||||
this.category = 'Document Loaders'
|
||||
this.description = `Load data from a Confluence Document`
|
||||
this.baseClasses = [this.type]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['confluenceApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Text Splitter',
|
||||
@@ -27,18 +35,6 @@ class Confluence_DocumentLoaders implements INode {
|
||||
type: 'TextSplitter',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Username',
|
||||
name: 'username',
|
||||
type: 'string',
|
||||
placeholder: '<CONFLUENCE_USERNAME>'
|
||||
},
|
||||
{
|
||||
label: 'Access Token',
|
||||
name: 'accessToken',
|
||||
type: 'password',
|
||||
placeholder: '<CONFLUENCE_ACCESS_TOKEN>'
|
||||
},
|
||||
{
|
||||
label: 'Base URL',
|
||||
name: 'baseUrl',
|
||||
@@ -49,7 +45,9 @@ class Confluence_DocumentLoaders implements INode {
|
||||
label: 'Space Key',
|
||||
name: 'spaceKey',
|
||||
type: 'string',
|
||||
placeholder: '~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE'
|
||||
placeholder: '~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE',
|
||||
description:
|
||||
'Refer to <a target="_blank" href="https://community.atlassian.com/t5/Confluence-questions/How-to-find-the-key-for-a-space/qaq-p/864760">official guide</a> on how to get Confluence Space Key'
|
||||
},
|
||||
{
|
||||
label: 'Limit',
|
||||
@@ -68,16 +66,18 @@ class Confluence_DocumentLoaders implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const username = nodeData.inputs?.username as string
|
||||
const accessToken = nodeData.inputs?.accessToken as string
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const spaceKey = nodeData.inputs?.spaceKey as string
|
||||
const baseUrl = nodeData.inputs?.baseUrl as string
|
||||
const limit = nodeData.inputs?.limit as number
|
||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||
const metadata = nodeData.inputs?.metadata
|
||||
|
||||
const options: ConfluencePagesLoaderParams = {
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const accessToken = getCredentialParam('accessToken', credentialData, nodeData)
|
||||
const username = getCredentialParam('username', credentialData, nodeData)
|
||||
|
||||
const confluenceOptions: ConfluencePagesLoaderParams = {
|
||||
username,
|
||||
accessToken,
|
||||
baseUrl,
|
||||
@@ -85,7 +85,7 @@ class Confluence_DocumentLoaders implements INode {
|
||||
limit
|
||||
}
|
||||
|
||||
const loader = new ConfluencePagesLoader(options)
|
||||
const loader = new ConfluencePagesLoader(confluenceOptions)
|
||||
|
||||
let docs = []
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getCredentialData, getCredentialParam } from '../../../src'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { FigmaFileLoader, FigmaLoaderParams } from 'langchain/document_loaders/web/figma'
|
||||
|
||||
class Figma_DocumentLoaders implements INode {
|
||||
@@ -9,34 +10,39 @@ class Figma_DocumentLoaders implements INode {
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Figma'
|
||||
this.name = 'figma'
|
||||
this.type = 'Document'
|
||||
this.icon = 'figma.png'
|
||||
this.icon = 'figma.svg'
|
||||
this.category = 'Document Loaders'
|
||||
this.description = 'Load data from a Figma file'
|
||||
this.baseClasses = [this.type]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['figmaApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Access Token',
|
||||
name: 'accessToken',
|
||||
type: 'password',
|
||||
placeholder: '<FIGMA_ACCESS_TOKEN>'
|
||||
},
|
||||
{
|
||||
label: 'File Key',
|
||||
name: 'fileKey',
|
||||
type: 'string',
|
||||
placeholder: 'key'
|
||||
placeholder: 'key',
|
||||
description:
|
||||
'The file key can be read from any Figma file URL: https://www.figma.com/file/:key/:title. For example, in https://www.figma.com/file/12345/Website, the file key is 12345'
|
||||
},
|
||||
{
|
||||
label: 'Node IDs',
|
||||
name: 'nodeIds',
|
||||
type: 'string',
|
||||
placeholder: '0, 1, 2'
|
||||
placeholder: '0, 1, 2',
|
||||
description:
|
||||
'A list of Node IDs, seperated by comma. Refer to <a target="_blank" href="https://www.figma.com/community/plugin/758276196886757462/Node-Inspector">official guide</a> on how to get Node IDs'
|
||||
},
|
||||
{
|
||||
label: 'Recursive',
|
||||
@@ -60,18 +66,20 @@ class Figma_DocumentLoaders implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const accessToken = nodeData.inputs?.accessToken as string
|
||||
const nodeIds = (nodeData.inputs?.nodeIds as string)?.split(',') || []
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const nodeIds = (nodeData.inputs?.nodeIds as string)?.trim().split(',') || []
|
||||
const fileKey = nodeData.inputs?.fileKey as string
|
||||
|
||||
const options: FigmaLoaderParams = {
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const accessToken = getCredentialParam('accessToken', credentialData, nodeData)
|
||||
|
||||
const figmaOptions: FigmaLoaderParams = {
|
||||
accessToken,
|
||||
nodeIds,
|
||||
fileKey
|
||||
}
|
||||
|
||||
const loader = new FigmaFileLoader(options)
|
||||
const loader = new FigmaFileLoader(figmaOptions)
|
||||
const docs = await loader.load()
|
||||
|
||||
return docs
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 172 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="96px" height="96px"><path fill="#e64a19" d="M26,17h-8c-3.866,0-7-3.134-7-7v0c0-3.866,3.134-7,7-7h8V17z"/><path fill="#7c4dff" d="M25,31h-7c-3.866,0-7-3.134-7-7v0c0-3.866,3.134-7,7-7h7V31z"/><path fill="#66bb6a" d="M18,45L18,45c-3.866,0-7-3.134-7-7v0c0-3.866,3.134-7,7-7h7v7C25,41.866,21.866,45,18,45z"/><path fill="#ff7043" d="M32,17h-7V3h7c3.866,0,7,3.134,7,7v0C39,13.866,35.866,17,32,17z"/><circle cx="32" cy="24" r="7" fill="#29b6f6"/></svg>
|
||||
|
After Width: | Height: | Size: 512 B |
@@ -1,6 +1,7 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { TextSplitter } from 'langchain/text_splitter'
|
||||
import { GithubRepoLoader, GithubRepoLoaderParams } from 'langchain/document_loaders/web/github'
|
||||
import { getCredentialData, getCredentialParam } from '../../../src'
|
||||
|
||||
class Github_DocumentLoaders implements INode {
|
||||
label: string
|
||||
@@ -10,6 +11,7 @@ class Github_DocumentLoaders implements INode {
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
@@ -20,6 +22,14 @@ class Github_DocumentLoaders implements INode {
|
||||
this.category = 'Document Loaders'
|
||||
this.description = `Load data from a GitHub repository`
|
||||
this.baseClasses = [this.type]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
description: 'Only needed when accessing private repo',
|
||||
optional: true,
|
||||
credentialNames: ['githubApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Repo Link',
|
||||
@@ -33,13 +43,6 @@ class Github_DocumentLoaders implements INode {
|
||||
type: 'string',
|
||||
default: 'main'
|
||||
},
|
||||
{
|
||||
label: 'Access Token',
|
||||
name: 'accessToken',
|
||||
type: 'password',
|
||||
placeholder: '<GITHUB_ACCESS_TOKEN>',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Recursive',
|
||||
name: 'recursive',
|
||||
@@ -62,23 +65,25 @@ class Github_DocumentLoaders implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const repoLink = nodeData.inputs?.repoLink as string
|
||||
const branch = nodeData.inputs?.branch as string
|
||||
const recursive = nodeData.inputs?.recursive as boolean
|
||||
const accessToken = nodeData.inputs?.accessToken as string
|
||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||
const metadata = nodeData.inputs?.metadata
|
||||
|
||||
const options: GithubRepoLoaderParams = {
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const accessToken = getCredentialParam('accessToken', credentialData, nodeData)
|
||||
|
||||
const githubOptions: GithubRepoLoaderParams = {
|
||||
branch,
|
||||
recursive,
|
||||
unknown: 'warn'
|
||||
}
|
||||
|
||||
if (accessToken) options.accessToken = accessToken
|
||||
if (accessToken) githubOptions.accessToken = accessToken
|
||||
|
||||
const loader = new GithubRepoLoader(repoLink, options)
|
||||
const loader = new GithubRepoLoader(repoLink, githubOptions)
|
||||
const docs = textSplitter ? await loader.loadAndSplit(textSplitter) : await loader.load()
|
||||
|
||||
if (metadata) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { TextSplitter } from 'langchain/text_splitter'
|
||||
import { NotionDBLoader, NotionDBLoaderParams } from 'langchain/document_loaders/web/notiondb'
|
||||
import { NotionAPILoader, NotionAPILoaderOptions } from 'langchain/document_loaders/web/notionapi'
|
||||
import { getCredentialData, getCredentialParam } from '../../../src'
|
||||
|
||||
class NotionDB_DocumentLoaders implements INode {
|
||||
label: string
|
||||
@@ -10,6 +11,7 @@ class NotionDB_DocumentLoaders implements INode {
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
@@ -18,8 +20,14 @@ class NotionDB_DocumentLoaders implements INode {
|
||||
this.type = 'Document'
|
||||
this.icon = 'notion.png'
|
||||
this.category = 'Document Loaders'
|
||||
this.description = 'Load data from Notion Database ID'
|
||||
this.description = 'Load data from Notion Database (each row is a separate document with all properties as metadata)'
|
||||
this.baseClasses = [this.type]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['notionApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Text Splitter',
|
||||
@@ -34,19 +42,6 @@ class NotionDB_DocumentLoaders implements INode {
|
||||
description:
|
||||
'If your URL looks like - https://www.notion.so/<long_hash_1>?v=<long_hash_2>, then <long_hash_1> is the database ID'
|
||||
},
|
||||
{
|
||||
label: 'Notion Integration Token',
|
||||
name: 'notionIntegrationToken',
|
||||
type: 'password',
|
||||
description:
|
||||
'You can find integration token <a target="_blank" href="https://developers.notion.com/docs/create-a-notion-integration#step-1-create-an-integration">here</a>'
|
||||
},
|
||||
{
|
||||
label: 'Page Size Limit',
|
||||
name: 'pageSizeLimit',
|
||||
type: 'number',
|
||||
default: 10
|
||||
},
|
||||
{
|
||||
label: 'Metadata',
|
||||
name: 'metadata',
|
||||
@@ -57,19 +52,22 @@ class NotionDB_DocumentLoaders implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||
const databaseId = nodeData.inputs?.databaseId as string
|
||||
const notionIntegrationToken = nodeData.inputs?.notionIntegrationToken as string
|
||||
const pageSizeLimit = nodeData.inputs?.pageSizeLimit as string
|
||||
const metadata = nodeData.inputs?.metadata
|
||||
|
||||
const obj: NotionDBLoaderParams = {
|
||||
pageSizeLimit: pageSizeLimit ? parseInt(pageSizeLimit, 10) : 10,
|
||||
databaseId,
|
||||
notionIntegrationToken
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const notionIntegrationToken = getCredentialParam('notionIntegrationToken', credentialData, nodeData)
|
||||
|
||||
const obj: NotionAPILoaderOptions = {
|
||||
clientOptions: {
|
||||
auth: notionIntegrationToken
|
||||
},
|
||||
id: databaseId,
|
||||
type: 'database'
|
||||
}
|
||||
const loader = new NotionDBLoader(obj)
|
||||
const loader = new NotionAPILoader(obj)
|
||||
|
||||
let docs = []
|
||||
if (textSplitter) {
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { TextSplitter } from 'langchain/text_splitter'
|
||||
import { NotionAPILoader, NotionAPILoaderOptions } from 'langchain/document_loaders/web/notionapi'
|
||||
import { getCredentialData, getCredentialParam } from '../../../src'
|
||||
|
||||
class NotionPage_DocumentLoaders implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Notion Page'
|
||||
this.name = 'notionPage'
|
||||
this.type = 'Document'
|
||||
this.icon = 'notion.png'
|
||||
this.category = 'Document Loaders'
|
||||
this.description = 'Load data from Notion Page (including child pages all as separate documents)'
|
||||
this.baseClasses = [this.type]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['notionApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Text Splitter',
|
||||
name: 'textSplitter',
|
||||
type: 'TextSplitter',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Notion Page Id',
|
||||
name: 'pageId',
|
||||
type: 'string',
|
||||
description:
|
||||
'The last The 32 char hex in the url path. For example: https://www.notion.so/skarard/LangChain-Notion-API-b34ca03f219c4420a6046fc4bdfdf7b4, b34ca03f219c4420a6046fc4bdfdf7b4 is the Page ID'
|
||||
},
|
||||
{
|
||||
label: 'Metadata',
|
||||
name: 'metadata',
|
||||
type: 'json',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||
const pageId = nodeData.inputs?.pageId as string
|
||||
const metadata = nodeData.inputs?.metadata
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const notionIntegrationToken = getCredentialParam('notionIntegrationToken', credentialData, nodeData)
|
||||
|
||||
const obj: NotionAPILoaderOptions = {
|
||||
clientOptions: {
|
||||
auth: notionIntegrationToken
|
||||
},
|
||||
id: pageId,
|
||||
type: 'page'
|
||||
}
|
||||
const loader = new NotionAPILoader(obj)
|
||||
|
||||
let docs = []
|
||||
if (textSplitter) {
|
||||
docs = await loader.loadAndSplit(textSplitter)
|
||||
} else {
|
||||
docs = await loader.load()
|
||||
}
|
||||
|
||||
if (metadata) {
|
||||
const parsedMetadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)
|
||||
let finaldocs = []
|
||||
for (const doc of docs) {
|
||||
const newdoc = {
|
||||
...doc,
|
||||
metadata: {
|
||||
...doc.metadata,
|
||||
...parsedMetadata
|
||||
}
|
||||
}
|
||||
finaldocs.push(newdoc)
|
||||
}
|
||||
return finaldocs
|
||||
}
|
||||
|
||||
return docs
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: NotionPage_DocumentLoaders }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user