balibabu
commited on
Commit
·
194d038
1
Parent(s):
60dc256
feat: add icon to title of operator form #918 (#1413)
Browse files### What problem does this PR solve?
feat: add icon to title of operator form #918
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/locales/en.ts +1 -0
- web/src/locales/zh-traditional.ts +1 -0
- web/src/locales/zh.ts +1 -0
- web/src/pages/flow/flow-drawer/index.less +3 -0
- web/src/pages/flow/flow-drawer/index.tsx +19 -6
- web/src/pages/flow/generate-form/index.tsx +2 -2
- web/src/pages/flow/relevant-form/index.tsx +2 -2
- web/src/pages/flow/rewrite-question-form/index.tsx +2 -2
web/src/locales/en.ts
CHANGED
|
@@ -567,6 +567,7 @@ The above is the content you need to summarize.`,
|
|
| 567 |
operation: 'operation',
|
| 568 |
run: 'Run',
|
| 569 |
save: 'Save',
|
|
|
|
| 570 |
beginDescription: 'This is where the flow begin',
|
| 571 |
answerDescription: `This component is used as an interface between bot and human. It receives input of user and display the result of the computation of the bot.`,
|
| 572 |
retrievalDescription: `This component is for the process of retrieving relevent information from knowledge base. So, knowledgebases should be selected. If there's nothing retrieved, the 'Empty response' will be returned.`,
|
|
|
|
| 567 |
operation: 'operation',
|
| 568 |
run: 'Run',
|
| 569 |
save: 'Save',
|
| 570 |
+
title: 'Title:',
|
| 571 |
beginDescription: 'This is where the flow begin',
|
| 572 |
answerDescription: `This component is used as an interface between bot and human. It receives input of user and display the result of the computation of the bot.`,
|
| 573 |
retrievalDescription: `This component is for the process of retrieving relevent information from knowledge base. So, knowledgebases should be selected. If there's nothing retrieved, the 'Empty response' will be returned.`,
|
web/src/locales/zh-traditional.ts
CHANGED
|
@@ -527,6 +527,7 @@ export default {
|
|
| 527 |
operation: '操作',
|
| 528 |
run: '運行',
|
| 529 |
save: '儲存',
|
|
|
|
| 530 |
beginDescription: '這是流程開始的地方',
|
| 531 |
answerDescription: `該組件用作機器人與人類之間的介面。它接收使用者的輸入並顯示機器人的計算結果。`,
|
| 532 |
retrievalDescription: `此元件用於從知識庫中檢索相關資訊。選擇知識庫。如果沒有檢索到任何內容,將傳回「空響應」。`,
|
|
|
|
| 527 |
operation: '操作',
|
| 528 |
run: '運行',
|
| 529 |
save: '儲存',
|
| 530 |
+
title: '標題:',
|
| 531 |
beginDescription: '這是流程開始的地方',
|
| 532 |
answerDescription: `該組件用作機器人與人類之間的介面。它接收使用者的輸入並顯示機器人的計算結果。`,
|
| 533 |
retrievalDescription: `此元件用於從知識庫中檢索相關資訊。選擇知識庫。如果沒有檢索到任何內容,將傳回「空響應」。`,
|
web/src/locales/zh.ts
CHANGED
|
@@ -546,6 +546,7 @@ export default {
|
|
| 546 |
operation: '操作',
|
| 547 |
run: '运行',
|
| 548 |
save: '保存',
|
|
|
|
| 549 |
beginDescription: '这是流程开始的地方',
|
| 550 |
answerDescription: `该组件用作机器人与人类之间的接口。它接收用户的输入并显示机器人的计算结果。`,
|
| 551 |
retrievalDescription: `此组件用于从知识库中检索相关信息。选择知识库。如果没有检索到任何内容,将返回“空响应”。`,
|
|
|
|
| 546 |
operation: '操作',
|
| 547 |
run: '运行',
|
| 548 |
save: '保存',
|
| 549 |
+
title: '标题:',
|
| 550 |
beginDescription: '这是流程开始的地方',
|
| 551 |
answerDescription: `该组件用作机器人与人类之间的接口。它接收用户的输入并显示机器人的计算结果。`,
|
| 552 |
retrievalDescription: `此组件用于从知识库中检索相关信息。选择知识库。如果没有检索到任何内容,将返回“空响应”。`,
|
web/src/pages/flow/flow-drawer/index.less
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.title {
|
| 2 |
+
flex-basis: 60px;
|
| 3 |
+
}
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
|
|
| 1 |
import { IModalProps } from '@/interfaces/common';
|
| 2 |
-
import { Drawer, Form, Input } from 'antd';
|
| 3 |
import { useEffect } from 'react';
|
| 4 |
import { Node } from 'reactflow';
|
| 5 |
import AnswerForm from '../answer-form';
|
|
@@ -9,10 +10,13 @@ import { Operator } from '../constant';
|
|
| 9 |
import GenerateForm from '../generate-form';
|
| 10 |
import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
|
| 11 |
import MessageForm from '../message-form';
|
|
|
|
| 12 |
import RelevantForm from '../relevant-form';
|
| 13 |
import RetrievalForm from '../retrieval-form';
|
| 14 |
import RewriteQuestionForm from '../rewrite-question-form';
|
| 15 |
|
|
|
|
|
|
|
| 16 |
interface IProps {
|
| 17 |
node?: Node;
|
| 18 |
}
|
|
@@ -40,6 +44,7 @@ const FlowDrawer = ({
|
|
| 40 |
const [form] = Form.useForm();
|
| 41 |
const { name, handleNameBlur, handleNameChange } =
|
| 42 |
useHandleNodeNameChange(node);
|
|
|
|
| 43 |
|
| 44 |
const { handleValuesChange } = useHandleFormValuesChange(node?.id);
|
| 45 |
|
|
@@ -52,11 +57,19 @@ const FlowDrawer = ({
|
|
| 52 |
return (
|
| 53 |
<Drawer
|
| 54 |
title={
|
| 55 |
-
<
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
placement="right"
|
| 62 |
onClose={hideModal}
|
|
|
|
| 1 |
+
import { useTranslate } from '@/hooks/commonHooks';
|
| 2 |
import { IModalProps } from '@/interfaces/common';
|
| 3 |
+
import { Drawer, Flex, Form, Input } from 'antd';
|
| 4 |
import { useEffect } from 'react';
|
| 5 |
import { Node } from 'reactflow';
|
| 6 |
import AnswerForm from '../answer-form';
|
|
|
|
| 10 |
import GenerateForm from '../generate-form';
|
| 11 |
import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
|
| 12 |
import MessageForm from '../message-form';
|
| 13 |
+
import OperatorIcon from '../operator-icon';
|
| 14 |
import RelevantForm from '../relevant-form';
|
| 15 |
import RetrievalForm from '../retrieval-form';
|
| 16 |
import RewriteQuestionForm from '../rewrite-question-form';
|
| 17 |
|
| 18 |
+
import styles from './index.less';
|
| 19 |
+
|
| 20 |
interface IProps {
|
| 21 |
node?: Node;
|
| 22 |
}
|
|
|
|
| 44 |
const [form] = Form.useForm();
|
| 45 |
const { name, handleNameBlur, handleNameChange } =
|
| 46 |
useHandleNodeNameChange(node);
|
| 47 |
+
const { t } = useTranslate('flow');
|
| 48 |
|
| 49 |
const { handleValuesChange } = useHandleFormValuesChange(node?.id);
|
| 50 |
|
|
|
|
| 57 |
return (
|
| 58 |
<Drawer
|
| 59 |
title={
|
| 60 |
+
<Flex gap={'middle'} align="center">
|
| 61 |
+
<OperatorIcon name={operatorName}></OperatorIcon>
|
| 62 |
+
<Flex align="center" gap={'small'} flex={1}>
|
| 63 |
+
<label htmlFor="" className={styles.title}>
|
| 64 |
+
{t('title')}
|
| 65 |
+
</label>
|
| 66 |
+
<Input
|
| 67 |
+
value={name}
|
| 68 |
+
onBlur={handleNameBlur}
|
| 69 |
+
onChange={handleNameChange}
|
| 70 |
+
></Input>
|
| 71 |
+
</Flex>
|
| 72 |
+
</Flex>
|
| 73 |
}
|
| 74 |
placement="right"
|
| 75 |
onClose={hideModal}
|
web/src/pages/flow/generate-form/index.tsx
CHANGED
|
@@ -13,8 +13,8 @@ const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|
| 13 |
return (
|
| 14 |
<Form
|
| 15 |
name="basic"
|
| 16 |
-
labelCol={{ span:
|
| 17 |
-
wrapperCol={{ span:
|
| 18 |
autoComplete="off"
|
| 19 |
form={form}
|
| 20 |
onValuesChange={onValuesChange}
|
|
|
|
| 13 |
return (
|
| 14 |
<Form
|
| 15 |
name="basic"
|
| 16 |
+
labelCol={{ span: 5 }}
|
| 17 |
+
wrapperCol={{ span: 19 }}
|
| 18 |
autoComplete="off"
|
| 19 |
form={form}
|
| 20 |
onValuesChange={onValuesChange}
|
web/src/pages/flow/relevant-form/index.tsx
CHANGED
|
@@ -23,8 +23,8 @@ const RelevantForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|
| 23 |
return (
|
| 24 |
<Form
|
| 25 |
name="basic"
|
| 26 |
-
labelCol={{ span:
|
| 27 |
-
wrapperCol={{ span:
|
| 28 |
onValuesChange={onValuesChange}
|
| 29 |
autoComplete="off"
|
| 30 |
form={form}
|
|
|
|
| 23 |
return (
|
| 24 |
<Form
|
| 25 |
name="basic"
|
| 26 |
+
labelCol={{ span: 4 }}
|
| 27 |
+
wrapperCol={{ span: 20 }}
|
| 28 |
onValuesChange={onValuesChange}
|
| 29 |
autoComplete="off"
|
| 30 |
form={form}
|
web/src/pages/flow/rewrite-question-form/index.tsx
CHANGED
|
@@ -11,8 +11,8 @@ const RewriteQuestionForm = ({ onValuesChange, form }: IOperatorForm) => {
|
|
| 11 |
return (
|
| 12 |
<Form
|
| 13 |
name="basic"
|
| 14 |
-
labelCol={{ span:
|
| 15 |
-
wrapperCol={{ span:
|
| 16 |
onValuesChange={onValuesChange}
|
| 17 |
autoComplete="off"
|
| 18 |
form={form}
|
|
|
|
| 11 |
return (
|
| 12 |
<Form
|
| 13 |
name="basic"
|
| 14 |
+
labelCol={{ span: 4 }}
|
| 15 |
+
wrapperCol={{ span: 20 }}
|
| 16 |
onValuesChange={onValuesChange}
|
| 17 |
autoComplete="off"
|
| 18 |
form={form}
|