You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

constant.tsx 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. import {
  2. initialKeywordsSimilarityWeightValue,
  3. initialSimilarityThresholdValue,
  4. } from '@/components/similarity-slider';
  5. import {
  6. AgentGlobals,
  7. CodeTemplateStrMap,
  8. ProgrammingLanguage,
  9. } from '@/constants/agent';
  10. export enum AgentDialogueMode {
  11. Conversational = 'conversational',
  12. Task = 'task',
  13. }
  14. import {
  15. ChatVariableEnabledField,
  16. variableEnabledFieldMap,
  17. } from '@/constants/chat';
  18. import { ModelVariableType } from '@/constants/knowledge';
  19. import i18n from '@/locales/config';
  20. import { setInitialChatVariableEnabledFieldValue } from '@/utils/chat';
  21. // DuckDuckGo's channel options
  22. export enum Channel {
  23. Text = 'text',
  24. News = 'news',
  25. }
  26. export enum PromptRole {
  27. User = 'user',
  28. Assistant = 'assistant',
  29. }
  30. import {
  31. Circle,
  32. CircleSlash2,
  33. CloudUpload,
  34. ListOrdered,
  35. OptionIcon,
  36. TextCursorInput,
  37. ToggleLeft,
  38. WrapText,
  39. } from 'lucide-react';
  40. export const BeginId = 'begin';
  41. export enum Operator {
  42. Begin = 'Begin',
  43. Retrieval = 'Retrieval',
  44. Generate = 'Generate',
  45. Answer = 'Answer',
  46. Categorize = 'Categorize',
  47. Message = 'Message',
  48. Relevant = 'Relevant',
  49. RewriteQuestion = 'RewriteQuestion',
  50. KeywordExtract = 'KeywordExtract',
  51. Baidu = 'Baidu',
  52. DuckDuckGo = 'DuckDuckGo',
  53. Wikipedia = 'Wikipedia',
  54. PubMed = 'PubMed',
  55. ArXiv = 'ArXiv',
  56. Google = 'Google',
  57. Bing = 'Bing',
  58. GoogleScholar = 'GoogleScholar',
  59. DeepL = 'DeepL',
  60. GitHub = 'GitHub',
  61. BaiduFanyi = 'BaiduFanyi',
  62. QWeather = 'QWeather',
  63. ExeSQL = 'ExeSQL',
  64. Switch = 'Switch',
  65. WenCai = 'WenCai',
  66. AkShare = 'AkShare',
  67. YahooFinance = 'YahooFinance',
  68. Jin10 = 'Jin10',
  69. Concentrator = 'Concentrator',
  70. TuShare = 'TuShare',
  71. Note = 'Note',
  72. Crawler = 'Crawler',
  73. Invoke = 'Invoke',
  74. Template = 'Template',
  75. Email = 'Email',
  76. Iteration = 'Iteration',
  77. IterationStart = 'IterationItem',
  78. Code = 'CodeExec',
  79. WaitingDialogue = 'WaitingDialogue',
  80. Agent = 'Agent',
  81. Tool = 'Tool',
  82. TavilySearch = 'TavilySearch',
  83. TavilyExtract = 'TavilyExtract',
  84. UserFillUp = 'UserFillUp',
  85. StringTransform = 'StringTransform',
  86. }
  87. export const SwitchLogicOperatorOptions = ['and', 'or'];
  88. export const CommonOperatorList = Object.values(Operator).filter(
  89. (x) => x !== Operator.Note,
  90. );
  91. export const AgentOperatorList = [
  92. Operator.Retrieval,
  93. Operator.Generate,
  94. Operator.Answer,
  95. Operator.Categorize,
  96. Operator.Message,
  97. Operator.RewriteQuestion,
  98. Operator.KeywordExtract,
  99. Operator.Switch,
  100. Operator.Concentrator,
  101. Operator.Template,
  102. Operator.Iteration,
  103. Operator.WaitingDialogue,
  104. Operator.Note,
  105. Operator.Agent,
  106. ];
  107. export const componentMenuList = [
  108. {
  109. name: Operator.Retrieval,
  110. },
  111. {
  112. name: Operator.Generate,
  113. },
  114. {
  115. name: Operator.Answer,
  116. },
  117. {
  118. name: Operator.Categorize,
  119. },
  120. {
  121. name: Operator.Message,
  122. },
  123. {
  124. name: Operator.RewriteQuestion,
  125. },
  126. {
  127. name: Operator.KeywordExtract,
  128. },
  129. {
  130. name: Operator.Switch,
  131. },
  132. {
  133. name: Operator.Concentrator,
  134. },
  135. {
  136. name: Operator.Template,
  137. },
  138. {
  139. name: Operator.Iteration,
  140. },
  141. {
  142. name: Operator.Code,
  143. },
  144. {
  145. name: Operator.WaitingDialogue,
  146. },
  147. {
  148. name: Operator.Agent,
  149. },
  150. {
  151. name: Operator.Note,
  152. },
  153. {
  154. name: Operator.DuckDuckGo,
  155. },
  156. {
  157. name: Operator.Baidu,
  158. },
  159. {
  160. name: Operator.Wikipedia,
  161. },
  162. {
  163. name: Operator.PubMed,
  164. },
  165. {
  166. name: Operator.ArXiv,
  167. },
  168. {
  169. name: Operator.Google,
  170. },
  171. {
  172. name: Operator.Bing,
  173. },
  174. {
  175. name: Operator.GoogleScholar,
  176. },
  177. {
  178. name: Operator.DeepL,
  179. },
  180. {
  181. name: Operator.GitHub,
  182. },
  183. {
  184. name: Operator.BaiduFanyi,
  185. },
  186. {
  187. name: Operator.QWeather,
  188. },
  189. {
  190. name: Operator.ExeSQL,
  191. },
  192. {
  193. name: Operator.WenCai,
  194. },
  195. {
  196. name: Operator.AkShare,
  197. },
  198. {
  199. name: Operator.YahooFinance,
  200. },
  201. {
  202. name: Operator.Jin10,
  203. },
  204. {
  205. name: Operator.TuShare,
  206. },
  207. {
  208. name: Operator.Crawler,
  209. },
  210. {
  211. name: Operator.Invoke,
  212. },
  213. {
  214. name: Operator.Email,
  215. },
  216. ];
  217. export const SwitchOperatorOptions = [
  218. { value: '=', label: 'equal', icon: 'equal' },
  219. { value: '≠', label: 'notEqual', icon: 'not-equals' },
  220. { value: '>', label: 'gt', icon: 'Less' },
  221. { value: '≥', label: 'ge', icon: 'Greater-or-equal' },
  222. { value: '<', label: 'lt', icon: 'Less' },
  223. { value: '≤', label: 'le', icon: 'less-or-equal' },
  224. { value: 'contains', label: 'contains', icon: 'Contains' },
  225. { value: 'not contains', label: 'notContains', icon: 'not-contains' },
  226. { value: 'start with', label: 'startWith', icon: 'list-start' },
  227. { value: 'end with', label: 'endWith', icon: 'list-end' },
  228. {
  229. value: 'empty',
  230. label: 'empty',
  231. icon: <Circle className="size-4" />,
  232. },
  233. {
  234. value: 'not empty',
  235. label: 'notEmpty',
  236. icon: <CircleSlash2 className="size-4" />,
  237. },
  238. ];
  239. export const SwitchElseTo = 'end_cpn_ids';
  240. const initialQueryBaseValues = {
  241. query: [],
  242. };
  243. export const initialRetrievalValues = {
  244. query: AgentGlobals.SysQuery,
  245. top_n: 8,
  246. top_k: 1024,
  247. kb_ids: [],
  248. rerank_id: '',
  249. empty_response: '',
  250. ...initialSimilarityThresholdValue,
  251. ...initialKeywordsSimilarityWeightValue,
  252. use_kg: false,
  253. cross_languages: [],
  254. outputs: {
  255. formalized_content: {
  256. type: 'string',
  257. value: '',
  258. },
  259. },
  260. };
  261. export const initialBeginValues = {
  262. mode: AgentDialogueMode.Conversational,
  263. prologue: `Hi! I'm your assistant, what can I do for you?`,
  264. };
  265. export const variableCheckBoxFieldMap = Object.keys(
  266. variableEnabledFieldMap,
  267. ).reduce<Record<string, boolean>>((pre, cur) => {
  268. pre[cur] = setInitialChatVariableEnabledFieldValue(
  269. cur as ChatVariableEnabledField,
  270. );
  271. return pre;
  272. }, {});
  273. const initialLlmBaseValues = {
  274. ...variableCheckBoxFieldMap,
  275. temperature: 0.1,
  276. top_p: 0.3,
  277. frequency_penalty: 0.7,
  278. presence_penalty: 0.4,
  279. max_tokens: 256,
  280. };
  281. export const initialGenerateValues = {
  282. ...initialLlmBaseValues,
  283. prompt: i18n.t('flow.promptText'),
  284. cite: true,
  285. message_history_window_size: 12,
  286. parameters: [],
  287. };
  288. export const initialRewriteQuestionValues = {
  289. ...initialLlmBaseValues,
  290. language: '',
  291. message_history_window_size: 6,
  292. };
  293. export const initialRelevantValues = {
  294. ...initialLlmBaseValues,
  295. };
  296. export const initialCategorizeValues = {
  297. ...initialLlmBaseValues,
  298. query: AgentGlobals.SysQuery,
  299. parameter: ModelVariableType.Precise,
  300. message_history_window_size: 1,
  301. items: [],
  302. outputs: {
  303. category_name: {
  304. type: 'string',
  305. },
  306. },
  307. };
  308. export const initialMessageValues = {
  309. content: [''],
  310. };
  311. export const initialKeywordExtractValues = {
  312. ...initialLlmBaseValues,
  313. top_n: 3,
  314. ...initialQueryBaseValues,
  315. };
  316. export const initialDuckValues = {
  317. top_n: 10,
  318. channel: Channel.Text,
  319. query: AgentGlobals.SysQuery,
  320. outputs: {
  321. formalized_content: {
  322. value: '',
  323. type: 'string',
  324. },
  325. json: {
  326. value: [],
  327. type: 'Array<Object>',
  328. },
  329. },
  330. };
  331. export const initialBaiduValues = {
  332. top_n: 10,
  333. ...initialQueryBaseValues,
  334. };
  335. export const initialWikipediaValues = {
  336. top_n: 10,
  337. language: 'en',
  338. query: AgentGlobals.SysQuery,
  339. outputs: {
  340. formalized_content: {
  341. value: '',
  342. type: 'string',
  343. },
  344. },
  345. };
  346. export const initialPubMedValues = {
  347. top_n: 12,
  348. email: '',
  349. query: AgentGlobals.SysQuery,
  350. outputs: {
  351. formalized_content: {
  352. value: '',
  353. type: 'string',
  354. },
  355. },
  356. };
  357. export const initialArXivValues = {
  358. top_n: 12,
  359. sort_by: 'relevance',
  360. query: AgentGlobals.SysQuery,
  361. outputs: {
  362. formalized_content: {
  363. value: '',
  364. type: 'string',
  365. },
  366. },
  367. };
  368. export const initialGoogleValues = {
  369. q: AgentGlobals.SysQuery,
  370. start: 0,
  371. num: 12,
  372. api_key: '',
  373. country: 'us',
  374. language: 'en',
  375. outputs: {
  376. formalized_content: {
  377. value: '',
  378. type: 'string',
  379. },
  380. json: {
  381. value: [],
  382. type: 'Array<Object>',
  383. },
  384. },
  385. };
  386. export const initialBingValues = {
  387. top_n: 10,
  388. channel: 'Webpages',
  389. api_key:
  390. 'YOUR_API_KEY (obtained from https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)',
  391. country: 'CH',
  392. language: 'en',
  393. query: '',
  394. };
  395. export const initialGoogleScholarValues = {
  396. top_n: 12,
  397. sort_by: 'relevance',
  398. patents: true,
  399. query: AgentGlobals.SysQuery,
  400. year_low: undefined,
  401. year_high: undefined,
  402. outputs: {
  403. formalized_content: {
  404. value: '',
  405. type: 'string',
  406. },
  407. json: {
  408. value: [],
  409. type: 'Array<Object>',
  410. },
  411. },
  412. };
  413. export const initialDeepLValues = {
  414. top_n: 5,
  415. auth_key: 'relevance',
  416. };
  417. export const initialGithubValues = {
  418. top_n: 5,
  419. query: AgentGlobals.SysQuery,
  420. outputs: {
  421. formalized_content: {
  422. value: '',
  423. type: 'string',
  424. },
  425. json: {
  426. value: [],
  427. type: 'Array<Object>',
  428. },
  429. },
  430. };
  431. export const initialBaiduFanyiValues = {
  432. appid: 'xxx',
  433. secret_key: 'xxx',
  434. trans_type: 'translate',
  435. ...initialQueryBaseValues,
  436. };
  437. export const initialQWeatherValues = {
  438. web_apikey: 'xxx',
  439. type: 'weather',
  440. user_type: 'free',
  441. time_period: 'now',
  442. ...initialQueryBaseValues,
  443. };
  444. export const initialExeSqlValues = {
  445. sql: '',
  446. db_type: 'mysql',
  447. database: '',
  448. username: '',
  449. host: '',
  450. port: 3306,
  451. password: '',
  452. max_records: 1024,
  453. };
  454. export const initialSwitchValues = {
  455. conditions: [
  456. {
  457. logical_operator: SwitchLogicOperatorOptions[0],
  458. items: [
  459. {
  460. operator: SwitchOperatorOptions[0].value,
  461. },
  462. ],
  463. to: [],
  464. },
  465. ],
  466. [SwitchElseTo]: [],
  467. };
  468. export const initialWenCaiValues = {
  469. top_n: 20,
  470. query_type: 'stock',
  471. ...initialQueryBaseValues,
  472. };
  473. export const initialAkShareValues = { top_n: 10, ...initialQueryBaseValues };
  474. export const initialYahooFinanceValues = {
  475. stock_code: '',
  476. info: true,
  477. history: false,
  478. financials: false,
  479. balance_sheet: false,
  480. cash_flow_statement: false,
  481. news: true,
  482. outputs: {
  483. report: {
  484. value: '',
  485. type: 'string',
  486. },
  487. },
  488. };
  489. export const initialJin10Values = {
  490. type: 'flash',
  491. secret_key: 'xxx',
  492. flash_type: '1',
  493. contain: '',
  494. filter: '',
  495. ...initialQueryBaseValues,
  496. };
  497. export const initialConcentratorValues = {};
  498. export const initialTuShareValues = {
  499. token: 'xxx',
  500. src: 'eastmoney',
  501. start_date: '2024-01-01 09:00:00',
  502. ...initialQueryBaseValues,
  503. };
  504. export const initialNoteValues = {
  505. text: '',
  506. };
  507. export const initialCrawlerValues = {
  508. extract_type: 'markdown',
  509. query: '',
  510. };
  511. export const initialInvokeValues = {
  512. url: '',
  513. method: 'GET',
  514. timeout: 60,
  515. headers: `{
  516. "Accept": "*/*",
  517. "Cache-Control": "no-cache",
  518. "Connection": "keep-alive"
  519. }`,
  520. proxy: '',
  521. clean_html: false,
  522. variables: [],
  523. };
  524. export const initialTemplateValues = {
  525. content: '',
  526. parameters: [],
  527. };
  528. export const initialEmailValues = {
  529. smtp_server: '',
  530. smtp_port: 465,
  531. email: '',
  532. password: '',
  533. sender_name: '',
  534. to_email: '',
  535. cc_email: '',
  536. subject: '',
  537. content: '',
  538. outputs: {
  539. success: {
  540. value: true,
  541. type: 'boolean',
  542. },
  543. },
  544. };
  545. export const initialIterationValues = {
  546. items_ref: '',
  547. outputs: {},
  548. };
  549. export const initialIterationStartValues = {
  550. outputs: {
  551. item: {
  552. type: 'unkown',
  553. },
  554. index: {
  555. type: 'integer',
  556. },
  557. },
  558. };
  559. export const initialCodeValues = {
  560. lang: ProgrammingLanguage.Python,
  561. script: CodeTemplateStrMap[ProgrammingLanguage.Python],
  562. arguments: {
  563. arg1: '',
  564. arg2: '',
  565. },
  566. outputs: {},
  567. };
  568. export const initialWaitingDialogueValues = {};
  569. export const initialAgentValues = {
  570. ...initialLlmBaseValues,
  571. description: '',
  572. user_prompt: '',
  573. sys_prompt: ``,
  574. prompts: [{ role: PromptRole.User, content: `{${AgentGlobals.SysQuery}}` }],
  575. message_history_window_size: 12,
  576. max_retries: 3,
  577. delay_after_error: 1,
  578. visual_files_var: '',
  579. max_rounds: 5,
  580. exception_method: null,
  581. exception_comment: '',
  582. exception_goto: '',
  583. tools: [],
  584. mcp: [],
  585. outputs: {
  586. structured_output: {
  587. // topic: {
  588. // type: 'string',
  589. // description:
  590. // 'default:general. The category of the search.news is useful for retrieving real-time updates, particularly about politics, sports, and major current events covered by mainstream media sources. general is for broader, more general-purpose searches that may include a wide range of sources.',
  591. // enum: ['general', 'news'],
  592. // default: 'general',
  593. // },
  594. },
  595. content: {
  596. type: 'string',
  597. value: '',
  598. },
  599. },
  600. };
  601. export const initialUserFillUpValues = {
  602. enable_tips: true,
  603. tips: '',
  604. inputs: [],
  605. outputs: {},
  606. };
  607. export enum StringTransformMethod {
  608. Merge = 'merge',
  609. Split = 'split',
  610. }
  611. export enum StringTransformDelimiter {
  612. Comma = ',',
  613. Semicolon = ';',
  614. Period = '.',
  615. LineBreak = '\n',
  616. Tab = '\t',
  617. Space = ' ',
  618. }
  619. export const initialStringTransformValues = {
  620. method: StringTransformMethod.Merge,
  621. split_ref: '',
  622. script: '',
  623. delimiters: [StringTransformDelimiter.Comma],
  624. outputs: {
  625. result: {
  626. type: 'string',
  627. },
  628. },
  629. };
  630. export enum TavilySearchDepth {
  631. Basic = 'basic',
  632. Advanced = 'advanced',
  633. }
  634. export enum TavilyTopic {
  635. News = 'news',
  636. General = 'general',
  637. }
  638. export const initialTavilyValues = {
  639. api_key: '',
  640. query: AgentGlobals.SysQuery,
  641. search_depth: TavilySearchDepth.Basic,
  642. topic: TavilyTopic.General,
  643. max_results: 5,
  644. days: 7,
  645. include_answer: false,
  646. include_raw_content: true,
  647. include_images: false,
  648. include_image_descriptions: false,
  649. include_domains: [],
  650. exclude_domains: [],
  651. outputs: {
  652. formalized_content: {
  653. value: '',
  654. type: 'string',
  655. },
  656. json: {
  657. value: [],
  658. type: 'Array<Object>',
  659. },
  660. },
  661. };
  662. export enum TavilyExtractDepth {
  663. Basic = 'basic',
  664. Advanced = 'advanced',
  665. }
  666. export enum TavilyExtractFormat {
  667. Text = 'text',
  668. Markdown = 'markdown',
  669. }
  670. export const initialTavilyExtractValues = {
  671. urls: '',
  672. extract_depth: TavilyExtractDepth.Basic,
  673. format: TavilyExtractFormat.Markdown,
  674. outputs: {
  675. formalized_content: {
  676. value: '',
  677. type: 'string',
  678. },
  679. json: {
  680. value: [],
  681. type: 'Array<Object>',
  682. },
  683. },
  684. };
  685. export const CategorizeAnchorPointPositions = [
  686. { top: 1, right: 34 },
  687. { top: 8, right: 18 },
  688. { top: 15, right: 10 },
  689. { top: 24, right: 4 },
  690. { top: 31, right: 1 },
  691. { top: 38, right: -2 },
  692. { top: 62, right: -2 }, //bottom
  693. { top: 71, right: 1 },
  694. { top: 79, right: 6 },
  695. { top: 86, right: 12 },
  696. { top: 91, right: 20 },
  697. { top: 98, right: 34 },
  698. ];
  699. // key is the source of the edge, value is the target of the edge
  700. // no connection lines are allowed between key and value
  701. export const RestrictedUpstreamMap = {
  702. [Operator.Begin]: [Operator.Relevant],
  703. [Operator.Categorize]: [
  704. Operator.Begin,
  705. Operator.Categorize,
  706. Operator.Answer,
  707. Operator.Relevant,
  708. ],
  709. [Operator.Answer]: [
  710. Operator.Begin,
  711. Operator.Answer,
  712. Operator.Message,
  713. Operator.Relevant,
  714. ],
  715. [Operator.Retrieval]: [Operator.Begin, Operator.Retrieval],
  716. [Operator.Generate]: [Operator.Begin, Operator.Relevant],
  717. [Operator.Message]: [
  718. Operator.Begin,
  719. Operator.Message,
  720. Operator.Generate,
  721. Operator.Retrieval,
  722. Operator.RewriteQuestion,
  723. Operator.Categorize,
  724. Operator.Relevant,
  725. ],
  726. [Operator.Relevant]: [Operator.Begin, Operator.Answer, Operator.Relevant],
  727. [Operator.RewriteQuestion]: [
  728. Operator.Begin,
  729. Operator.Message,
  730. Operator.RewriteQuestion,
  731. Operator.Relevant,
  732. ],
  733. [Operator.KeywordExtract]: [
  734. Operator.Begin,
  735. Operator.Message,
  736. Operator.Relevant,
  737. ],
  738. [Operator.Baidu]: [Operator.Begin, Operator.Retrieval],
  739. [Operator.DuckDuckGo]: [Operator.Begin, Operator.Retrieval],
  740. [Operator.Wikipedia]: [Operator.Begin, Operator.Retrieval],
  741. [Operator.PubMed]: [Operator.Begin, Operator.Retrieval],
  742. [Operator.ArXiv]: [Operator.Begin, Operator.Retrieval],
  743. [Operator.Google]: [Operator.Begin, Operator.Retrieval],
  744. [Operator.Bing]: [Operator.Begin, Operator.Retrieval],
  745. [Operator.GoogleScholar]: [Operator.Begin, Operator.Retrieval],
  746. [Operator.DeepL]: [Operator.Begin, Operator.Retrieval],
  747. [Operator.GitHub]: [Operator.Begin, Operator.Retrieval],
  748. [Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
  749. [Operator.QWeather]: [Operator.Begin, Operator.Retrieval],
  750. [Operator.ExeSQL]: [Operator.Begin],
  751. [Operator.Switch]: [Operator.Begin],
  752. [Operator.WenCai]: [Operator.Begin],
  753. [Operator.AkShare]: [Operator.Begin],
  754. [Operator.YahooFinance]: [Operator.Begin],
  755. [Operator.Jin10]: [Operator.Begin],
  756. [Operator.Concentrator]: [Operator.Begin],
  757. [Operator.TuShare]: [Operator.Begin],
  758. [Operator.Crawler]: [Operator.Begin],
  759. [Operator.Note]: [],
  760. [Operator.Invoke]: [Operator.Begin],
  761. [Operator.Template]: [Operator.Begin, Operator.Relevant],
  762. [Operator.Email]: [Operator.Begin],
  763. [Operator.Iteration]: [Operator.Begin],
  764. [Operator.IterationStart]: [Operator.Begin],
  765. [Operator.Code]: [Operator.Begin],
  766. [Operator.WaitingDialogue]: [Operator.Begin],
  767. [Operator.Agent]: [Operator.Begin],
  768. [Operator.TavilySearch]: [Operator.Begin],
  769. [Operator.TavilyExtract]: [Operator.Begin],
  770. [Operator.StringTransform]: [Operator.Begin],
  771. [Operator.UserFillUp]: [Operator.Begin],
  772. [Operator.Tool]: [Operator.Begin],
  773. };
  774. export const NodeMap = {
  775. [Operator.Begin]: 'beginNode',
  776. [Operator.Categorize]: 'categorizeNode',
  777. [Operator.Retrieval]: 'retrievalNode',
  778. [Operator.Generate]: 'generateNode',
  779. [Operator.Answer]: 'logicNode',
  780. [Operator.Message]: 'messageNode',
  781. [Operator.Relevant]: 'relevantNode',
  782. [Operator.RewriteQuestion]: 'rewriteNode',
  783. [Operator.KeywordExtract]: 'keywordNode',
  784. [Operator.DuckDuckGo]: 'ragNode',
  785. [Operator.Baidu]: 'ragNode',
  786. [Operator.Wikipedia]: 'ragNode',
  787. [Operator.PubMed]: 'ragNode',
  788. [Operator.ArXiv]: 'ragNode',
  789. [Operator.Google]: 'ragNode',
  790. [Operator.Bing]: 'ragNode',
  791. [Operator.GoogleScholar]: 'ragNode',
  792. [Operator.DeepL]: 'ragNode',
  793. [Operator.GitHub]: 'ragNode',
  794. [Operator.BaiduFanyi]: 'ragNode',
  795. [Operator.QWeather]: 'ragNode',
  796. [Operator.ExeSQL]: 'ragNode',
  797. [Operator.Switch]: 'switchNode',
  798. [Operator.Concentrator]: 'logicNode',
  799. [Operator.WenCai]: 'ragNode',
  800. [Operator.AkShare]: 'ragNode',
  801. [Operator.YahooFinance]: 'ragNode',
  802. [Operator.Jin10]: 'ragNode',
  803. [Operator.TuShare]: 'ragNode',
  804. [Operator.Note]: 'noteNode',
  805. [Operator.Crawler]: 'ragNode',
  806. [Operator.Invoke]: 'ragNode',
  807. [Operator.Template]: 'templateNode',
  808. [Operator.Email]: 'ragNode',
  809. [Operator.Iteration]: 'group',
  810. [Operator.IterationStart]: 'iterationStartNode',
  811. [Operator.Code]: 'ragNode',
  812. [Operator.WaitingDialogue]: 'ragNode',
  813. [Operator.Agent]: 'agentNode',
  814. [Operator.Tool]: 'toolNode',
  815. [Operator.TavilySearch]: 'ragNode',
  816. [Operator.UserFillUp]: 'ragNode',
  817. [Operator.StringTransform]: 'ragNode',
  818. [Operator.TavilyExtract]: 'ragNode',
  819. };
  820. export enum BeginQueryType {
  821. Line = 'line',
  822. Paragraph = 'paragraph',
  823. Options = 'options',
  824. File = 'file',
  825. Integer = 'integer',
  826. Boolean = 'boolean',
  827. }
  828. export const BeginQueryTypeIconMap = {
  829. [BeginQueryType.Line]: TextCursorInput,
  830. [BeginQueryType.Paragraph]: WrapText,
  831. [BeginQueryType.Options]: OptionIcon,
  832. [BeginQueryType.File]: CloudUpload,
  833. [BeginQueryType.Integer]: ListOrdered,
  834. [BeginQueryType.Boolean]: ToggleLeft,
  835. };
  836. export const NoDebugOperatorsList = [
  837. Operator.Begin,
  838. Operator.Answer,
  839. Operator.Concentrator,
  840. Operator.Template,
  841. Operator.Message,
  842. Operator.RewriteQuestion,
  843. Operator.Switch,
  844. Operator.Iteration,
  845. Operator.UserFillUp,
  846. ];
  847. export enum NodeHandleId {
  848. Start = 'start',
  849. End = 'end',
  850. Tool = 'tool',
  851. AgentTop = 'agentTop',
  852. AgentBottom = 'agentBottom',
  853. }
  854. export enum VariableType {
  855. String = 'string',
  856. Array = 'array',
  857. File = 'file',
  858. }
  859. export enum AgentExceptionMethod {
  860. Comment = 'comment',
  861. Goto = 'goto',
  862. Null = 'null',
  863. }