mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-04 03:13:58 +08:00
### What problem does this PR solve? feat: add arxiv operator #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
4b195cc14c
commit
7e60800c95
18
web/src/assets/svg/arxiv.svg
Normal file
18
web/src/assets/svg/arxiv.svg
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<svg t="1721786983645" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4276"
|
||||||
|
width="200" height="200">
|
||||||
|
<path
|
||||||
|
d="M0 750.933333V273.066667a273.066667 273.066667 0 0 1 273.066667-273.066667h477.866666a273.066667 273.066667 0 0 1 273.066667 273.066667v477.866666a273.066667 273.066667 0 0 1-273.066667 273.066667H273.066667a273.066667 273.066667 0 0 1-273.066667-273.066667z"
|
||||||
|
fill="#FFFFFF" p-id="4277"></path>
|
||||||
|
<path
|
||||||
|
d="M0 750.933333V273.066667a273.066667 273.066667 0 0 1 273.066667-273.066667h477.866666a273.066667 273.066667 0 0 1 273.066667 273.066667v477.866666a273.066667 273.066667 0 0 1-273.066667 273.066667H273.066667a273.066667 273.066667 0 0 1-273.066667-273.066667z m34.133333 0q0 98.986667 69.973334 168.96Q174.08 989.866667 273.066667 989.866667h477.866666q98.986667 0 168.96-69.973334Q989.866667 849.92 989.866667 750.933333V273.066667q0-98.986667-69.973334-168.96Q849.92 34.133333 750.933333 34.133333H273.066667Q174.08 34.133333 104.106667 104.106667 34.133333 174.08 34.133333 273.066667v477.866666z"
|
||||||
|
fill="#F0F0F0" p-id="4278"></path>
|
||||||
|
<path
|
||||||
|
d="M433.425067 417.621333l77.346133 93.457067 227.805867-267.605333c12.049067-16.042667 17.749333-24.4736 12.049066-38.126934a41.5744 41.5744 0 0 0-36.215466-25.531733 32.529067 32.529067 0 0 0-24.302934 8.942933l-256.682666 228.864z"
|
||||||
|
fill="#BDB9B4" p-id="4279"></path>
|
||||||
|
<path
|
||||||
|
d="M637.405867 462.301867L275.387733 115.029333a48.2304 48.2304 0 0 0-28.4672-17.066666 37.205333 37.205333 0 0 0-35.054933 22.528c-5.700267 13.653333-1.604267 23.2448 10.888533 41.1648l288.085334 349.5936-214.4256 263.3728c-11.3664 11.741867-15.5648 28.672-11.025067 44.373333 5.905067 14.370133 19.968 23.688533 35.498667 23.552a33.860267 33.860267 0 0 0 25.531733-12.458667l290.781867-270.336c28.910933-26.0096 29.013333-71.338667 0.2048-97.450666z"
|
||||||
|
fill="#B31B1B" p-id="4280"></path>
|
||||||
|
<path
|
||||||
|
d="M801.0752 861.218133l-290.986667-350.72-77.312-93.422933-47.445333 42.8032a70.417067 70.417067 0 0 0 0 101.205333l369.083733 355.669334c6.5536 6.826667 15.872 10.3424 25.326934 9.591466 14.472533-0.238933 27.3408-9.216 32.529066-22.766933a43.008 43.008 0 0 0-11.195733-42.325333z"
|
||||||
|
fill="#BDB9B4" p-id="4281"></path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
@ -9,6 +9,7 @@ import styles from './index.less';
|
|||||||
interface IProps {
|
interface IProps {
|
||||||
deleteItem: () => Promise<any> | void;
|
deleteItem: () => Promise<any> | void;
|
||||||
iconFontSize?: number;
|
iconFontSize?: number;
|
||||||
|
iconFontColor?: string;
|
||||||
items?: MenuProps['items'];
|
items?: MenuProps['items'];
|
||||||
height?: number;
|
height?: number;
|
||||||
needsDeletionValidation?: boolean;
|
needsDeletionValidation?: boolean;
|
||||||
@ -18,6 +19,7 @@ const OperateDropdown = ({
|
|||||||
deleteItem,
|
deleteItem,
|
||||||
children,
|
children,
|
||||||
iconFontSize = 30,
|
iconFontSize = 30,
|
||||||
|
iconFontColor = 'gray',
|
||||||
items: otherItems = [],
|
items: otherItems = [],
|
||||||
height = 24,
|
height = 24,
|
||||||
needsDeletionValidation = true,
|
needsDeletionValidation = true,
|
||||||
@ -69,7 +71,7 @@ const OperateDropdown = ({
|
|||||||
rotate={90}
|
rotate={90}
|
||||||
style={{
|
style={{
|
||||||
fontSize: iconFontSize,
|
fontSize: iconFontSize,
|
||||||
color: 'gray',
|
color: iconFontColor,
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
height,
|
height,
|
||||||
}}
|
}}
|
||||||
|
@ -632,6 +632,13 @@ The above is the content you need to summarize.`,
|
|||||||
email: 'Email',
|
email: 'Email',
|
||||||
emailTip:
|
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.',
|
'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.',
|
||||||
|
arxiv: 'Arxiv',
|
||||||
|
arxivTip:
|
||||||
|
'This component is used to get search result from https://arxiv.org/. Typically, it performs as a supplement to knowledgebases. Top N specifies the number of search results you need to adapt.',
|
||||||
|
sortBy: 'Sort by',
|
||||||
|
submittedDate: 'Submitted date',
|
||||||
|
lastUpdatedDate: 'Last updated date',
|
||||||
|
relevance: 'Relevance',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
|
@ -592,6 +592,13 @@ export default {
|
|||||||
email: '信箱',
|
email: '信箱',
|
||||||
emailTip:
|
emailTip:
|
||||||
'此元件用於從 https://pubmed.ncbi.nlm.nih.gov/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 指定您需要適應的搜尋結果的數量。電子郵件是必填欄位。',
|
'此元件用於從 https://pubmed.ncbi.nlm.nih.gov/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 指定您需要適應的搜尋結果的數量。電子郵件是必填欄位。',
|
||||||
|
arxiv: 'Arxiv',
|
||||||
|
arxivTip:
|
||||||
|
'此元件用於從 https://arxiv.org/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 指定您需要適應的搜尋結果的數量。',
|
||||||
|
sortBy: '排序方式',
|
||||||
|
submittedDate: '提交日期',
|
||||||
|
lastUpdatedDate: '最後更新日期',
|
||||||
|
relevance: '關聯',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: '“保留所有權利 @ react”',
|
profile: '“保留所有權利 @ react”',
|
||||||
|
@ -610,6 +610,13 @@ export default {
|
|||||||
email: '邮箱',
|
email: '邮箱',
|
||||||
emailTip:
|
emailTip:
|
||||||
'此组件用于从 https://pubmed.ncbi.nlm.nih.gov/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要调整的搜索结果数。电子邮件是必填字段。',
|
'此组件用于从 https://pubmed.ncbi.nlm.nih.gov/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要调整的搜索结果数。电子邮件是必填字段。',
|
||||||
|
arxiv: 'Arxiv',
|
||||||
|
arxivTip:
|
||||||
|
'此组件用于从 https://arxiv.org/ 获取搜索结果。通常,它作为知识库的补充。Top N 指定您需要调整的搜索结果数量。',
|
||||||
|
sortBy: '排序方式',
|
||||||
|
submittedDate: '提交日期',
|
||||||
|
lastUpdatedDate: '最后更新日期',
|
||||||
|
relevance: '关联',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
|
34
web/src/pages/flow/arxiv-form/index.tsx
Normal file
34
web/src/pages/flow/arxiv-form/index.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import TopNItem from '@/components/top-n-item';
|
||||||
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
|
import { Form, Select } from 'antd';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
import { IOperatorForm } from '../interface';
|
||||||
|
|
||||||
|
const ArxivForm = ({ onValuesChange, form }: IOperatorForm) => {
|
||||||
|
const { t } = useTranslate('flow');
|
||||||
|
|
||||||
|
const options = useMemo(() => {
|
||||||
|
return ['submittedDate', 'lastUpdatedDate', 'relevance'].map((x) => ({
|
||||||
|
value: x,
|
||||||
|
label: t(x),
|
||||||
|
}));
|
||||||
|
}, [t]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form
|
||||||
|
name="basic"
|
||||||
|
labelCol={{ span: 6 }}
|
||||||
|
wrapperCol={{ span: 18 }}
|
||||||
|
autoComplete="off"
|
||||||
|
form={form}
|
||||||
|
onValuesChange={onValuesChange}
|
||||||
|
>
|
||||||
|
<TopNItem initialValue={10}></TopNItem>
|
||||||
|
<Form.Item label={t('sortBy')} name={'sort_by'}>
|
||||||
|
<Select options={options}></Select>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ArxivForm;
|
@ -7,9 +7,10 @@ import useGraphStore from '../../store';
|
|||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
iconFontColor?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NodeDropdown = ({ id }: IProps) => {
|
const NodeDropdown = ({ id, iconFontColor }: IProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const deleteNodeById = useGraphStore((store) => store.deleteNodeById);
|
const deleteNodeById = useGraphStore((store) => store.deleteNodeById);
|
||||||
const duplicateNodeById = useGraphStore((store) => store.duplicateNode);
|
const duplicateNodeById = useGraphStore((store) => store.duplicateNode);
|
||||||
@ -42,6 +43,7 @@ const NodeDropdown = ({ id }: IProps) => {
|
|||||||
deleteItem={deleteNode}
|
deleteItem={deleteNode}
|
||||||
items={items}
|
items={items}
|
||||||
needsDeletionValidation={false}
|
needsDeletionValidation={false}
|
||||||
|
iconFontColor={iconFontColor}
|
||||||
></OperateDropdown>
|
></OperateDropdown>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,11 @@ import NodeDropdown from './dropdown';
|
|||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import NodePopover from './popover';
|
import NodePopover from './popover';
|
||||||
|
|
||||||
const ZeroGapOperators = [Operator.RewriteQuestion, Operator.KeywordExtract];
|
const ZeroGapOperators = [
|
||||||
|
Operator.RewriteQuestion,
|
||||||
|
Operator.KeywordExtract,
|
||||||
|
Operator.Arxiv,
|
||||||
|
];
|
||||||
|
|
||||||
export function RagNode({
|
export function RagNode({
|
||||||
id,
|
id,
|
||||||
@ -69,8 +73,10 @@ export function RagNode({
|
|||||||
</span>
|
</span>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex flex={1}>
|
<Flex flex={1}>
|
||||||
{' '}
|
<NodeDropdown
|
||||||
<NodeDropdown id={id}></NodeDropdown>
|
id={id}
|
||||||
|
iconFontColor={style?.moreIconColor}
|
||||||
|
></NodeDropdown>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { ReactComponent as ArxivIcon } from '@/assets/svg/arxiv.svg';
|
||||||
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';
|
||||||
@ -38,6 +39,7 @@ export enum Operator {
|
|||||||
DuckDuckGo = 'DuckDuckGo',
|
DuckDuckGo = 'DuckDuckGo',
|
||||||
Wikipedia = 'Wikipedia',
|
Wikipedia = 'Wikipedia',
|
||||||
PubMed = 'PubMed',
|
PubMed = 'PubMed',
|
||||||
|
Arxiv = 'Arxiv',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const operatorIconMap = {
|
export const operatorIconMap = {
|
||||||
@ -54,6 +56,7 @@ export const operatorIconMap = {
|
|||||||
[Operator.Baidu]: BaiduIcon,
|
[Operator.Baidu]: BaiduIcon,
|
||||||
[Operator.Wikipedia]: WikipediaIcon,
|
[Operator.Wikipedia]: WikipediaIcon,
|
||||||
[Operator.PubMed]: PubMedIcon,
|
[Operator.PubMed]: PubMedIcon,
|
||||||
|
[Operator.Arxiv]: ArxivIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const operatorMap = {
|
export const operatorMap = {
|
||||||
@ -120,6 +123,16 @@ export const operatorMap = {
|
|||||||
[Operator.PubMed]: {
|
[Operator.PubMed]: {
|
||||||
backgroundColor: '#a2ccf0',
|
backgroundColor: '#a2ccf0',
|
||||||
},
|
},
|
||||||
|
[Operator.Arxiv]: {
|
||||||
|
width: 70,
|
||||||
|
height: 70,
|
||||||
|
fontSize: 12,
|
||||||
|
iconWidth: 16,
|
||||||
|
iconFontSize: 16,
|
||||||
|
moreIconColor: 'white',
|
||||||
|
backgroundColor: '#b31b1b',
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const componentMenuList = [
|
export const componentMenuList = [
|
||||||
@ -159,6 +172,9 @@ export const componentMenuList = [
|
|||||||
{
|
{
|
||||||
name: Operator.PubMed,
|
name: Operator.PubMed,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: Operator.Arxiv,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const initialRetrievalValues = {
|
export const initialRetrievalValues = {
|
||||||
@ -236,6 +252,11 @@ export const initialPubMedValues = {
|
|||||||
email: '',
|
email: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const initialArxivValues = {
|
||||||
|
top_n: 10,
|
||||||
|
sort_by: 'relevance',
|
||||||
|
};
|
||||||
|
|
||||||
export const CategorizeAnchorPointPositions = [
|
export const CategorizeAnchorPointPositions = [
|
||||||
{ top: 1, right: 34 },
|
{ top: 1, right: 34 },
|
||||||
{ top: 8, right: 18 },
|
{ top: 8, right: 18 },
|
||||||
@ -296,6 +317,7 @@ export const RestrictedUpstreamMap = {
|
|||||||
[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],
|
[Operator.PubMed]: [Operator.Begin, Operator.Retrieval],
|
||||||
|
[Operator.Arxiv]: [Operator.Begin, Operator.Retrieval],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NodeMap = {
|
export const NodeMap = {
|
||||||
@ -312,6 +334,7 @@ export const NodeMap = {
|
|||||||
[Operator.Baidu]: 'ragNode',
|
[Operator.Baidu]: 'ragNode',
|
||||||
[Operator.Wikipedia]: 'ragNode',
|
[Operator.Wikipedia]: 'ragNode',
|
||||||
[Operator.PubMed]: 'ragNode',
|
[Operator.PubMed]: 'ragNode',
|
||||||
|
[Operator.Arxiv]: 'ragNode',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LanguageOptions = [
|
export const LanguageOptions = [
|
||||||
|
@ -4,6 +4,7 @@ import { Drawer, Flex, Form, Input } from 'antd';
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { Node } from 'reactflow';
|
import { Node } from 'reactflow';
|
||||||
import AnswerForm from '../answer-form';
|
import AnswerForm from '../answer-form';
|
||||||
|
import ArxivForm from '../arxiv-form';
|
||||||
import BaiduForm from '../baidu-form';
|
import BaiduForm from '../baidu-form';
|
||||||
import BeginForm from '../begin-form';
|
import BeginForm from '../begin-form';
|
||||||
import CategorizeForm from '../categorize-form';
|
import CategorizeForm from '../categorize-form';
|
||||||
@ -40,6 +41,7 @@ const FormMap = {
|
|||||||
[Operator.KeywordExtract]: KeywordExtractForm,
|
[Operator.KeywordExtract]: KeywordExtractForm,
|
||||||
[Operator.Wikipedia]: WikipediaForm,
|
[Operator.Wikipedia]: WikipediaForm,
|
||||||
[Operator.PubMed]: PubMedForm,
|
[Operator.PubMed]: PubMedForm,
|
||||||
|
[Operator.Arxiv]: ArxivForm,
|
||||||
};
|
};
|
||||||
|
|
||||||
const EmptyContent = () => <div>empty</div>;
|
const EmptyContent = () => <div>empty</div>;
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
NodeMap,
|
NodeMap,
|
||||||
Operator,
|
Operator,
|
||||||
RestrictedUpstreamMap,
|
RestrictedUpstreamMap,
|
||||||
|
initialArxivValues,
|
||||||
initialBaiduValues,
|
initialBaiduValues,
|
||||||
initialBeginValues,
|
initialBeginValues,
|
||||||
initialCategorizeValues,
|
initialCategorizeValues,
|
||||||
@ -92,6 +93,7 @@ export const useInitializeOperatorParams = () => {
|
|||||||
[Operator.Baidu]: initialBaiduValues,
|
[Operator.Baidu]: initialBaiduValues,
|
||||||
[Operator.Wikipedia]: initialWikipediaValues,
|
[Operator.Wikipedia]: initialWikipediaValues,
|
||||||
[Operator.PubMed]: initialPubMedValues,
|
[Operator.PubMed]: initialPubMedValues,
|
||||||
|
[Operator.Arxiv]: initialArxivValues,
|
||||||
};
|
};
|
||||||
}, [llmId]);
|
}, [llmId]);
|
||||||
|
|
||||||
|
0
web/src/pages/force-graph.tsx
Normal file
0
web/src/pages/force-graph.tsx
Normal file
Loading…
x
Reference in New Issue
Block a user