balibabu commited on
Commit
f5ebe5e
·
1 Parent(s): eadfd19

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

Browse files

### 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)

web/src/locales/en.ts CHANGED
@@ -447,6 +447,7 @@ The above is the content you need to summarize.`,
447
  multiTurn: 'Multi-turn optimization',
448
  multiTurnTip:
449
  'In multi-round conversations, the query to the knowledge base is optimized. The large model will be called to consume additional tokens.',
 
450
  },
451
  setting: {
452
  profile: 'Profile',
@@ -1031,6 +1032,7 @@ The above is the content you need to summarize.`,
1031
  reference: 'Reference',
1032
  input: 'Input',
1033
  parameter: 'Parameter',
 
1034
  },
1035
  footer: {
1036
  profile: 'All rights reserved @ React',
 
447
  multiTurn: 'Multi-turn optimization',
448
  multiTurnTip:
449
  'In multi-round conversations, the query to the knowledge base is optimized. The large model will be called to consume additional tokens.',
450
+ howUseId: 'How to use chat ID?',
451
  },
452
  setting: {
453
  profile: 'Profile',
 
1032
  reference: 'Reference',
1033
  input: 'Input',
1034
  parameter: 'Parameter',
1035
+ howUseId: 'How to use agent ID?',
1036
  },
1037
  footer: {
1038
  profile: 'All rights reserved @ React',
web/src/locales/zh-traditional.ts CHANGED
@@ -416,6 +416,7 @@ export default {
416
  multiTurn: '多輪對話優化',
417
  multiTurnTip:
418
  '在多輪對話的中,對去知識庫查詢的問題進行最佳化。會呼叫大模型額外消耗token。',
 
419
  },
420
  setting: {
421
  profile: '概述',
@@ -979,6 +980,7 @@ export default {
979
  reference: '引用',
980
  input: '輸入',
981
  parameter: '參數',
 
982
  },
983
  footer: {
984
  profile: '“保留所有權利 @ react”',
 
416
  multiTurn: '多輪對話優化',
417
  multiTurnTip:
418
  '在多輪對話的中,對去知識庫查詢的問題進行最佳化。會呼叫大模型額外消耗token。',
419
+ howUseId: '如何使用聊天ID?',
420
  },
421
  setting: {
422
  profile: '概述',
 
980
  reference: '引用',
981
  input: '輸入',
982
  parameter: '參數',
983
+ howUseId: '如何使用Agent ID?',
984
  },
985
  footer: {
986
  profile: '“保留所有權利 @ react”',
web/src/locales/zh.ts CHANGED
@@ -433,6 +433,7 @@ export default {
433
  multiTurn: '多轮对话优化',
434
  multiTurnTip:
435
  '在多轮对话的中,对去知识库查询的问题进行优化。会调用大模型额外消耗token。',
 
436
  },
437
  setting: {
438
  profile: '概要',
@@ -999,6 +1000,7 @@ export default {
999
  reference: '引用',
1000
  input: '输入',
1001
  parameter: '参数',
 
1002
  },
1003
  footer: {
1004
  profile: 'All rights reserved @ React',
 
433
  multiTurn: '多轮对话优化',
434
  multiTurnTip:
435
  '在多轮对话的中,对去知识库查询的问题进行优化。会调用大模型额外消耗token。',
436
+ howUseId: '如何使用聊天ID?',
437
  },
438
  setting: {
439
  profile: '概要',
 
1000
  reference: '引用',
1001
  input: '输入',
1002
  parameter: '参数',
1003
+ howUseId: '如何使用Agent ID?',
1004
  },
1005
  footer: {
1006
  profile: 'All rights reserved @ React',
web/src/pages/chat/chat-id-modal/index.tsx CHANGED
@@ -4,7 +4,7 @@ import { Modal, Typography } from 'antd';
4
 
5
  import styles from './index.less';
6
 
7
- const { Paragraph } = Typography;
8
 
9
  const ChatIdModal = ({
10
  visible,
@@ -14,20 +14,24 @@ const ChatIdModal = ({
14
  const { t } = useTranslate('chat');
15
 
16
  return (
17
- <>
18
- <Modal
19
- title={t('overview')}
20
- open={visible}
21
- onCancel={hideModal}
22
- cancelButtonProps={{ style: { display: 'none' } }}
23
- onOk={hideModal}
24
- okText={t('close', { keyPrefix: 'common' })}
 
 
 
 
 
 
25
  >
26
- <Paragraph copyable={{ text: id }} className={styles.id}>
27
- {id}
28
- </Paragraph>
29
- </Modal>
30
- </>
31
  );
32
  };
33
 
 
4
 
5
  import styles from './index.less';
6
 
7
+ const { Paragraph, Link } = Typography;
8
 
9
  const ChatIdModal = ({
10
  visible,
 
14
  const { t } = useTranslate('chat');
15
 
16
  return (
17
+ <Modal
18
+ title={t('overview')}
19
+ open={visible}
20
+ onCancel={hideModal}
21
+ cancelButtonProps={{ style: { display: 'none' } }}
22
+ onOk={hideModal}
23
+ okText={t('close', { keyPrefix: 'common' })}
24
+ >
25
+ <Paragraph copyable={{ text: id }} className={styles.id}>
26
+ {id}
27
+ </Paragraph>
28
+ <Link
29
+ href="https://ragflow.io/docs/dev/http_api_reference#create-session"
30
+ target="_blank"
31
  >
32
+ {t('howUseId')}
33
+ </Link>
34
+ </Modal>
 
 
35
  );
36
  };
37
 
web/src/pages/flow/flow-id-modal/index.less ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .id {
2
+ .linkText();
3
+ }
web/src/pages/flow/flow-id-modal/index.tsx ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useTranslate } from '@/hooks/common-hooks';
2
+ import { IModalProps } from '@/interfaces/common';
3
+ import { Modal, Typography } from 'antd';
4
+
5
+ import { useParams } from 'umi';
6
+ import styles from './index.less';
7
+
8
+ const { Paragraph, Link } = Typography;
9
+
10
+ const FlowIdModal = ({ hideModal }: IModalProps<any>) => {
11
+ const { t } = useTranslate('flow');
12
+ const { id } = useParams();
13
+
14
+ return (
15
+ <Modal
16
+ title={'Agent ID'}
17
+ open
18
+ onCancel={hideModal}
19
+ cancelButtonProps={{ style: { display: 'none' } }}
20
+ onOk={hideModal}
21
+ okText={t('close', { keyPrefix: 'common' })}
22
+ >
23
+ <Paragraph copyable={{ text: id }} className={styles.id}>
24
+ {id}
25
+ </Paragraph>
26
+ <Link
27
+ href="https://ragflow.io/docs/dev/http_api_reference#create-agent-session"
28
+ target="_blank"
29
+ >
30
+ {t('howUseId')}
31
+ </Link>
32
+ </Modal>
33
+ );
34
+ };
35
+
36
+ export default FlowIdModal;
web/src/pages/flow/header/index.tsx CHANGED
@@ -4,6 +4,7 @@ import { useFetchFlow } from '@/hooks/flow-hooks';
4
  import { ArrowLeftOutlined } from '@ant-design/icons';
5
  import { Button, Flex, Space } from 'antd';
6
  import { Link, useParams } from 'umi';
 
7
  import { useSaveGraph, useSaveGraphBeforeOpeningDebugDrawer } from '../hooks';
8
  import styles from './index.less';
9
 
@@ -21,6 +22,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
21
  hideModal: hideOverviewModal,
22
  showModal: showOverviewModal,
23
  } = useSetModalState();
 
24
  const { id } = useParams();
25
 
26
  return (
@@ -44,8 +46,11 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
44
  <Button type="primary" onClick={saveGraph}>
45
  <b>{t('save')}</b>
46
  </Button>
47
- <Button type="primary" onClick={showOverviewModal} disabled>
48
  <b>{t('publish')}</b>
 
 
 
49
  </Button>
50
  </Space>
51
  </Flex>
@@ -57,6 +62,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
57
  idKey="canvasId"
58
  ></ChatOverviewModal>
59
  )}
 
60
  </>
61
  );
62
  };
 
4
  import { ArrowLeftOutlined } from '@ant-design/icons';
5
  import { Button, Flex, Space } from 'antd';
6
  import { Link, useParams } from 'umi';
7
+ import FlowIdModal from '../flow-id-modal';
8
  import { useSaveGraph, useSaveGraphBeforeOpeningDebugDrawer } from '../hooks';
9
  import styles from './index.less';
10
 
 
22
  hideModal: hideOverviewModal,
23
  showModal: showOverviewModal,
24
  } = useSetModalState();
25
+ const { visible, hideModal, showModal } = useSetModalState();
26
  const { id } = useParams();
27
 
28
  return (
 
46
  <Button type="primary" onClick={saveGraph}>
47
  <b>{t('save')}</b>
48
  </Button>
49
+ {/* <Button type="primary" onClick={showOverviewModal} disabled>
50
  <b>{t('publish')}</b>
51
+ </Button> */}
52
+ <Button type="primary" onClick={showModal}>
53
+ <b>Agent ID</b>
54
  </Button>
55
  </Space>
56
  </Flex>
 
62
  idKey="canvasId"
63
  ></ChatOverviewModal>
64
  )}
65
+ {visible && <FlowIdModal hideModal={hideModal}></FlowIdModal>}
66
  </>
67
  );
68
  };