feat: Add agent interface document link to agent page #3189 (#3190)

### What problem does this PR solve?

feat: Add agent interface document link to agent page #3189

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu 2024-11-04 17:04:35 +08:00 committed by GitHub
parent 16b6a78c1e
commit 57f23e0808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 70 additions and 15 deletions

View File

@ -447,6 +447,7 @@ The above is the content you need to summarize.`,
multiTurn: 'Multi-turn optimization',
multiTurnTip:
'In multi-round conversations, the query to the knowledge base is optimized. The large model will be called to consume additional tokens.',
howUseId: 'How to use chat ID?',
},
setting: {
profile: 'Profile',
@ -1031,6 +1032,7 @@ The above is the content you need to summarize.`,
reference: 'Reference',
input: 'Input',
parameter: 'Parameter',
howUseId: 'How to use agent ID?',
},
footer: {
profile: 'All rights reserved @ React',

View File

@ -416,6 +416,7 @@ export default {
multiTurn: '多輪對話優化',
multiTurnTip:
'在多輪對話的中對去知識庫查詢的問題進行最佳化。會呼叫大模型額外消耗token。',
howUseId: '如何使用聊天ID',
},
setting: {
profile: '概述',
@ -979,6 +980,7 @@ export default {
reference: '引用',
input: '輸入',
parameter: '參數',
howUseId: '如何使用Agent ID',
},
footer: {
profile: '“保留所有權利 @ react”',

View File

@ -433,6 +433,7 @@ export default {
multiTurn: '多轮对话优化',
multiTurnTip:
'在多轮对话的中对去知识库查询的问题进行优化。会调用大模型额外消耗token。',
howUseId: '如何使用聊天ID',
},
setting: {
profile: '概要',
@ -999,6 +1000,7 @@ export default {
reference: '引用',
input: '输入',
parameter: '参数',
howUseId: '如何使用Agent ID',
},
footer: {
profile: 'All rights reserved @ React',

View File

@ -4,7 +4,7 @@ import { Modal, Typography } from 'antd';
import styles from './index.less';
const { Paragraph } = Typography;
const { Paragraph, Link } = Typography;
const ChatIdModal = ({
visible,
@ -14,7 +14,6 @@ const ChatIdModal = ({
const { t } = useTranslate('chat');
return (
<>
<Modal
title={t('overview')}
open={visible}
@ -26,8 +25,13 @@ const ChatIdModal = ({
<Paragraph copyable={{ text: id }} className={styles.id}>
{id}
</Paragraph>
<Link
href="https://ragflow.io/docs/dev/http_api_reference#create-session"
target="_blank"
>
{t('howUseId')}
</Link>
</Modal>
</>
);
};

View File

@ -0,0 +1,3 @@
.id {
.linkText();
}

View File

@ -0,0 +1,36 @@
import { useTranslate } from '@/hooks/common-hooks';
import { IModalProps } from '@/interfaces/common';
import { Modal, Typography } from 'antd';
import { useParams } from 'umi';
import styles from './index.less';
const { Paragraph, Link } = Typography;
const FlowIdModal = ({ hideModal }: IModalProps<any>) => {
const { t } = useTranslate('flow');
const { id } = useParams();
return (
<Modal
title={'Agent ID'}
open
onCancel={hideModal}
cancelButtonProps={{ style: { display: 'none' } }}
onOk={hideModal}
okText={t('close', { keyPrefix: 'common' })}
>
<Paragraph copyable={{ text: id }} className={styles.id}>
{id}
</Paragraph>
<Link
href="https://ragflow.io/docs/dev/http_api_reference#create-agent-session"
target="_blank"
>
{t('howUseId')}
</Link>
</Modal>
);
};
export default FlowIdModal;

View File

@ -4,6 +4,7 @@ import { useFetchFlow } from '@/hooks/flow-hooks';
import { ArrowLeftOutlined } from '@ant-design/icons';
import { Button, Flex, Space } from 'antd';
import { Link, useParams } from 'umi';
import FlowIdModal from '../flow-id-modal';
import { useSaveGraph, useSaveGraphBeforeOpeningDebugDrawer } from '../hooks';
import styles from './index.less';
@ -21,6 +22,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
hideModal: hideOverviewModal,
showModal: showOverviewModal,
} = useSetModalState();
const { visible, hideModal, showModal } = useSetModalState();
const { id } = useParams();
return (
@ -44,8 +46,11 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
<Button type="primary" onClick={saveGraph}>
<b>{t('save')}</b>
</Button>
<Button type="primary" onClick={showOverviewModal} disabled>
{/* <Button type="primary" onClick={showOverviewModal} disabled>
<b>{t('publish')}</b>
</Button> */}
<Button type="primary" onClick={showModal}>
<b>Agent ID</b>
</Button>
</Space>
</Flex>
@ -57,6 +62,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
idKey="canvasId"
></ChatOverviewModal>
)}
{visible && <FlowIdModal hideModal={hideModal}></FlowIdModal>}
</>
);
};