first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
+102
@@ -0,0 +1,102 @@
|
||||
import type { TextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
logWrapper,
|
||||
N8nJsonLoader,
|
||||
getConnectionHintNoticeField,
|
||||
metadataFilterField,
|
||||
} from '@n8n/ai-utilities';
|
||||
|
||||
export class DocumentJsonInputLoader implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
// This node is deprecated and will be removed in the future.
|
||||
// The functionality was merged with the `DocumentBinaryInputLoader` to `DocumentDefaultDataLoader`
|
||||
hidden: true,
|
||||
displayName: 'JSON Input Loader',
|
||||
name: 'documentJsonInputLoader',
|
||||
icon: 'file:json.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
description: 'Use JSON data from a previous step in the workflow',
|
||||
defaults: {
|
||||
name: 'JSON Input Loader',
|
||||
},
|
||||
codex: {
|
||||
categories: ['AI'],
|
||||
subcategories: {
|
||||
AI: ['Document Loaders'],
|
||||
},
|
||||
resources: {
|
||||
primaryDocumentation: [
|
||||
{
|
||||
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.documentdefaultdataloader/',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
inputs: [
|
||||
{
|
||||
displayName: 'Text Splitter',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionTypes.AiTextSplitter,
|
||||
},
|
||||
],
|
||||
inputNames: ['Text Splitter'],
|
||||
|
||||
outputs: [NodeConnectionTypes.AiDocument],
|
||||
outputNames: ['Document'],
|
||||
builderHint: {
|
||||
inputs: {
|
||||
ai_textSplitter: { required: false },
|
||||
},
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Pointers',
|
||||
name: 'pointers',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Pointers to extract from JSON, e.g. "/text" or "/text, /meta/title"',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Option',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
...metadataFilterField,
|
||||
displayName: 'Metadata',
|
||||
description:
|
||||
'Metadata to add to each document. Could be used for filtering during retrieval',
|
||||
placeholder: 'Add property',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
||||
this.logger.debug('Supply Data for JSON Input Loader');
|
||||
const textSplitter = (await this.getInputConnectionData(
|
||||
NodeConnectionTypes.AiTextSplitter,
|
||||
0,
|
||||
)) as TextSplitter | undefined;
|
||||
|
||||
const processor = new N8nJsonLoader(this, undefined, textSplitter);
|
||||
|
||||
return {
|
||||
response: logWrapper(processor, this),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="800" height="800" fill="#7D7D87" viewBox="0 0 58 58"><path d="m50.949 12.187-1.361-1.361-9.504-9.505-.002-.001-.77-.771A1.87 1.87 0 0 0 37.985 0H8.963C7.776 0 6.5.916 6.5 2.926V56c0 .837.841 1.652 1.836 1.909.051.014.1.033.152.043q.235.047.475.048h40.074q.24 0 .475-.048c.052-.01.101-.029.152-.043.995-.257 1.836-1.072 1.836-1.909V13.978c0-.767-.093-1.334-.551-1.791M39.5 3.565 47.935 12H39.5zM8.963 56c-.071 0-.135-.025-.198-.049a.46.46 0 0 1-.265-.414V41h41v14.537a.46.46 0 0 1-.265.414c-.063.024-.127.049-.198.049zM8.5 39V2.926c0-.217.033-.926.463-.926h28.595a1.5 1.5 0 0 0-.058.391V13.78a2.98 2.98 0 0 0-2-.78 1 1 0 1 0 0 2c.552 0 1 .449 1 1v4c0 1.2.542 2.266 1.382 3a3.98 3.98 0 0 0-1.382 3v4c0 .551-.448 1-1 1a1 1 0 1 0 0 2c1.654 0 3-1.346 3-3v-4c0-1.103.897-2 2-2a1 1 0 1 0 0-2c-1.103 0-2-.897-2-2v-4a2.98 2.98 0 0 0-.78-2h11.389c.135 0 .265-.025.391-.058l.001.036V39z"/><path d="M16.354 51.43q-.028.67-.458.95c-.43.28-.672.28-1.155.28q-.287 0-.615-.068c-.328-.068-.429-.098-.629-.157s-.385-.123-.554-.191-.299-.135-.39-.198l-.697 1.107q.274.205.67.369c.396.164.54.207.827.294s.565.15.834.191.504.062.704.062q.602 0 1.169-.116t1.005-.41c.438-.294.524-.456.697-.779s.26-.723.26-1.196V43.72h-1.668zm8.729-2.366q-.471-.342-1.019-.581c-.548-.239-.702-.323-1.012-.492s-.569-.364-.779-.588-.314-.518-.314-.882q0-.22.109-.458c.109-.238.173-.303.301-.431s.273-.234.438-.321.337-.139.52-.157q.492-.04.807-.014c.315.026.378.05.506.096s.226.091.294.137.13.082.185.109q.013-.014.082-.137c.069-.123.101-.185.164-.308l.205-.396a9 9 0 0 0 .191-.39q-.396-.26-1.039-.376c-.643-.116-.853-.116-1.271-.116q-.615 0-1.169.191c-.554.191-.692.313-.971.554s-.499.535-.663.882-.248.744-.248 1.19q0 .738.314 1.23c.314.492.474.613.793.854s.661.451 1.025.629.704.355 1.019.533.576.376.786.595.314.483.314.793q0 .767-.444 1.155c-.444.388-.723.39-1.278.39q-.274 0-.588-.055c-.314-.055-.419-.084-.629-.144s-.412-.123-.608-.191-.357-.139-.485-.212l-.287 1.176q.233.205.554.349c.321.144.439.171.677.226q.356.083.704.116c.348.033.458.034.677.034q.766 0 1.367-.232c.601-.232.738-.362 1.012-.622s.485-.561.636-.902.226-.695.226-1.06q0-.807-.314-1.319c-.314-.512-.474-.627-.788-.855m9.789-3.992q-.567-.643-1.326-.978c-.759-.335-1.06-.335-1.661-.335s-1.155.111-1.661.335-.948.549-1.326.978-.675.964-.889 1.606-.321 1.388-.321 2.235.107 1.595.321 2.242.511 1.185.889 1.613.82.752 1.326.971 1.06.328 1.661.328 1.155-.109 1.661-.328.948-.542 1.326-.971.675-.966.889-1.613.321-1.395.321-2.242-.107-1.593-.321-2.235-.511-1.177-.889-1.606m-.677 5.626q-.205.731-.567 1.183c-.362.452-.515.518-.82.649s-.627.198-.964.198q-.492 0-.937-.212c-.445-.212-.561-.364-.793-.67s-.415-.699-.547-1.183-.203-1.066-.212-1.75q.014-1.053.219-1.777.206-.724.567-1.183c.361-.459.515-.521.82-.649s.627-.191.964-.191q.493 0 .937.205c.444.205.561.36.793.67s.415.704.547 1.183.203 1.06.212 1.743q-.013 1.053-.219 1.784m9.817.171-3.951-6.945h-1.668V54h1.668v-6.945L44.012 54h1.668V43.924h-1.668zM20.5 20v-4c0-.551.448-1 1-1a1 1 0 1 0 0-2c-1.654 0-3 1.346-3 3v4c0 1.103-.897 2-2 2a1 1 0 1 0 0 2c1.103 0 2 .897 2 2v4c0 1.654 1.346 3 3 3a1 1 0 1 0 0-2c-.552 0-1-.449-1-1v-4c0-1.2-.542-2.266-1.382-3a3.98 3.98 0 0 0 1.382-3"/><circle cx="28.5" cy="19.5" r="1.5"/><path d="M28.5 25a1 1 0 0 0-1 1v3a1 1 0 1 0 2 0v-3a1 1 0 0 0-1-1"/></svg>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
Reference in New Issue
Block a user