mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Merge 7486f947d1
into 3cd34b5af6
This commit is contained in:
commit
2830e22ac2
|
@ -0,0 +1,19 @@
|
||||||
|
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
|
export class SearXngApi implements ICredentialType {
|
||||||
|
name = 'searXngApi';
|
||||||
|
|
||||||
|
displayName = 'SearXNG';
|
||||||
|
|
||||||
|
documentationUrl = 'searxng';
|
||||||
|
|
||||||
|
properties: INodeProperties[] = [
|
||||||
|
{
|
||||||
|
displayName: 'API URL',
|
||||||
|
name: 'apiUrl',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
import { SearxngSearch } from '@langchain/community/tools/searxng_search';
|
||||||
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
|
import type {
|
||||||
|
INodeType,
|
||||||
|
INodeTypeDescription,
|
||||||
|
ISupplyDataFunctions,
|
||||||
|
SupplyData,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
numResults: number;
|
||||||
|
pageNumber: number;
|
||||||
|
language: string;
|
||||||
|
safesearch: 0 | 1 | 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class ToolSearXng implements INodeType {
|
||||||
|
description: INodeTypeDescription = {
|
||||||
|
displayName: 'SearXNG',
|
||||||
|
name: 'toolSearXng',
|
||||||
|
icon: 'file:searXng.svg',
|
||||||
|
group: ['transform'],
|
||||||
|
version: 1,
|
||||||
|
description: 'Search in SearXNG',
|
||||||
|
defaults: {
|
||||||
|
name: 'SearXNG',
|
||||||
|
},
|
||||||
|
codex: {
|
||||||
|
categories: ['AI'],
|
||||||
|
subcategories: {
|
||||||
|
AI: ['Tools'],
|
||||||
|
Tools: ['Other Tools'],
|
||||||
|
},
|
||||||
|
resources: {
|
||||||
|
primaryDocumentation: [
|
||||||
|
{
|
||||||
|
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolsearxng/',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inputs: [],
|
||||||
|
outputs: [NodeConnectionType.AiTool],
|
||||||
|
outputNames: ['Tool'],
|
||||||
|
credentials: [
|
||||||
|
{
|
||||||
|
name: 'searXngApi',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
properties: [
|
||||||
|
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Option',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Number of Results',
|
||||||
|
name: 'numResults',
|
||||||
|
type: 'number',
|
||||||
|
default: 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Search Page Number',
|
||||||
|
name: 'pageNumber',
|
||||||
|
type: 'number',
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Language',
|
||||||
|
name: 'language',
|
||||||
|
type: 'string',
|
||||||
|
default: 'en',
|
||||||
|
description:
|
||||||
|
'Defines the language to use. It\'s a two-letter language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French). Head to <a href="https://docs.searxng.org/user/search-syntax.html#select-language">SearXNG search syntax page</a> for more info.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Safe Search',
|
||||||
|
name: 'safesearch',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'None',
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Moderate',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Strict',
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 0,
|
||||||
|
description: 'Filter search results of engines which support safe search',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
|
||||||
|
const credentials = await this.getCredentials<{ apiUrl: string }>('searXngApi');
|
||||||
|
const options = this.getNodeParameter('options', itemIndex) as Options;
|
||||||
|
|
||||||
|
const tool = new SearxngSearch({
|
||||||
|
apiBase: credentials.apiUrl,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
},
|
||||||
|
params: options,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
response: logWrapper(tool, this),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<svg height="92mm" viewBox="0 0 92 92" width="92mm" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-40.921303 -17.416526)"><g fill="none"><circle cx="75" cy="92" r="0" stroke="#000" stroke-width="12"/><circle cx="75.921" cy="53.903" r="30" stroke="#3050ff" stroke-width="10"/><path d="m67.514849 37.91524a18 18 0 0 1 21.051475 3.312407 18 18 0 0 1 3.137312 21.078282" stroke="#3050ff" stroke-width="5"/></g><path d="m3.706 122.09h18.846v39.963h-18.846z" fill="#3050ff" transform="matrix(.69170581 -.72217939 .72217939 .69170581 0 0)"/></g></svg>
|
After Width: | Height: | Size: 558 B |
|
@ -35,6 +35,7 @@
|
||||||
"dist/credentials/OpenRouterApi.credentials.js",
|
"dist/credentials/OpenRouterApi.credentials.js",
|
||||||
"dist/credentials/PineconeApi.credentials.js",
|
"dist/credentials/PineconeApi.credentials.js",
|
||||||
"dist/credentials/QdrantApi.credentials.js",
|
"dist/credentials/QdrantApi.credentials.js",
|
||||||
|
"dist/credentials/SearXngApi.credentials.js",
|
||||||
"dist/credentials/SerpApi.credentials.js",
|
"dist/credentials/SerpApi.credentials.js",
|
||||||
"dist/credentials/WolframAlphaApi.credentials.js",
|
"dist/credentials/WolframAlphaApi.credentials.js",
|
||||||
"dist/credentials/XataApi.credentials.js",
|
"dist/credentials/XataApi.credentials.js",
|
||||||
|
@ -99,6 +100,7 @@
|
||||||
"dist/nodes/tools/ToolCalculator/ToolCalculator.node.js",
|
"dist/nodes/tools/ToolCalculator/ToolCalculator.node.js",
|
||||||
"dist/nodes/tools/ToolCode/ToolCode.node.js",
|
"dist/nodes/tools/ToolCode/ToolCode.node.js",
|
||||||
"dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js",
|
"dist/nodes/tools/ToolHttpRequest/ToolHttpRequest.node.js",
|
||||||
|
"dist/nodes/tools/ToolSearXng/ToolSearXng.node.js",
|
||||||
"dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js",
|
"dist/nodes/tools/ToolSerpApi/ToolSerpApi.node.js",
|
||||||
"dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js",
|
"dist/nodes/tools/ToolVectorStore/ToolVectorStore.node.js",
|
||||||
"dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js",
|
"dist/nodes/tools/ToolWikipedia/ToolWikipedia.node.js",
|
||||||
|
|
Loading…
Reference in a new issue