balibabu
commited on
Commit
·
5d3a620
1
Parent(s):
71d5f05
feat: add Wikipedia operator #918 (#1516)
Browse files### What problem does this PR solve?
Add Wikipedia operator #918
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/assets/svg/wikipedia.svg +6 -0
- web/src/locales/en.ts +2 -0
- web/src/locales/zh-traditional.ts +2 -0
- web/src/locales/zh.ts +2 -0
- web/src/pages/flow/constant.tsx +299 -0
- web/src/pages/flow/flow-drawer/index.tsx +2 -0
- web/src/pages/flow/hooks.ts +2 -0
- web/src/pages/flow/wikipedia-form/index.tsx +27 -0
web/src/assets/svg/wikipedia.svg
ADDED
|
web/src/locales/en.ts
CHANGED
@@ -579,6 +579,7 @@ The above is the content you need to summarize.`,
|
|
579 |
messageDescription:
|
580 |
'This component is used to send user static information. You can prepare several messages which will be chosen randomly.',
|
581 |
keywordDescription: `This component is used to extract keywords from user's question. Top N specifies the number of keywords you need to extract.`,
|
|
|
582 |
promptText: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
|
583 |
{input}
|
584 |
The above is the content you need to summarize.`,
|
@@ -612,6 +613,7 @@ The above is the content you need to summarize.`,
|
|
612 |
messageHistoryWindowSize: 'Message window size',
|
613 |
messageHistoryWindowSizeTip:
|
614 |
'The window size of conversation history that needed to be seen by LLM. The larger the better. But be careful with the maximum content length of LLM.',
|
|
|
615 |
},
|
616 |
footer: {
|
617 |
profile: 'All rights reserved @ React',
|
|
|
579 |
messageDescription:
|
580 |
'This component is used to send user static information. You can prepare several messages which will be chosen randomly.',
|
581 |
keywordDescription: `This component is used to extract keywords from user's question. Top N specifies the number of keywords you need to extract.`,
|
582 |
+
wikipediaDescription: `This component is used to get search result from https://www.wikipedia.org/. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adopt.`,
|
583 |
promptText: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
|
584 |
{input}
|
585 |
The above is the content you need to summarize.`,
|
|
|
613 |
messageHistoryWindowSize: 'Message window size',
|
614 |
messageHistoryWindowSizeTip:
|
615 |
'The window size of conversation history that needed to be seen by LLM. The larger the better. But be careful with the maximum content length of LLM.',
|
616 |
+
wikipedia: 'Wikipedia',
|
617 |
},
|
618 |
footer: {
|
619 |
profile: 'All rights reserved @ React',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -541,6 +541,7 @@ export default {
|
|
541 |
messageDescription:
|
542 |
'此元件用於向使用者發送靜態訊息。您可以準備幾條訊息,這些訊息將隨機選擇。',
|
543 |
keywordDescription: `該組件用於從用戶的問題中提取關鍵字。 Top N指定需要提取的關鍵字數量。`,
|
|
|
544 |
promptText: `請總結以下段落。注意數字,不要胡編亂造。段落如下:
|
545 |
{input}
|
546 |
以上就是你需要總結的內容。`,
|
@@ -573,6 +574,7 @@ export default {
|
|
573 |
messageHistoryWindowSize: '歷史訊息視窗大小',
|
574 |
messageHistoryWindowSizeTip:
|
575 |
'LLM需要查看的對話記錄的視窗大小。越大越好。但要注意LLM的最大內容長度。',
|
|
|
576 |
},
|
577 |
footer: {
|
578 |
profile: '“保留所有權利 @ react”',
|
|
|
541 |
messageDescription:
|
542 |
'此元件用於向使用者發送靜態訊息。您可以準備幾條訊息,這些訊息將隨機選擇。',
|
543 |
keywordDescription: `該組件用於從用戶的問題中提取關鍵字。 Top N指定需要提取的關鍵字數量。`,
|
544 |
+
wikipediaDescription: `此元件用於從 https://www.wikipedia.org/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 指定您需要採用的搜尋結果的數量。`,
|
545 |
promptText: `請總結以下段落。注意數字,不要胡編亂造。段落如下:
|
546 |
{input}
|
547 |
以上就是你需要總結的內容。`,
|
|
|
574 |
messageHistoryWindowSize: '歷史訊息視窗大小',
|
575 |
messageHistoryWindowSizeTip:
|
576 |
'LLM需要查看的對話記錄的視窗大小。越大越好。但要注意LLM的最大內容長度。',
|
577 |
+
wikipedia: '維基百科',
|
578 |
},
|
579 |
footer: {
|
580 |
profile: '“保留所有權利 @ react”',
|
web/src/locales/zh.ts
CHANGED
@@ -559,6 +559,7 @@ export default {
|
|
559 |
messageDescription:
|
560 |
'此组件用于向用户发送静态信息。您可以准备几条消息,这些消息将被随机选择。',
|
561 |
keywordDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`,
|
|
|
562 |
promptText: `请总结以下段落。注意数字,不要胡编乱造。段落如下:
|
563 |
{input}
|
564 |
以上就是你需要总结的内容。`,
|
@@ -591,6 +592,7 @@ export default {
|
|
591 |
messageHistoryWindowSize: '历史消息窗口大小',
|
592 |
messageHistoryWindowSizeTip:
|
593 |
'LLM 需要查看的对话历史窗口大小。越大越好。但要注意 LLM 的最大内容长度。',
|
|
|
594 |
},
|
595 |
footer: {
|
596 |
profile: 'All rights reserved @ React',
|
|
|
559 |
messageDescription:
|
560 |
'此组件用于向用户发送静态信息。您可以准备几条消息,这些消息将被随机选择。',
|
561 |
keywordDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`,
|
562 |
+
wikipediaDescription: `此组件用于从 https://www.wikipedia.org/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要采用的搜索结果数量。`,
|
563 |
promptText: `请总结以下段落。注意数字,不要胡编乱造。段落如下:
|
564 |
{input}
|
565 |
以上就是你需要总结的内容。`,
|
|
|
592 |
messageHistoryWindowSize: '历史消息窗口大小',
|
593 |
messageHistoryWindowSizeTip:
|
594 |
'LLM 需要查看的对话历史窗口大小。越大越好。但要注意 LLM 的最大内容长度。',
|
595 |
+
wikipedia: '维基百科',
|
596 |
},
|
597 |
footer: {
|
598 |
profile: 'All rights reserved @ React',
|
web/src/pages/flow/constant.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
|
2 |
import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
|
3 |
import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
|
|
|
4 |
import { variableEnabledFieldMap } from '@/constants/chat';
|
5 |
import i18n from '@/locales/config';
|
6 |
|
@@ -33,6 +34,7 @@ export enum Operator {
|
|
33 |
KeywordExtract = 'KeywordExtract',
|
34 |
Baidu = 'Baidu',
|
35 |
DuckDuckGo = 'DuckDuckGo',
|
|
|
36 |
}
|
37 |
|
38 |
export const operatorIconMap = {
|
@@ -47,6 +49,7 @@ export const operatorIconMap = {
|
|
47 |
[Operator.KeywordExtract]: KeywordIcon,
|
48 |
[Operator.DuckDuckGo]: DuckIcon,
|
49 |
[Operator.Baidu]: BaiduIcon,
|
|
|
50 |
};
|
51 |
|
52 |
export const operatorMap = {
|
@@ -107,6 +110,9 @@ export const operatorMap = {
|
|
107 |
color: '#aea00c',
|
108 |
},
|
109 |
[Operator.Baidu]: {},
|
|
|
|
|
|
|
110 |
};
|
111 |
|
112 |
export const componentMenuList = [
|
@@ -140,6 +146,9 @@ export const componentMenuList = [
|
|
140 |
{
|
141 |
name: Operator.Baidu,
|
142 |
},
|
|
|
|
|
|
|
143 |
];
|
144 |
|
145 |
export const initialRetrievalValues = {
|
@@ -207,6 +216,11 @@ export const initialBaiduValues = {
|
|
207 |
top_n: 10,
|
208 |
};
|
209 |
|
|
|
|
|
|
|
|
|
|
|
210 |
export const CategorizeAnchorPointPositions = [
|
211 |
{ top: 1, right: 34 },
|
212 |
{ top: 8, right: 18 },
|
@@ -265,6 +279,7 @@ export const RestrictedUpstreamMap = {
|
|
265 |
],
|
266 |
[Operator.Baidu]: [Operator.Begin, Operator.Retrieval],
|
267 |
[Operator.DuckDuckGo]: [Operator.Begin, Operator.Retrieval],
|
|
|
268 |
};
|
269 |
|
270 |
export const NodeMap = {
|
@@ -279,4 +294,288 @@ export const NodeMap = {
|
|
279 |
[Operator.KeywordExtract]: 'ragNode',
|
280 |
[Operator.DuckDuckGo]: 'ragNode',
|
281 |
[Operator.Baidu]: 'ragNode',
|
|
|
282 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
|
2 |
import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
|
3 |
import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
|
4 |
+
import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg';
|
5 |
import { variableEnabledFieldMap } from '@/constants/chat';
|
6 |
import i18n from '@/locales/config';
|
7 |
|
|
|
34 |
KeywordExtract = 'KeywordExtract',
|
35 |
Baidu = 'Baidu',
|
36 |
DuckDuckGo = 'DuckDuckGo',
|
37 |
+
Wikipedia = 'Wikipedia',
|
38 |
}
|
39 |
|
40 |
export const operatorIconMap = {
|
|
|
49 |
[Operator.KeywordExtract]: KeywordIcon,
|
50 |
[Operator.DuckDuckGo]: DuckIcon,
|
51 |
[Operator.Baidu]: BaiduIcon,
|
52 |
+
[Operator.Wikipedia]: WikipediaIcon,
|
53 |
};
|
54 |
|
55 |
export const operatorMap = {
|
|
|
110 |
color: '#aea00c',
|
111 |
},
|
112 |
[Operator.Baidu]: {},
|
113 |
+
[Operator.Wikipedia]: {
|
114 |
+
backgroundColor: '#dee0e2',
|
115 |
+
},
|
116 |
};
|
117 |
|
118 |
export const componentMenuList = [
|
|
|
146 |
{
|
147 |
name: Operator.Baidu,
|
148 |
},
|
149 |
+
{
|
150 |
+
name: Operator.Wikipedia,
|
151 |
+
},
|
152 |
];
|
153 |
|
154 |
export const initialRetrievalValues = {
|
|
|
216 |
top_n: 10,
|
217 |
};
|
218 |
|
219 |
+
export const initialWikipediaValues = {
|
220 |
+
top_n: 10,
|
221 |
+
language: 'en',
|
222 |
+
};
|
223 |
+
|
224 |
export const CategorizeAnchorPointPositions = [
|
225 |
{ top: 1, right: 34 },
|
226 |
{ top: 8, right: 18 },
|
|
|
279 |
],
|
280 |
[Operator.Baidu]: [Operator.Begin, Operator.Retrieval],
|
281 |
[Operator.DuckDuckGo]: [Operator.Begin, Operator.Retrieval],
|
282 |
+
[Operator.Wikipedia]: [Operator.Begin, Operator.Retrieval],
|
283 |
};
|
284 |
|
285 |
export const NodeMap = {
|
|
|
294 |
[Operator.KeywordExtract]: 'ragNode',
|
295 |
[Operator.DuckDuckGo]: 'ragNode',
|
296 |
[Operator.Baidu]: 'ragNode',
|
297 |
+
[Operator.Wikipedia]: 'ragNode',
|
298 |
};
|
299 |
+
|
300 |
+
export const LanguageOptions = [
|
301 |
+
{
|
302 |
+
value: 'af',
|
303 |
+
label: 'Afrikaans',
|
304 |
+
},
|
305 |
+
{
|
306 |
+
value: 'pl',
|
307 |
+
label: 'Polski',
|
308 |
+
},
|
309 |
+
{
|
310 |
+
value: 'ar',
|
311 |
+
label: 'العربية',
|
312 |
+
},
|
313 |
+
{
|
314 |
+
value: 'ast',
|
315 |
+
label: 'Asturianu',
|
316 |
+
},
|
317 |
+
{
|
318 |
+
value: 'az',
|
319 |
+
label: 'Azərbaycanca',
|
320 |
+
},
|
321 |
+
{
|
322 |
+
value: 'bg',
|
323 |
+
label: 'Български',
|
324 |
+
},
|
325 |
+
{
|
326 |
+
value: 'nan',
|
327 |
+
label: '閩南語 / Bân-lâm-gú',
|
328 |
+
},
|
329 |
+
{
|
330 |
+
value: 'bn',
|
331 |
+
label: 'বাংলা',
|
332 |
+
},
|
333 |
+
{
|
334 |
+
value: 'be',
|
335 |
+
label: 'Беларуская',
|
336 |
+
},
|
337 |
+
{
|
338 |
+
value: 'ca',
|
339 |
+
label: 'Català',
|
340 |
+
},
|
341 |
+
{
|
342 |
+
value: 'cs',
|
343 |
+
label: 'Čeština',
|
344 |
+
},
|
345 |
+
{
|
346 |
+
value: 'cy',
|
347 |
+
label: 'Cymraeg',
|
348 |
+
},
|
349 |
+
{
|
350 |
+
value: 'da',
|
351 |
+
label: 'Dansk',
|
352 |
+
},
|
353 |
+
{
|
354 |
+
value: 'de',
|
355 |
+
label: 'Deutsch',
|
356 |
+
},
|
357 |
+
{
|
358 |
+
value: 'et',
|
359 |
+
label: 'Eesti',
|
360 |
+
},
|
361 |
+
{
|
362 |
+
value: 'el',
|
363 |
+
label: 'Ελληνικά',
|
364 |
+
},
|
365 |
+
{
|
366 |
+
value: 'en',
|
367 |
+
label: 'English',
|
368 |
+
},
|
369 |
+
{
|
370 |
+
value: 'es',
|
371 |
+
label: 'Español',
|
372 |
+
},
|
373 |
+
{
|
374 |
+
value: 'eo',
|
375 |
+
label: 'Esperanto',
|
376 |
+
},
|
377 |
+
{
|
378 |
+
value: 'eu',
|
379 |
+
label: 'Euskara',
|
380 |
+
},
|
381 |
+
{
|
382 |
+
value: 'fa',
|
383 |
+
label: 'فارسی',
|
384 |
+
},
|
385 |
+
{
|
386 |
+
value: 'fr',
|
387 |
+
label: 'Français',
|
388 |
+
},
|
389 |
+
{
|
390 |
+
value: 'gl',
|
391 |
+
label: 'Galego',
|
392 |
+
},
|
393 |
+
{
|
394 |
+
value: 'ko',
|
395 |
+
label: '한국어',
|
396 |
+
},
|
397 |
+
{
|
398 |
+
value: 'hy',
|
399 |
+
label: 'Հայերեն',
|
400 |
+
},
|
401 |
+
{
|
402 |
+
value: 'hi',
|
403 |
+
label: 'हिन्दी',
|
404 |
+
},
|
405 |
+
{
|
406 |
+
value: 'hr',
|
407 |
+
label: 'Hrvatski',
|
408 |
+
},
|
409 |
+
{
|
410 |
+
value: 'id',
|
411 |
+
label: 'Bahasa Indonesia',
|
412 |
+
},
|
413 |
+
{
|
414 |
+
value: 'it',
|
415 |
+
label: 'Italiano',
|
416 |
+
},
|
417 |
+
{
|
418 |
+
value: 'he',
|
419 |
+
label: 'עברית',
|
420 |
+
},
|
421 |
+
{
|
422 |
+
value: 'ka',
|
423 |
+
label: 'ქართული',
|
424 |
+
},
|
425 |
+
{
|
426 |
+
value: 'lld',
|
427 |
+
label: 'Ladin',
|
428 |
+
},
|
429 |
+
{
|
430 |
+
value: 'la',
|
431 |
+
label: 'Latina',
|
432 |
+
},
|
433 |
+
{
|
434 |
+
value: 'lv',
|
435 |
+
label: 'Latviešu',
|
436 |
+
},
|
437 |
+
{
|
438 |
+
value: 'lt',
|
439 |
+
label: 'Lietuvių',
|
440 |
+
},
|
441 |
+
{
|
442 |
+
value: 'hu',
|
443 |
+
label: 'Magyar',
|
444 |
+
},
|
445 |
+
{
|
446 |
+
value: 'mk',
|
447 |
+
label: 'Македонски',
|
448 |
+
},
|
449 |
+
{
|
450 |
+
value: 'arz',
|
451 |
+
label: 'مصرى',
|
452 |
+
},
|
453 |
+
{
|
454 |
+
value: 'ms',
|
455 |
+
label: 'Bahasa Melayu',
|
456 |
+
},
|
457 |
+
{
|
458 |
+
value: 'min',
|
459 |
+
label: 'Bahaso Minangkabau',
|
460 |
+
},
|
461 |
+
{
|
462 |
+
value: 'my',
|
463 |
+
label: 'မြန်မာဘာသာ',
|
464 |
+
},
|
465 |
+
{
|
466 |
+
value: 'nl',
|
467 |
+
label: 'Nederlands',
|
468 |
+
},
|
469 |
+
{
|
470 |
+
value: 'ja',
|
471 |
+
label: '日本語',
|
472 |
+
},
|
473 |
+
{
|
474 |
+
value: 'no',
|
475 |
+
label: 'Norsk (bokmål)',
|
476 |
+
},
|
477 |
+
{
|
478 |
+
value: 'nn',
|
479 |
+
label: 'Norsk (nynorsk)',
|
480 |
+
},
|
481 |
+
{
|
482 |
+
value: 'ce',
|
483 |
+
label: 'Нохчийн',
|
484 |
+
},
|
485 |
+
{
|
486 |
+
value: 'uz',
|
487 |
+
label: 'Oʻzbekcha / Ўзбекча',
|
488 |
+
},
|
489 |
+
{
|
490 |
+
value: 'pt',
|
491 |
+
label: 'Português',
|
492 |
+
},
|
493 |
+
{
|
494 |
+
value: 'kk',
|
495 |
+
label: 'Қазақша / Qazaqşa / قازاقشا',
|
496 |
+
},
|
497 |
+
{
|
498 |
+
value: 'ro',
|
499 |
+
label: 'Română',
|
500 |
+
},
|
501 |
+
{
|
502 |
+
value: 'ru',
|
503 |
+
label: 'Русский',
|
504 |
+
},
|
505 |
+
{
|
506 |
+
value: 'ceb',
|
507 |
+
label: 'Sinugboanong Binisaya',
|
508 |
+
},
|
509 |
+
{
|
510 |
+
value: 'sk',
|
511 |
+
label: 'Slovenčina',
|
512 |
+
},
|
513 |
+
{
|
514 |
+
value: 'sl',
|
515 |
+
label: 'Slovenščina',
|
516 |
+
},
|
517 |
+
{
|
518 |
+
value: 'sr',
|
519 |
+
label: 'Српски / Srpski',
|
520 |
+
},
|
521 |
+
{
|
522 |
+
value: 'sh',
|
523 |
+
label: 'Srpskohrvatski / Српскохрватски',
|
524 |
+
},
|
525 |
+
{
|
526 |
+
value: 'fi',
|
527 |
+
label: 'Suomi',
|
528 |
+
},
|
529 |
+
{
|
530 |
+
value: 'sv',
|
531 |
+
label: 'Svenska',
|
532 |
+
},
|
533 |
+
{
|
534 |
+
value: 'ta',
|
535 |
+
label: 'தமிழ்',
|
536 |
+
},
|
537 |
+
{
|
538 |
+
value: 'tt',
|
539 |
+
label: 'Татарча / Tatarça',
|
540 |
+
},
|
541 |
+
{
|
542 |
+
value: 'th',
|
543 |
+
label: 'ภาษาไทย',
|
544 |
+
},
|
545 |
+
{
|
546 |
+
value: 'tg',
|
547 |
+
label: 'Тоҷикӣ',
|
548 |
+
},
|
549 |
+
{
|
550 |
+
value: 'azb',
|
551 |
+
label: 'تۆرکجه',
|
552 |
+
},
|
553 |
+
{
|
554 |
+
value: 'tr',
|
555 |
+
label: 'Türkçe',
|
556 |
+
},
|
557 |
+
{
|
558 |
+
value: 'uk',
|
559 |
+
label: 'Українська',
|
560 |
+
},
|
561 |
+
{
|
562 |
+
value: 'ur',
|
563 |
+
label: 'اردو',
|
564 |
+
},
|
565 |
+
{
|
566 |
+
value: 'vi',
|
567 |
+
label: 'Tiếng Việt',
|
568 |
+
},
|
569 |
+
{
|
570 |
+
value: 'war',
|
571 |
+
label: 'Winaray',
|
572 |
+
},
|
573 |
+
{
|
574 |
+
value: 'zh',
|
575 |
+
label: '中文',
|
576 |
+
},
|
577 |
+
{
|
578 |
+
value: 'yue',
|
579 |
+
label: '粵語',
|
580 |
+
},
|
581 |
+
];
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
@@ -17,6 +17,7 @@ import OperatorIcon from '../operator-icon';
|
|
17 |
import RelevantForm from '../relevant-form';
|
18 |
import RetrievalForm from '../retrieval-form';
|
19 |
import RewriteQuestionForm from '../rewrite-question-form';
|
|
|
20 |
|
21 |
import styles from './index.less';
|
22 |
|
@@ -36,6 +37,7 @@ const FormMap = {
|
|
36 |
[Operator.Baidu]: BaiduForm,
|
37 |
[Operator.DuckDuckGo]: DuckDuckGoForm,
|
38 |
[Operator.KeywordExtract]: KeywordExtractForm,
|
|
|
39 |
};
|
40 |
|
41 |
const EmptyContent = () => <div>empty</div>;
|
|
|
17 |
import RelevantForm from '../relevant-form';
|
18 |
import RetrievalForm from '../retrieval-form';
|
19 |
import RewriteQuestionForm from '../rewrite-question-form';
|
20 |
+
import WikipediaForm from '../wikipedia-form';
|
21 |
|
22 |
import styles from './index.less';
|
23 |
|
|
|
37 |
[Operator.Baidu]: BaiduForm,
|
38 |
[Operator.DuckDuckGo]: DuckDuckGoForm,
|
39 |
[Operator.KeywordExtract]: KeywordExtractForm,
|
40 |
+
[Operator.Wikipedia]: WikipediaForm,
|
41 |
};
|
42 |
|
43 |
const EmptyContent = () => <div>empty</div>;
|
web/src/pages/flow/hooks.ts
CHANGED
@@ -41,6 +41,7 @@ import {
|
|
41 |
initialRelevantValues,
|
42 |
initialRetrievalValues,
|
43 |
initialRewriteQuestionValues,
|
|
|
44 |
} from './constant';
|
45 |
import { ICategorizeForm, IRelevantForm } from './interface';
|
46 |
import useGraphStore, { RFState } from './store';
|
@@ -88,6 +89,7 @@ export const useInitializeOperatorParams = () => {
|
|
88 |
},
|
89 |
[Operator.DuckDuckGo]: initialDuckValues,
|
90 |
[Operator.Baidu]: initialBaiduValues,
|
|
|
91 |
};
|
92 |
}, [llmId]);
|
93 |
|
|
|
41 |
initialRelevantValues,
|
42 |
initialRetrievalValues,
|
43 |
initialRewriteQuestionValues,
|
44 |
+
initialWikipediaValues,
|
45 |
} from './constant';
|
46 |
import { ICategorizeForm, IRelevantForm } from './interface';
|
47 |
import useGraphStore, { RFState } from './store';
|
|
|
89 |
},
|
90 |
[Operator.DuckDuckGo]: initialDuckValues,
|
91 |
[Operator.Baidu]: initialBaiduValues,
|
92 |
+
[Operator.Wikipedia]: initialWikipediaValues,
|
93 |
};
|
94 |
}, [llmId]);
|
95 |
|
web/src/pages/flow/wikipedia-form/index.tsx
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import TopNItem from '@/components/top-n-item';
|
2 |
+
import { useTranslate } from '@/hooks/commonHooks';
|
3 |
+
import { Form, Select } from 'antd';
|
4 |
+
import { LanguageOptions } from '../constant';
|
5 |
+
import { IOperatorForm } from '../interface';
|
6 |
+
|
7 |
+
const WikipediaForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
+
const { t } = useTranslate('common');
|
9 |
+
|
10 |
+
return (
|
11 |
+
<Form
|
12 |
+
name="basic"
|
13 |
+
labelCol={{ span: 6 }}
|
14 |
+
wrapperCol={{ span: 18 }}
|
15 |
+
autoComplete="off"
|
16 |
+
form={form}
|
17 |
+
onValuesChange={onValuesChange}
|
18 |
+
>
|
19 |
+
<TopNItem initialValue={10}></TopNItem>
|
20 |
+
<Form.Item label={t('language')} name={'language'}>
|
21 |
+
<Select options={LanguageOptions}></Select>
|
22 |
+
</Form.Item>
|
23 |
+
</Form>
|
24 |
+
);
|
25 |
+
};
|
26 |
+
|
27 |
+
export default WikipediaForm;
|