fixed the prettier error

This commit is contained in:
Pravesh-mansharamani
2023-06-15 21:00:19 +05:30
parent b499d30774
commit 410b1249c2
@@ -1,81 +1,81 @@
import { INode, INodeData, INodeParams } from '../../../src/Interface'; import { INode, INodeData, INodeParams } from '../../../src/Interface'
import { FigmaFileLoader, FigmaLoaderParams } from 'langchain/document_loaders/web/figma'; import { FigmaFileLoader, FigmaLoaderParams } from 'langchain/document_loaders/web/figma'
class Figma_DocumentLoaders implements INode { class Figma_DocumentLoaders implements INode {
label: string; label: string
name: string; name: string
description: string; description: string
type: string; type: string
icon: string; icon: string
category: string; category: string
baseClasses: string[]; baseClasses: string[]
inputs: INodeParams[]; inputs: INodeParams[]
constructor() { constructor() {
this.label = 'Figma'; this.label = 'Figma'
this.name = 'figma'; this.name = 'figma'
this.type = 'Document'; this.type = 'Document'
this.icon = 'figma.png'; this.icon = 'figma.png'
this.category = 'Document Loaders'; this.category = 'Document Loaders'
this.description = 'Load data from a Figma file'; this.description = 'Load data from a Figma file'
this.baseClasses = [this.type]; this.baseClasses = [this.type]
this.inputs = [ this.inputs = [
{ {
label: 'Access Token', label: 'Access Token',
name: 'accessToken', name: 'accessToken',
type: 'password', type: 'password',
placeholder: '<FIGMA_ACCESS_TOKEN>', placeholder: '<FIGMA_ACCESS_TOKEN>'
}, },
{ {
label: 'File Key', label: 'File Key',
name: 'fileKey', name: 'fileKey',
type: 'string', type: 'string',
placeholder: 'key', placeholder: 'key'
}, },
{ {
label: 'Node IDs', label: 'Node IDs',
name: 'nodeIds', name: 'nodeIds',
type: 'string', type: 'string',
placeholder: '0, 1, 2', placeholder: '0, 1, 2'
}, },
{ {
label: 'Recursive', label: 'Recursive',
name: 'recursive', name: 'recursive',
type: 'boolean', type: 'boolean',
optional: true optional: true
}, },
{ {
label: 'Text Splitter', label: 'Text Splitter',
name: 'textSplitter', name: 'textSplitter',
type: 'TextSplitter', type: 'TextSplitter',
optional: true optional: true
}, },
{ {
label: 'Metadata', label: 'Metadata',
name: 'metadata', name: 'metadata',
type: 'json', type: 'json',
optional: true, optional: true,
additionalParams: true additionalParams: true
} }
]; ]
} }
async init(nodeData: INodeData): Promise<any> { async init(nodeData: INodeData): Promise<any> {
const accessToken = nodeData.inputs?.accessToken as string; const accessToken = nodeData.inputs?.accessToken as string
const nodeIds = (nodeData.inputs?.nodeIds as string)?.split(',') || []; const nodeIds = (nodeData.inputs?.nodeIds as string)?.split(',') || []
const fileKey = nodeData.inputs?.fileKey as string; const fileKey = nodeData.inputs?.fileKey as string
const options: FigmaLoaderParams = { const options: FigmaLoaderParams = {
accessToken, accessToken,
nodeIds, nodeIds,
fileKey, fileKey
}; }
const loader = new FigmaFileLoader(options); const loader = new FigmaFileLoader(options)
const docs = await loader.load(); const docs = await loader.load()
return docs; return docs
} }
} }
module.exports = { nodeClass: Figma_DocumentLoaders }; module.exports = { nodeClass: Figma_DocumentLoaders }