Feat: Add TavilyExtract operator #3221 (#8899)

### What problem does this PR solve?

Feat: Add TavilyExtract operator #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-07-17 17:33:01 +08:00
committed by GitHub
parent ecdb1701df
commit 71efd8d765
19 changed files with 389 additions and 780 deletions

View File

@ -87,6 +87,7 @@ export enum Operator {
Agent = 'Agent',
Tool = 'Tool',
TavilySearch = 'TavilySearch',
TavilyExtract = 'TavilyExtract',
UserFillUp = 'UserFillUp',
StringTransform = 'StringTransform',
}
@ -114,148 +115,6 @@ export const AgentOperatorList = [
Operator.Agent,
];
export const operatorMap: Record<
Operator,
{
backgroundColor?: string;
color?: string;
width?: number;
height?: number;
fontSize?: number;
iconFontSize?: number;
iconWidth?: number;
moreIconColor?: string;
}
> = {
[Operator.Retrieval]: {
backgroundColor: '#cad6e0',
color: '#385974',
},
[Operator.Generate]: {
backgroundColor: '#ebd6d6',
width: 150,
height: 150,
fontSize: 20,
iconFontSize: 30,
color: '#996464',
},
[Operator.Answer]: {
backgroundColor: '#f4816d',
color: '#f4816d',
},
[Operator.Begin]: {
backgroundColor: '#4f51d6',
},
[Operator.Categorize]: {
backgroundColor: '#ffebcd',
color: '#cc8a26',
},
[Operator.Message]: {
backgroundColor: '#c5ddc7',
color: 'green',
},
[Operator.Relevant]: {
backgroundColor: '#9fd94d',
color: '#8ef005',
width: 70,
height: 70,
fontSize: 12,
iconFontSize: 16,
},
[Operator.RewriteQuestion]: {
backgroundColor: '#f8c7f8',
color: '#f32bf3',
width: 70,
height: 70,
fontSize: 12,
iconFontSize: 16,
},
[Operator.KeywordExtract]: {
width: 70,
height: 70,
backgroundColor: '#6E5494',
color: '#6E5494',
fontSize: 12,
iconWidth: 16,
},
[Operator.DuckDuckGo]: {
backgroundColor: '#e7e389',
color: '#aea00c',
},
[Operator.Baidu]: {
backgroundColor: '#d9e0f8',
},
[Operator.Wikipedia]: {
backgroundColor: '#dee0e2',
},
[Operator.PubMed]: {
backgroundColor: '#a2ccf0',
},
[Operator.ArXiv]: {
width: 70,
height: 70,
fontSize: 12,
iconWidth: 16,
iconFontSize: 16,
moreIconColor: 'white',
backgroundColor: '#b31b1b',
color: 'white',
},
[Operator.Google]: {
backgroundColor: 'pink',
},
[Operator.Bing]: {
backgroundColor: '#c0dcc4',
},
[Operator.GoogleScholar]: {
backgroundColor: '#b4e4f6',
},
[Operator.DeepL]: {
backgroundColor: '#f5e8e6',
},
[Operator.GitHub]: {
backgroundColor: 'purple',
color: 'purple',
},
[Operator.BaiduFanyi]: { backgroundColor: '#e5f2d3' },
[Operator.QWeather]: {
backgroundColor: '#a4bbf3',
color: '#a4bbf3',
},
[Operator.ExeSQL]: { backgroundColor: '#b9efe8' },
[Operator.Switch]: { backgroundColor: '#dbaff6', color: '#dbaff6' },
[Operator.WenCai]: { backgroundColor: '#faac5b' },
[Operator.AkShare]: { backgroundColor: '#8085f5' },
[Operator.YahooFinance]: { backgroundColor: '#b474ff' },
[Operator.Jin10]: { backgroundColor: '#a0b9f8' },
[Operator.Concentrator]: {
backgroundColor: '#32d2a3',
color: '#32d2a3',
width: 70,
height: 70,
fontSize: 10,
iconFontSize: 16,
},
[Operator.TuShare]: { backgroundColor: '#f8cfa0' },
[Operator.Note]: { backgroundColor: '#f8cfa0' },
[Operator.Crawler]: {
backgroundColor: '#dee0e2',
},
[Operator.Invoke]: {
backgroundColor: '#dee0e2',
},
[Operator.Template]: {
backgroundColor: '#dee0e2',
},
[Operator.Email]: { backgroundColor: '#e6f7ff' },
[Operator.Iteration]: { backgroundColor: '#e6f7ff' },
[Operator.IterationStart]: { backgroundColor: '#e6f7ff' },
[Operator.Code]: { backgroundColor: '#4c5458' },
[Operator.WaitingDialogue]: { backgroundColor: '#a5d65c' },
[Operator.Agent]: { backgroundColor: '#a5d65c' },
[Operator.TavilySearch]: { backgroundColor: '#a5d65c' },
};
export const componentMenuList = [
{
name: Operator.Retrieval,
@ -552,16 +411,14 @@ export const initialQWeatherValues = {
};
export const initialExeSqlValues = {
...initialLlmBaseValues,
sql: '',
db_type: 'mysql',
database: '',
username: '',
host: '',
port: 3306,
password: '',
loop: 3,
top_n: 30,
query: '',
max_records: 1024,
};
export const initialSwitchValues = {
@ -775,8 +632,34 @@ export const initialTavilyValues = {
type: 'string',
},
json: {
value: {},
type: 'Object',
value: [],
type: 'Array<Object>',
},
},
};
export enum TavilyExtractDepth {
Basic = 'basic',
Advanced = 'advanced',
}
export enum TavilyExtractFormat {
Text = 'text',
Markdown = 'markdown',
}
export const initialTavilyExtractValues = {
urls: '',
extract_depth: TavilyExtractDepth.Basic,
format: TavilyExtractFormat.Markdown,
outputs: {
formalized_content: {
value: '',
type: 'string',
},
json: {
value: [],
type: 'Array<Object>',
},
},
};
@ -866,6 +749,7 @@ export const RestrictedUpstreamMap = {
[Operator.WaitingDialogue]: [Operator.Begin],
[Operator.Agent]: [Operator.Begin],
[Operator.TavilySearch]: [Operator.Begin],
[Operator.TavilyExtract]: [Operator.Begin],
[Operator.StringTransform]: [Operator.Begin],
[Operator.UserFillUp]: [Operator.Begin],
};
@ -914,6 +798,7 @@ export const NodeMap = {
[Operator.TavilySearch]: 'ragNode',
[Operator.UserFillUp]: 'ragNode',
[Operator.StringTransform]: 'ragNode',
[Operator.TavilyExtract]: 'ragNode',
};
export enum BeginQueryType {