Compare commits
11 commits
dependabot
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9eff5c665 | ||
|
|
745e563952 | ||
|
|
8c6c37c5e6 | ||
|
|
ca408074d2 | ||
|
|
d5998f44db | ||
|
|
c53def8e0e | ||
|
|
7a1a22aa50 | ||
|
|
6762ff6882 | ||
|
|
c307b18824 | ||
|
|
0abfc2d5f0 | ||
|
|
eeba6180fd |
5 changed files with 7733 additions and 1181 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# n8n-tavily-nodes
|
||||
# n8n-nodes-tavilyapi
|
||||
|
||||
**n8n-tavily-nodes** is an n8n community node package that integrates the [Tavily API](https://api.tavily.com) for powerful **web search** and **content extraction**.
|
||||
**n8n-nodes-tavilyapi** is an n8n community node package that integrates the [Tavily API](https://api.tavily.com) for powerful **web search** and **content extraction**.
|
||||
|
||||
It contains two nodes:
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ It contains two nodes:
|
|||
1. From your n8n root directory, run:
|
||||
|
||||
```bash
|
||||
npm install n8n-tavily-nodes
|
||||
npm install n8n-nodes-tavilyapi
|
||||
```
|
||||
|
||||
2. Restart n8n.
|
||||
|
|
|
|||
8857
package-lock.json
generated
8857
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "n8n-tavily-nodes",
|
||||
"version": "1.0.0",
|
||||
"name": "n8n-nodes-tavilyapi",
|
||||
"version": "1.0.5",
|
||||
"description": "n8n Community Nodes for Tavily API integration",
|
||||
"author": "Steven Milanese <dev@levelai.xyz> (https://StevenMilanese.com)",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "tsc && node copy-assets.js",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"keywords": [
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ import {
|
|||
INodeTypeDescription,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
// REMOVED import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import { tavilyApiRequest } from './tavilyApi.utils';
|
||||
|
||||
// For older n8n usage, ALLOWED_TIME_RANGES is fine here
|
||||
const ALLOWED_TIME_RANGES = ['', 'day', 'week', 'month', 'year', 'd', 'w', 'm', 'y'];
|
||||
|
||||
export class TavilySearch implements INodeType {
|
||||
|
|
@ -217,11 +215,15 @@ export class TavilySearch implements INodeType {
|
|||
const searchDepth = this.getNodeParameter('searchDepth', i) as string;
|
||||
const maxResults = this.getNodeParameter('maxResults', i) as number;
|
||||
const timeRange = this.getNodeParameter('timeRange', i) as string;
|
||||
const days = this.getNodeParameter('days', i) as number;
|
||||
const includeAnswer = this.getNodeParameter('includeAnswer', i) as string;
|
||||
const includeRawContent = this.getNodeParameter('includeRawContent', i) as boolean;
|
||||
const includeImages = this.getNodeParameter('includeImages', i) as boolean;
|
||||
const includeImageDescriptions = this.getNodeParameter('includeImageDescriptions', i) as boolean;
|
||||
let includeImageDescriptions = false;
|
||||
|
||||
if (includeImages) {
|
||||
includeImageDescriptions = this.getNodeParameter('includeImageDescriptions', i) as boolean;
|
||||
}
|
||||
|
||||
const includeDomains = this.getNodeParameter('includeDomains', i, []) as string[];
|
||||
const excludeDomains = this.getNodeParameter('excludeDomains', i, []) as string[];
|
||||
|
||||
|
|
@ -237,9 +239,6 @@ export class TavilySearch implements INodeType {
|
|||
message: `Invalid timeRange value. Allowed: ${ALLOWED_TIME_RANGES.join(', ')}`,
|
||||
});
|
||||
}
|
||||
if (topic === 'news' && days < 0) {
|
||||
throw new NodeApiError(this.getNode(), { message: 'Days must be >= 0 when topic is "news".' });
|
||||
}
|
||||
|
||||
const body: Record<string, any> = {
|
||||
query,
|
||||
|
|
@ -254,9 +253,16 @@ export class TavilySearch implements INodeType {
|
|||
if (timeRange) {
|
||||
body.time_range = timeRange;
|
||||
}
|
||||
|
||||
// Only get and add days parameter when topic is news
|
||||
if (topic === 'news') {
|
||||
const days = this.getNodeParameter('days', i) as number;
|
||||
if (days < 0) {
|
||||
throw new NodeApiError(this.getNode(), { message: 'Days must be >= 0 when topic is "news".' });
|
||||
}
|
||||
body.days = days;
|
||||
}
|
||||
|
||||
if (includeAnswer !== 'false') {
|
||||
body.include_answer = includeAnswer;
|
||||
}
|
||||
|
|
@ -286,4 +292,4 @@ export class TavilySearch implements INodeType {
|
|||
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/nodes/Tavily/tavily.svg
Normal file
23
src/nodes/Tavily/tavily.svg
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<!-- Background -->
|
||||
<circle cx="12" cy="12" r="11" fill="#ffffff" stroke="#4a86e8" stroke-width="1" />
|
||||
|
||||
<!-- Magnifying glass with light fill -->
|
||||
<circle cx="10" cy="10" r="4.5" fill="#e6f0ff" stroke="#4a86e8" stroke-width="1.8" />
|
||||
<line x1="13" y1="13" x2="18" y2="18" stroke="#4a86e8" stroke-width="1.8" stroke-linecap="round" />
|
||||
|
||||
<!-- Small document icons representing search results -->
|
||||
<rect x="14" y="8" width="4" height="5" rx="0.7" fill="#e6f0ff" stroke="#4a86e8" stroke-width="0.8" />
|
||||
<rect x="7" y="15" width="4" height="5" rx="0.7" fill="#e6f0ff" stroke="#4a86e8" stroke-width="0.8" />
|
||||
<rect x="13" y="15" width="4" height="5" rx="0.7" fill="#e6f0ff" stroke="#4a86e8" stroke-width="0.8" />
|
||||
|
||||
<!-- Simple text lines inside documents -->
|
||||
<line x1="15" y1="9.5" x2="17" y2="9.5" stroke="#4a86e8" stroke-width="0.7" />
|
||||
<line x1="15" y1="11" x2="17" y2="11" stroke="#4a86e8" stroke-width="0.7" />
|
||||
|
||||
<line x1="8" y1="16.5" x2="10" y2="16.5" stroke="#4a86e8" stroke-width="0.7" />
|
||||
<line x1="8" y1="18" x2="10" y2="18" stroke="#4a86e8" stroke-width="0.7" />
|
||||
|
||||
<line x1="14" y1="16.5" x2="16" y2="16.5" stroke="#4a86e8" stroke-width="0.7" />
|
||||
<line x1="14" y1="18" x2="16" y2="18" stroke="#4a86e8" stroke-width="0.7" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue