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:
packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/fileSearch/createStore.operation.ts
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
||||
import { updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import { createFileSearchStore } from '../../helpers/utils';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Display Name',
|
||||
name: 'displayName',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. My File Search Store',
|
||||
description: 'A human-readable name for the File Search store',
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
operation: ['createStore'],
|
||||
resource: ['fileSearch'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
|
||||
const displayName = this.getNodeParameter('displayName', i, '') as string;
|
||||
|
||||
const response = await createFileSearchStore.call(this, displayName);
|
||||
return [
|
||||
{
|
||||
json: response,
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/fileSearch/deleteStore.operation.ts
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
||||
import { updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import { deleteFileSearchStore } from '../../helpers/utils';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'File Search Store Name',
|
||||
name: 'fileSearchStoreName',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. fileSearchStores/abc123',
|
||||
description: 'The full name of the File Search store to delete (format: fileSearchStores/...)',
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Force Delete',
|
||||
name: 'force',
|
||||
type: 'boolean',
|
||||
description:
|
||||
'Whether to delete related Documents and objects. If false, deletion will fail if the store contains any Documents.',
|
||||
default: false,
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
operation: ['deleteStore'],
|
||||
resource: ['fileSearch'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
|
||||
const fileSearchStoreName = this.getNodeParameter('fileSearchStoreName', i, '') as string;
|
||||
const force = this.getNodeParameter('force', i, false) as boolean | undefined;
|
||||
|
||||
const response = await deleteFileSearchStore.call(this, fileSearchStoreName, force);
|
||||
return [
|
||||
{
|
||||
json: response,
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as createStore from './createStore.operation';
|
||||
import * as deleteStore from './deleteStore.operation';
|
||||
import * as listStores from './listStores.operation';
|
||||
import * as uploadToStore from './uploadToStore.operation';
|
||||
|
||||
export { createStore, deleteStore, listStores, uploadToStore };
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create File Search Store',
|
||||
value: 'createStore',
|
||||
action: 'Create a File Search store',
|
||||
description: 'Create a new File Search store for RAG (Retrieval Augmented Generation)',
|
||||
},
|
||||
{
|
||||
name: 'Delete File Search Store',
|
||||
value: 'deleteStore',
|
||||
action: 'Delete a File Search store',
|
||||
description: 'Delete a File Search store',
|
||||
},
|
||||
{
|
||||
name: 'List File Search Stores',
|
||||
value: 'listStores',
|
||||
action: 'List all File Search stores',
|
||||
description: 'List all File Search stores owned by the user',
|
||||
},
|
||||
{
|
||||
name: 'Upload to File Search Store',
|
||||
value: 'uploadToStore',
|
||||
action: 'Upload a file to a File Search store',
|
||||
description:
|
||||
'Upload a file to a File Search store for RAG (Retrieval Augmented Generation)',
|
||||
},
|
||||
],
|
||||
default: 'createStore',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['fileSearch'],
|
||||
},
|
||||
},
|
||||
},
|
||||
...createStore.description,
|
||||
...deleteStore.description,
|
||||
...listStores.description,
|
||||
...uploadToStore.description,
|
||||
];
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
||||
import { updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import { listFileSearchStores } from '../../helpers/utils';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Page Size',
|
||||
name: 'pageSize',
|
||||
type: 'number',
|
||||
description: 'Maximum number of File Search stores to return per page (max 20)',
|
||||
default: 10,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Page Token',
|
||||
name: 'pageToken',
|
||||
// eslint-disable-next-line -- pageToken is a pagination token, not a password
|
||||
type: 'string',
|
||||
description: 'Token from a previous page to retrieve the next page of results',
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
operation: ['listStores'],
|
||||
resource: ['fileSearch'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
|
||||
const pageSize = this.getNodeParameter('pageSize', i) as number | undefined;
|
||||
const pageToken = this.getNodeParameter('pageToken', i, '') as string | undefined;
|
||||
|
||||
const response = await listFileSearchStores.call(this, pageSize, pageToken);
|
||||
return [
|
||||
{
|
||||
json: response,
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
||||
import { updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import { uploadToFileSearchStore } from '../../helpers/utils';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'File Search Store Name',
|
||||
name: 'fileSearchStoreName',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. fileSearchStores/abc123',
|
||||
description:
|
||||
'The full name of the File Search store to upload to (format: fileSearchStores/...)',
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'File Display Name',
|
||||
name: 'displayName',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. My Document',
|
||||
description: 'A human-readable name for the file (will be visible in citations)',
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Input Type',
|
||||
name: 'inputType',
|
||||
type: 'options',
|
||||
default: 'url',
|
||||
options: [
|
||||
{
|
||||
name: 'File URL',
|
||||
value: 'url',
|
||||
},
|
||||
{
|
||||
name: 'Binary File',
|
||||
value: 'binary',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'URL',
|
||||
name: 'fileUrl',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. https://example.com/file.pdf',
|
||||
description: 'URL of the file to upload',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
inputType: ['url'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Input Data Field Name',
|
||||
name: 'binaryPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
placeholder: 'e.g. data',
|
||||
hint: 'The name of the input field containing the binary file data to be processed',
|
||||
description: 'Name of the binary property which contains the file',
|
||||
displayOptions: {
|
||||
show: {
|
||||
inputType: ['binary'],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
operation: ['uploadToStore'],
|
||||
resource: ['fileSearch'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
|
||||
const fileSearchStoreName = this.getNodeParameter('fileSearchStoreName', i, '') as string;
|
||||
const displayName = this.getNodeParameter('displayName', i, '') as string;
|
||||
const inputType = this.getNodeParameter('inputType', i, 'url') as string;
|
||||
|
||||
let fileUrl: string | undefined;
|
||||
if (inputType === 'url') {
|
||||
fileUrl = this.getNodeParameter('fileUrl', i, '') as string;
|
||||
}
|
||||
|
||||
const response = await uploadToFileSearchStore.call(
|
||||
this,
|
||||
i,
|
||||
fileSearchStoreName,
|
||||
displayName,
|
||||
fileUrl,
|
||||
'application/octet-stream',
|
||||
);
|
||||
|
||||
return [
|
||||
{
|
||||
json: response ?? {},
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user