balibabu
commited on
Commit
·
d944812
1
Parent(s):
f9d77f2
feat: add graph tab to header #918 (#1374)
Browse files### What problem does this PR solve?
feat: add graph tab to header #918
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/hooks/flow-hooks.ts +1 -1
- web/src/layouts/components/header/index.tsx +2 -0
- web/src/locales/en.ts +1 -0
- web/src/pages/flow/categorize-form/index.tsx +2 -2
- web/src/pages/flow/constant.tsx +30 -6
- web/src/pages/flow/generate-form/index.tsx +2 -2
- web/src/pages/flow/relevant-form/index.tsx +2 -4
- web/src/pages/flow/rewrite-question-form/index.tsx +7 -3
web/src/hooks/flow-hooks.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const EmptyDsl = {
|
|
| 11 |
graph: {
|
| 12 |
nodes: [
|
| 13 |
{
|
| 14 |
-
id: '
|
| 15 |
type: 'beginNode',
|
| 16 |
position: {
|
| 17 |
x: 50,
|
|
|
|
| 11 |
graph: {
|
| 12 |
nodes: [
|
| 13 |
{
|
| 14 |
+
id: 'begin',
|
| 15 |
type: 'beginNode',
|
| 16 |
position: {
|
| 17 |
x: 50,
|
web/src/layouts/components/header/index.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { useLocation } from 'umi';
|
|
| 9 |
import Toolbar from '../right-toolbar';
|
| 10 |
|
| 11 |
import { useFetchAppConf } from '@/hooks/logicHooks';
|
|
|
|
| 12 |
import styles from './index.less';
|
| 13 |
|
| 14 |
const { Header } = Layout;
|
|
@@ -26,6 +27,7 @@ const RagHeader = () => {
|
|
| 26 |
() => [
|
| 27 |
{ path: '/knowledge', name: t('knowledgeBase'), icon: KnowledgeBaseIcon },
|
| 28 |
{ path: '/chat', name: t('chat'), icon: StarIon },
|
|
|
|
| 29 |
{ path: '/file', name: t('fileManager'), icon: FileIcon },
|
| 30 |
],
|
| 31 |
[t],
|
|
|
|
| 9 |
import Toolbar from '../right-toolbar';
|
| 10 |
|
| 11 |
import { useFetchAppConf } from '@/hooks/logicHooks';
|
| 12 |
+
import { NodeIndexOutlined } from '@ant-design/icons';
|
| 13 |
import styles from './index.less';
|
| 14 |
|
| 15 |
const { Header } = Layout;
|
|
|
|
| 27 |
() => [
|
| 28 |
{ path: '/knowledge', name: t('knowledgeBase'), icon: KnowledgeBaseIcon },
|
| 29 |
{ path: '/chat', name: t('chat'), icon: StarIon },
|
| 30 |
+
{ path: '/flow', name: t('flow'), icon: NodeIndexOutlined },
|
| 31 |
{ path: '/file', name: t('fileManager'), icon: FileIcon },
|
| 32 |
],
|
| 33 |
[t],
|
web/src/locales/en.ts
CHANGED
|
@@ -57,6 +57,7 @@ export default {
|
|
| 57 |
setting: '用户设置',
|
| 58 |
logout: '登出',
|
| 59 |
fileManager: 'File Management',
|
|
|
|
| 60 |
},
|
| 61 |
knowledgeList: {
|
| 62 |
welcome: 'Welcome back',
|
|
|
|
| 57 |
setting: '用户设置',
|
| 58 |
logout: '登出',
|
| 59 |
fileManager: 'File Management',
|
| 60 |
+
flow: 'Graph',
|
| 61 |
},
|
| 62 |
knowledgeList: {
|
| 63 |
welcome: 'Welcome back',
|
web/src/pages/flow/categorize-form/index.tsx
CHANGED
|
@@ -18,8 +18,8 @@ const CategorizeForm = ({ form, onValuesChange, node }: IOperatorForm) => {
|
|
| 18 |
return (
|
| 19 |
<Form
|
| 20 |
name="basic"
|
| 21 |
-
labelCol={{ span:
|
| 22 |
-
wrapperCol={{ span:
|
| 23 |
autoComplete="off"
|
| 24 |
form={form}
|
| 25 |
onValuesChange={handleValuesChange}
|
|
|
|
| 18 |
return (
|
| 19 |
<Form
|
| 20 |
name="basic"
|
| 21 |
+
labelCol={{ span: 6 }}
|
| 22 |
+
wrapperCol={{ span: 18 }}
|
| 23 |
autoComplete="off"
|
| 24 |
form={form}
|
| 25 |
onValuesChange={handleValuesChange}
|
web/src/pages/flow/constant.tsx
CHANGED
|
@@ -126,27 +126,51 @@ export const initialBeginValues = {
|
|
| 126 |
prologue: `Hi! I'm your assistant, what can I do for you?`,
|
| 127 |
};
|
| 128 |
|
| 129 |
-
|
| 130 |
-
// parameters: ModelVariableType.Precise,
|
| 131 |
-
// temperatureEnabled: true,
|
| 132 |
temperature: 0.1,
|
| 133 |
top_p: 0.3,
|
| 134 |
frequency_penalty: 0.7,
|
| 135 |
presence_penalty: 0.4,
|
| 136 |
-
max_tokens:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
prompt: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
|
| 138 |
{cluster_content}
|
| 139 |
The above is the content you need to summarize.`,
|
| 140 |
cite: true,
|
| 141 |
};
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
export const initialFormValuesMap = {
|
| 144 |
[Operator.Begin]: initialBeginValues,
|
| 145 |
[Operator.Retrieval]: initialRetrievalValues,
|
| 146 |
[Operator.Generate]: initialGenerateValues,
|
| 147 |
[Operator.Answer]: {},
|
| 148 |
-
[Operator.Categorize]:
|
| 149 |
-
[Operator.Relevant]:
|
|
|
|
|
|
|
| 150 |
};
|
| 151 |
|
| 152 |
export const CategorizeAnchorPointPositions = [
|
|
|
|
| 126 |
prologue: `Hi! I'm your assistant, what can I do for you?`,
|
| 127 |
};
|
| 128 |
|
| 129 |
+
const initialLlmBaseValues = {
|
|
|
|
|
|
|
| 130 |
temperature: 0.1,
|
| 131 |
top_p: 0.3,
|
| 132 |
frequency_penalty: 0.7,
|
| 133 |
presence_penalty: 0.4,
|
| 134 |
+
max_tokens: 256,
|
| 135 |
+
};
|
| 136 |
+
|
| 137 |
+
export const initialGenerateValues = {
|
| 138 |
+
// parameters: ModelVariableType.Precise,
|
| 139 |
+
// temperatureEnabled: true,
|
| 140 |
+
...initialLlmBaseValues,
|
| 141 |
prompt: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
|
| 142 |
{cluster_content}
|
| 143 |
The above is the content you need to summarize.`,
|
| 144 |
cite: true,
|
| 145 |
};
|
| 146 |
|
| 147 |
+
export const initialRewriteQuestionValues = {
|
| 148 |
+
...initialLlmBaseValues,
|
| 149 |
+
loop: 1,
|
| 150 |
+
};
|
| 151 |
+
|
| 152 |
+
export const initialRelevantValues = {
|
| 153 |
+
...initialLlmBaseValues,
|
| 154 |
+
};
|
| 155 |
+
|
| 156 |
+
export const initialCategorizeValues = {
|
| 157 |
+
...initialLlmBaseValues,
|
| 158 |
+
category_description: {},
|
| 159 |
+
};
|
| 160 |
+
|
| 161 |
+
export const initialMessageValues = {
|
| 162 |
+
messages: [],
|
| 163 |
+
};
|
| 164 |
+
|
| 165 |
export const initialFormValuesMap = {
|
| 166 |
[Operator.Begin]: initialBeginValues,
|
| 167 |
[Operator.Retrieval]: initialRetrievalValues,
|
| 168 |
[Operator.Generate]: initialGenerateValues,
|
| 169 |
[Operator.Answer]: {},
|
| 170 |
+
[Operator.Categorize]: initialCategorizeValues,
|
| 171 |
+
[Operator.Relevant]: initialRelevantValues,
|
| 172 |
+
[Operator.RewriteQuestion]: initialRewriteQuestionValues,
|
| 173 |
+
[Operator.Message]: initialMessageValues,
|
| 174 |
};
|
| 175 |
|
| 176 |
export const CategorizeAnchorPointPositions = [
|
web/src/pages/flow/generate-form/index.tsx
CHANGED
|
@@ -13,8 +13,8 @@ const GenerateForm = ({ onValuesChange, form }: 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: 6 }}
|
| 17 |
+
wrapperCol={{ span: 18 }}
|
| 18 |
autoComplete="off"
|
| 19 |
form={form}
|
| 20 |
onValuesChange={onValuesChange}
|
web/src/pages/flow/relevant-form/index.tsx
CHANGED
|
@@ -23,10 +23,8 @@ const RelevantForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|
| 23 |
return (
|
| 24 |
<Form
|
| 25 |
name="basic"
|
| 26 |
-
labelCol={{ span:
|
| 27 |
-
wrapperCol={{ span:
|
| 28 |
-
style={{ maxWidth: 600 }}
|
| 29 |
-
initialValues={{ remember: true }}
|
| 30 |
onValuesChange={onValuesChange}
|
| 31 |
autoComplete="off"
|
| 32 |
form={form}
|
|
|
|
| 23 |
return (
|
| 24 |
<Form
|
| 25 |
name="basic"
|
| 26 |
+
labelCol={{ span: 6 }}
|
| 27 |
+
wrapperCol={{ span: 18 }}
|
|
|
|
|
|
|
| 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}
|
|
@@ -24,7 +24,11 @@ const RewriteQuestionForm = ({ onValuesChange, form }: IOperatorForm) => {
|
|
| 24 |
>
|
| 25 |
<LLMSelect></LLMSelect>
|
| 26 |
</Form.Item>
|
| 27 |
-
<Form.Item
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
<InputNumber />
|
| 29 |
</Form.Item>
|
| 30 |
</Form>
|
|
|
|
| 11 |
return (
|
| 12 |
<Form
|
| 13 |
name="basic"
|
| 14 |
+
labelCol={{ span: 6 }}
|
| 15 |
+
wrapperCol={{ span: 18 }}
|
| 16 |
onValuesChange={onValuesChange}
|
| 17 |
autoComplete="off"
|
| 18 |
form={form}
|
|
|
|
| 24 |
>
|
| 25 |
<LLMSelect></LLMSelect>
|
| 26 |
</Form.Item>
|
| 27 |
+
<Form.Item
|
| 28 |
+
label={t('loop', { keyPrefix: 'flow' })}
|
| 29 |
+
name="loop"
|
| 30 |
+
initialValue={1}
|
| 31 |
+
>
|
| 32 |
<InputNumber />
|
| 33 |
</Form.Item>
|
| 34 |
</Form>
|