balibabu
commited on
Commit
·
446c54c
1
Parent(s):
f6c03ce
Feat: Add keyword item to AssistantSetting #4543 (#4603)
Browse files### What problem does this PR solve?
Feat: Add keyword item to AssistantSetting #4543
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/components/knowledge-base-item.tsx
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
|
3 |
import { UserOutlined } from '@ant-design/icons';
|
@@ -8,7 +9,11 @@ const KnowledgeBaseItem = () => {
|
|
8 |
|
9 |
const { list: knowledgeList } = useFetchKnowledgeList(true);
|
10 |
|
11 |
-
const
|
|
|
|
|
|
|
|
|
12 |
label: (
|
13 |
<Space>
|
14 |
<Avatar size={20} icon={<UserOutlined />} src={x.avatar} />
|
|
|
1 |
+
import { DocumentParserType } from '@/constants/knowledge';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
|
4 |
import { UserOutlined } from '@ant-design/icons';
|
|
|
9 |
|
10 |
const { list: knowledgeList } = useFetchKnowledgeList(true);
|
11 |
|
12 |
+
const filteredKnowledgeList = knowledgeList.filter(
|
13 |
+
(x) => x.parser_id !== DocumentParserType.Tag,
|
14 |
+
);
|
15 |
+
|
16 |
+
const knowledgeOptions = filteredKnowledgeList.map((x) => ({
|
17 |
label: (
|
18 |
<Space>
|
19 |
<Avatar size={20} icon={<UserOutlined />} src={x.avatar} />
|
web/src/constants/knowledge.ts
CHANGED
@@ -63,3 +63,20 @@ export enum DocumentType {
|
|
63 |
Virtual = 'virtual',
|
64 |
Visual = 'visual',
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
Virtual = 'virtual',
|
64 |
Visual = 'visual',
|
65 |
}
|
66 |
+
|
67 |
+
export enum DocumentParserType {
|
68 |
+
Naive = 'naive',
|
69 |
+
Qa = 'qa',
|
70 |
+
Resume = 'resume',
|
71 |
+
Manual = 'manual',
|
72 |
+
Table = 'table',
|
73 |
+
Paper = 'paper',
|
74 |
+
Book = 'book',
|
75 |
+
Laws = 'laws',
|
76 |
+
Presentation = 'presentation',
|
77 |
+
Picture = 'picture',
|
78 |
+
One = 'one',
|
79 |
+
Audio = 'audio',
|
80 |
+
Email = 'email',
|
81 |
+
Tag = 'tag',
|
82 |
+
}
|
web/src/locales/en.ts
CHANGED
@@ -520,6 +520,8 @@ This procedure will improve precision of retrieval by adding more information to
|
|
520 |
useKnowledgeGraph: 'Use knowledge graph',
|
521 |
useKnowledgeGraphTip:
|
522 |
'It will retrieve descriptions of relevant entities,relations and community reports, which will enhance inference of multi-hop and complex question.',
|
|
|
|
|
523 |
},
|
524 |
setting: {
|
525 |
profile: 'Profile',
|
|
|
520 |
useKnowledgeGraph: 'Use knowledge graph',
|
521 |
useKnowledgeGraphTip:
|
522 |
'It will retrieve descriptions of relevant entities,relations and community reports, which will enhance inference of multi-hop and complex question.',
|
523 |
+
keyword: 'Keyword analysis',
|
524 |
+
keywordTip: `Apply LLM to analyze user's questions, extract keywords which will be emphesize during the relevance omputation.`,
|
525 |
},
|
526 |
setting: {
|
527 |
profile: 'Profile',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -504,6 +504,8 @@ export default {
|
|
504 |
useKnowledgeGraph: '使用知識圖譜',
|
505 |
useKnowledgeGraph提示:
|
506 |
'它將檢索相關實體、關係和社區報告的描述,這將增強多跳和複雜問題的推理。',
|
|
|
|
|
507 |
},
|
508 |
setting: {
|
509 |
profile: '概述',
|
|
|
504 |
useKnowledgeGraph: '使用知識圖譜',
|
505 |
useKnowledgeGraph提示:
|
506 |
'它將檢索相關實體、關係和社區報告的描述,這將增強多跳和複雜問題的推理。',
|
507 |
+
keyword: '關鍵字分析',
|
508 |
+
keywordTip: `應用LLM分析使用者的問題,提取在相關性計算中需要強調的關鍵字。`,
|
509 |
},
|
510 |
setting: {
|
511 |
profile: '概述',
|
web/src/locales/zh.ts
CHANGED
@@ -521,6 +521,8 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
|
|
521 |
useKnowledgeGraph: '使用知识图谱',
|
522 |
useKnowledgeGraphTip:
|
523 |
'它将检索相关实体、关系和社区报告的描述,这将增强多跳和复杂问题的推理。',
|
|
|
|
|
524 |
},
|
525 |
setting: {
|
526 |
profile: '概要',
|
|
|
521 |
useKnowledgeGraph: '使用知识图谱',
|
522 |
useKnowledgeGraphTip:
|
523 |
'它将检索相关实体、关系和社区报告的描述,这将增强多跳和复杂问题的推理。',
|
524 |
+
keyword: '关键词分析',
|
525 |
+
keywordTip: `应用 LLM 分析用户的问题,提取在相关性计算中要强调的关键词。`,
|
526 |
},
|
527 |
setting: {
|
528 |
profile: '概要',
|
web/src/pages/chat/chat-configuration-modal/assistant-setting.tsx
CHANGED
@@ -107,6 +107,15 @@ const AssistantSetting = ({ show, form }: ISegmentedContentProps) => {
|
|
107 |
>
|
108 |
<Switch />
|
109 |
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
{/* <Form.Item
|
111 |
label={t('selfRag')}
|
112 |
valuePropName="checked"
|
|
|
107 |
>
|
108 |
<Switch />
|
109 |
</Form.Item>
|
110 |
+
<Form.Item
|
111 |
+
label={t('keyword')}
|
112 |
+
valuePropName="checked"
|
113 |
+
name={['prompt_config', 'keyword']}
|
114 |
+
tooltip={t('keywordTip')}
|
115 |
+
initialValue={false}
|
116 |
+
>
|
117 |
+
<Switch />
|
118 |
+
</Form.Item>
|
119 |
{/* <Form.Item
|
120 |
label={t('selfRag')}
|
121 |
valuePropName="checked"
|