### What problem does this PR solve? feat: modify the translation of baiduDescription #918 feat: add PubMed operator #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)tags/v0.9.0
| <svg t="1721281989464" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4310" | |||||
| width="200" height="200"> | |||||
| <path d="M128 64h448l192 448-192 448H128a128 128 0 0 1-128-128V192a128 128 0 0 1 128-128z" fill="#205992" | |||||
| p-id="4311"></path> | |||||
| <path d="M704 64h128l192 448-192 448h-128l192-448z" fill="#205992" p-id="4312"></path> | |||||
| </svg> |
| messageDescription: | messageDescription: | ||||
| 'This component is used to send user static information. You can prepare several messages which will be chosen randomly.', | 'This component is used to send user static information. You can prepare several messages which will be chosen randomly.', | ||||
| keywordDescription: `This component is used to extract keywords from user's question. Top N specifies the number of keywords you need to extract.`, | keywordDescription: `This component is used to extract keywords from user's question. Top N specifies the number of keywords you need to extract.`, | ||||
| 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.`, | |||||
| 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 adapt.`, | |||||
| promptText: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following: | promptText: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following: | ||||
| {input} | {input} | ||||
| The above is the content you need to summarize.`, | The above is the content you need to summarize.`, | ||||
| keywordExtract: 'Keyword', | keywordExtract: 'Keyword', | ||||
| keywordExtractDescription: `This component is used to extract keywords from user's question. Top N specifies the number of keywords you need to extract.`, | keywordExtractDescription: `This component is used to extract keywords from user's question. Top N specifies the number of keywords you need to extract.`, | ||||
| baidu: 'Baidu', | baidu: 'Baidu', | ||||
| baiduDescription: `This component is used to get search result from www.baidu.com. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adopt.`, | |||||
| baiduDescription: `This component is used to get search result from www.baidu.com. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adapt.`, | |||||
| duckDuckGo: 'DuckDuckGo', | duckDuckGo: 'DuckDuckGo', | ||||
| duckDuckGoDescription: | duckDuckGoDescription: | ||||
| 'This component is used to get search result from www.duckduckgo.com. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adopt.', | |||||
| 'This component is used to get search result from www.duckduckgo.com. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adapt.', | |||||
| channel: 'Channel', | channel: 'Channel', | ||||
| channelTip: `Perform text search or news search on the component's input`, | channelTip: `Perform text search or news search on the component's input`, | ||||
| text: 'Text', | text: 'Text', | ||||
| messageHistoryWindowSizeTip: | messageHistoryWindowSizeTip: | ||||
| '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.', | '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.', | ||||
| wikipedia: 'Wikipedia', | wikipedia: 'Wikipedia', | ||||
| pubMed: 'PubMed', | |||||
| email: 'Email', | |||||
| emailTip: | |||||
| 'This component is used to get search result from https://pubmed.ncbi.nlm.nih.gov/. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adapt. E-mail is a required field.', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: 'All rights reserved @ React', | profile: 'All rights reserved @ React', |
| messageDescription: | messageDescription: | ||||
| '此元件用於向使用者發送靜態訊息。您可以準備幾條訊息,這些訊息將隨機選擇。', | '此元件用於向使用者發送靜態訊息。您可以準備幾條訊息,這些訊息將隨機選擇。', | ||||
| keywordDescription: `該組件用於從用戶的問題中提取關鍵字。 Top N指定需要提取的關鍵字數量。`, | keywordDescription: `該組件用於從用戶的問題中提取關鍵字。 Top N指定需要提取的關鍵字數量。`, | ||||
| wikipediaDescription: `此元件用於從 https://www.wikipedia.org/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 指定您需要採用的搜尋結果的數量。`, | |||||
| wikipediaDescription: `此元件用於從 https://www.wikipedia.org/ 取得搜尋結果。通常,它作為知識庫的補充。 Top N 指定您需要調整的搜尋結果數。`, | |||||
| promptText: `請總結以下段落。注意數字,不要胡編亂造。段落如下: | promptText: `請總結以下段落。注意數字,不要胡編亂造。段落如下: | ||||
| {input} | {input} | ||||
| 以上就是你需要總結的內容。`, | 以上就是你需要總結的內容。`, | ||||
| messageHistoryWindowSizeTip: | messageHistoryWindowSizeTip: | ||||
| 'LLM需要查看的對話記錄的視窗大小。越大越好。但要注意LLM的最大內容長度。', | 'LLM需要查看的對話記錄的視窗大小。越大越好。但要注意LLM的最大內容長度。', | ||||
| wikipedia: '維基百科', | wikipedia: '維基百科', | ||||
| email: '信箱', | |||||
| emailTip: | |||||
| '此元件用於從 https://pubmed.ncbi.nlm.nih.gov/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 指定您需要適應的搜尋結果的數量。電子郵件是必填欄位。', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: '“保留所有權利 @ react”', | profile: '“保留所有權利 @ react”', |
| messageDescription: | messageDescription: | ||||
| '此组件用于向用户发送静态信息。您可以准备几条消息,这些消息将被随机选择。', | '此组件用于向用户发送静态信息。您可以准备几条消息,这些消息将被随机选择。', | ||||
| keywordDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`, | keywordDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`, | ||||
| wikipediaDescription: `此组件用于从 https://www.wikipedia.org/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要采用的搜索结果数量。`, | |||||
| wikipediaDescription: `此组件用于从 https://www.wikipedia.org/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要调整的搜索结果数量。`, | |||||
| promptText: `请总结以下段落。注意数字,不要胡编乱造。段落如下: | promptText: `请总结以下段落。注意数字,不要胡编乱造。段落如下: | ||||
| {input} | {input} | ||||
| 以上就是你需要总结的内容。`, | 以上就是你需要总结的内容。`, | ||||
| keywordExtract: '关键词', | keywordExtract: '关键词', | ||||
| keywordExtractDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`, | keywordExtractDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`, | ||||
| baidu: '百度', | baidu: '百度', | ||||
| baiduDescription: `该组件用于获取www.baidu.com的搜索结果,一般作为知识库的补充,Top N指定需要采纳的搜索结果数量。`, | |||||
| baiduDescription: `此元件用於取得www.baidu.com的搜尋結果。通常作為知識庫的補充。 Top N指定您需要適配的搜尋結果數。`, | |||||
| duckDuckGo: 'DuckDuckGo', | duckDuckGo: 'DuckDuckGo', | ||||
| duckDuckGoDescription: | duckDuckGoDescription: | ||||
| '此组件用于从 www.duckduckgo.com 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要采用的搜索结果数量。', | |||||
| '此元件用於從 www.duckduckgo.com 取得搜尋結果。通常,它作為知識庫的補充。 Top N 指定您需要調整的搜尋結果數。', | |||||
| channel: '频道', | channel: '频道', | ||||
| channelTip: '针对该组件的输入进行文本搜索或新闻搜索', | channelTip: '针对该组件的输入进行文本搜索或新闻搜索', | ||||
| text: '文本', | text: '文本', | ||||
| messageHistoryWindowSizeTip: | messageHistoryWindowSizeTip: | ||||
| 'LLM 需要查看的对话历史窗口大小。越大越好。但要注意 LLM 的最大内容长度。', | 'LLM 需要查看的对话历史窗口大小。越大越好。但要注意 LLM 的最大内容长度。', | ||||
| wikipedia: '维基百科', | wikipedia: '维基百科', | ||||
| email: '邮箱', | |||||
| emailTip: | |||||
| '此组件用于从 https://pubmed.ncbi.nlm.nih.gov/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要调整的搜索结果数。电子邮件是必填字段。', | |||||
| }, | }, | ||||
| footer: { | footer: { | ||||
| profile: 'All rights reserved @ React', | profile: 'All rights reserved @ React', |
| import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg'; | import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg'; | ||||
| import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg'; | import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg'; | ||||
| import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg'; | import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg'; | ||||
| import { ReactComponent as PubMedIcon } from '@/assets/svg/pubmed.svg'; | |||||
| import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg'; | import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg'; | ||||
| import { variableEnabledFieldMap } from '@/constants/chat'; | import { variableEnabledFieldMap } from '@/constants/chat'; | ||||
| import i18n from '@/locales/config'; | import i18n from '@/locales/config'; | ||||
| Baidu = 'Baidu', | Baidu = 'Baidu', | ||||
| DuckDuckGo = 'DuckDuckGo', | DuckDuckGo = 'DuckDuckGo', | ||||
| Wikipedia = 'Wikipedia', | Wikipedia = 'Wikipedia', | ||||
| PubMed = 'PubMed', | |||||
| } | } | ||||
| export const operatorIconMap = { | export const operatorIconMap = { | ||||
| [Operator.DuckDuckGo]: DuckIcon, | [Operator.DuckDuckGo]: DuckIcon, | ||||
| [Operator.Baidu]: BaiduIcon, | [Operator.Baidu]: BaiduIcon, | ||||
| [Operator.Wikipedia]: WikipediaIcon, | [Operator.Wikipedia]: WikipediaIcon, | ||||
| [Operator.PubMed]: PubMedIcon, | |||||
| }; | }; | ||||
| export const operatorMap = { | export const operatorMap = { | ||||
| [Operator.Wikipedia]: { | [Operator.Wikipedia]: { | ||||
| backgroundColor: '#dee0e2', | backgroundColor: '#dee0e2', | ||||
| }, | }, | ||||
| [Operator.PubMed]: { | |||||
| backgroundColor: '#a2ccf0', | |||||
| }, | |||||
| }; | }; | ||||
| export const componentMenuList = [ | export const componentMenuList = [ | ||||
| { | { | ||||
| name: Operator.Wikipedia, | name: Operator.Wikipedia, | ||||
| }, | }, | ||||
| { | |||||
| name: Operator.PubMed, | |||||
| }, | |||||
| ]; | ]; | ||||
| export const initialRetrievalValues = { | export const initialRetrievalValues = { | ||||
| language: 'en', | language: 'en', | ||||
| }; | }; | ||||
| export const initialPubMedValues = { | |||||
| top_n: 10, | |||||
| email: '', | |||||
| }; | |||||
| export const CategorizeAnchorPointPositions = [ | export const CategorizeAnchorPointPositions = [ | ||||
| { top: 1, right: 34 }, | { top: 1, right: 34 }, | ||||
| { top: 8, right: 18 }, | { top: 8, right: 18 }, | ||||
| [Operator.Baidu]: [Operator.Begin, Operator.Retrieval], | [Operator.Baidu]: [Operator.Begin, Operator.Retrieval], | ||||
| [Operator.DuckDuckGo]: [Operator.Begin, Operator.Retrieval], | [Operator.DuckDuckGo]: [Operator.Begin, Operator.Retrieval], | ||||
| [Operator.Wikipedia]: [Operator.Begin, Operator.Retrieval], | [Operator.Wikipedia]: [Operator.Begin, Operator.Retrieval], | ||||
| [Operator.PubMed]: [Operator.Begin, Operator.Retrieval], | |||||
| }; | }; | ||||
| export const NodeMap = { | export const NodeMap = { | ||||
| [Operator.DuckDuckGo]: 'ragNode', | [Operator.DuckDuckGo]: 'ragNode', | ||||
| [Operator.Baidu]: 'ragNode', | [Operator.Baidu]: 'ragNode', | ||||
| [Operator.Wikipedia]: 'ragNode', | [Operator.Wikipedia]: 'ragNode', | ||||
| [Operator.PubMed]: 'ragNode', | |||||
| }; | }; | ||||
| export const LanguageOptions = [ | export const LanguageOptions = [ |
| import KeywordExtractForm from '../keyword-extract-form'; | import KeywordExtractForm from '../keyword-extract-form'; | ||||
| import MessageForm from '../message-form'; | import MessageForm from '../message-form'; | ||||
| import OperatorIcon from '../operator-icon'; | import OperatorIcon from '../operator-icon'; | ||||
| import PubMedForm from '../pubmed-form'; | |||||
| import RelevantForm from '../relevant-form'; | import RelevantForm from '../relevant-form'; | ||||
| import RetrievalForm from '../retrieval-form'; | import RetrievalForm from '../retrieval-form'; | ||||
| import RewriteQuestionForm from '../rewrite-question-form'; | import RewriteQuestionForm from '../rewrite-question-form'; | ||||
| [Operator.DuckDuckGo]: DuckDuckGoForm, | [Operator.DuckDuckGo]: DuckDuckGoForm, | ||||
| [Operator.KeywordExtract]: KeywordExtractForm, | [Operator.KeywordExtract]: KeywordExtractForm, | ||||
| [Operator.Wikipedia]: WikipediaForm, | [Operator.Wikipedia]: WikipediaForm, | ||||
| [Operator.PubMed]: PubMedForm, | |||||
| }; | }; | ||||
| const EmptyContent = () => <div>empty</div>; | const EmptyContent = () => <div>empty</div>; |
| initialGenerateValues, | initialGenerateValues, | ||||
| initialKeywordExtractValues, | initialKeywordExtractValues, | ||||
| initialMessageValues, | initialMessageValues, | ||||
| initialPubMedValues, | |||||
| initialRelevantValues, | initialRelevantValues, | ||||
| initialRetrievalValues, | initialRetrievalValues, | ||||
| initialRewriteQuestionValues, | initialRewriteQuestionValues, | ||||
| [Operator.DuckDuckGo]: initialDuckValues, | [Operator.DuckDuckGo]: initialDuckValues, | ||||
| [Operator.Baidu]: initialBaiduValues, | [Operator.Baidu]: initialBaiduValues, | ||||
| [Operator.Wikipedia]: initialWikipediaValues, | [Operator.Wikipedia]: initialWikipediaValues, | ||||
| [Operator.PubMed]: initialPubMedValues, | |||||
| }; | }; | ||||
| }, [llmId]); | }, [llmId]); | ||||
| import TopNItem from '@/components/top-n-item'; | |||||
| import { useTranslate } from '@/hooks/common-hooks'; | |||||
| import { Form, Input } from 'antd'; | |||||
| import { IOperatorForm } from '../interface'; | |||||
| const PubMedForm = ({ onValuesChange, form }: IOperatorForm) => { | |||||
| const { t } = useTranslate('flow'); | |||||
| return ( | |||||
| <Form | |||||
| name="basic" | |||||
| labelCol={{ span: 6 }} | |||||
| wrapperCol={{ span: 18 }} | |||||
| autoComplete="off" | |||||
| form={form} | |||||
| onValuesChange={onValuesChange} | |||||
| > | |||||
| <TopNItem initialValue={10}></TopNItem> | |||||
| <Form.Item | |||||
| label={t('email')} | |||||
| name={'email'} | |||||
| tooltip={t('emailTip')} | |||||
| rules={[{ type: 'email' }]} | |||||
| > | |||||
| <Input></Input> | |||||
| </Form.Item> | |||||
| </Form> | |||||
| ); | |||||
| }; | |||||
| export default PubMedForm; |
| <Input placeholder="https://api.openai.com/v1" /> | <Input placeholder="https://api.openai.com/v1" /> | ||||
| </Form.Item> | </Form.Item> | ||||
| )} | )} | ||||
| {llmFactory.toLowerCase() === 'Minimax'.toLowerCase() && ( | |||||
| {llmFactory?.toLowerCase() === 'Minimax'.toLowerCase() && ( | |||||
| <Form.Item<FieldType> label={'Group ID'} name="group_id"> | <Form.Item<FieldType> label={'Group ID'} name="group_id"> | ||||
| <Input /> | <Input /> | ||||
| </Form.Item> | </Form.Item> |