+
{options.map(option => (
-
handleChange(option)}>
- {itemRender ? itemRender(option) : (
- <>
- {option.icon &&

}
+
handleChange(option)}>
+ {itemRender ? itemRender(option) : (
+ <>
+ {option.icon &&

}
+
{option.label}
{option.labelDesc}
- >
- )}
-
- )
- )}
+
+ >
+ )}
+
+ ))}
);
};
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index 907dab09..03d68016 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -423,7 +423,9 @@ export const en = {
remove: 'Remove',
fileSizeTip: 'File size cannot exceed {{size}}MB',
- fileAcceptTip: 'Unsupported file type:'
+ fileAcceptTip: 'Unsupported file type:',
+ nextStep: 'Next Step',
+ prevStep: 'Previous Step',
},
model: {
searchPlaceholder: 'search model…',
@@ -1373,6 +1375,9 @@ export const en = {
embeddingModel: 'Embedding Model',
rerankModel: 'Rerank Model',
configAlert: 'Space model configuration ensures that the space can correctly call the corresponding models to process business data during runtime.',
+
+ basic: 'Basic Config',
+ models: 'Model Selection',
},
memoryExtractionEngine: {
title: 'Memory Engine Module Configuration Center',
@@ -2039,7 +2044,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
'code': {
input_variables: 'Input Variables',
output_variables: 'Output Variables',
- refreshTip: '同步函数签名至代码',
+ refreshTip: 'Sync function signature to code',
},
name: 'Key',
type: 'Type',
diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts
index 42438c5a..30d9481b 100644
--- a/web/src/i18n/zh.ts
+++ b/web/src/i18n/zh.ts
@@ -977,7 +977,9 @@ export const zh = {
remove: '删除',
fileSizeTip: '文件大小不能超过 {{size}}MB',
- fileAcceptTip: '不支持的文件类型:'
+ fileAcceptTip: '不支持的文件类型:',
+ nextStep: '下一步',
+ prevStep: '上一步',
},
product: {
applicationManagement: '应用管理',
@@ -1449,6 +1451,9 @@ export const zh = {
embeddingModel: 'Embedding 模型',
rerankModel: 'Rerank 模型',
configAlert: '空间模型配置为空间的模型模型,保障空间运行时能正确的调用到相应的模型来处理业务数据。',
+
+ basic: '基础配置',
+ models: '模型选择',
},
memoryExtractionEngine: {
title: '记忆引擎模块配置中心',
diff --git a/web/src/views/ApplicationConfig/components/AiPromptModal.tsx b/web/src/views/ApplicationConfig/components/AiPromptModal.tsx
index 0c7bf480..198460eb 100644
--- a/web/src/views/ApplicationConfig/components/AiPromptModal.tsx
+++ b/web/src/views/ApplicationConfig/components/AiPromptModal.tsx
@@ -8,7 +8,7 @@ import { updatePromptMessages, createPromptSessions } from '@/api/prompt'
import { getModelListUrl } from '@/api/models'
import type { AiPromptModalRef, AiPromptVariableModalRef, AiPromptForm } from '../types'
import RbModal from '@/components/RbModal'
-import type { Model } from '@/views/ModelManagement/types'
+import type { ModelListItem } from '@/views/ModelManagement/types'
import ChatContent from '@/components/Chat/ChatContent'
import Empty from '@/components/Empty'
import ChatSendIcon from '@/assets/images/application/chatSend.svg'
@@ -21,7 +21,7 @@ import Editor from './Editor'
interface AiPromptModalProps {
refresh: (value: string) => void;
- defaultModel: Model | null;
+ defaultModel: ModelListItem | null;
}
const AiPromptModal = forwardRef
(({
diff --git a/web/src/views/ApplicationConfig/components/Knowledge/KnowledgeListModal.tsx b/web/src/views/ApplicationConfig/components/Knowledge/KnowledgeListModal.tsx
index f1ebd516..13084701 100644
--- a/web/src/views/ApplicationConfig/components/Knowledge/KnowledgeListModal.tsx
+++ b/web/src/views/ApplicationConfig/components/Knowledge/KnowledgeListModal.tsx
@@ -64,7 +64,7 @@ const KnowledgeListModal = forwardRef(({
...item,
config: {
similarity_threshold: 0.7,
- strategy: "hybrid",
+ retrieve_type: "hybrid",
top_k: 3,
weight: 1,
}
diff --git a/web/src/views/ApplicationConfig/components/ModelConfigModal.tsx b/web/src/views/ApplicationConfig/components/ModelConfigModal.tsx
index 67fd654c..c3ffd83e 100644
--- a/web/src/views/ApplicationConfig/components/ModelConfigModal.tsx
+++ b/web/src/views/ApplicationConfig/components/ModelConfigModal.tsx
@@ -3,14 +3,14 @@ import { Form, Select } from 'antd';
import { useTranslation } from 'react-i18next';
import type { ModelConfig, ModelConfigModalRef, Config, Source } from '../types'
-import type { Model } from '@/views/ModelManagement/types'
+import type { ModelListItem } from '@/views/ModelManagement/types'
import RbModal from '@/components/RbModal'
import RbSlider from '@/components/RbSlider'
const FormItem = Form.Item;
interface ModelConfigModalProps {
- modelList?: Model[];
+ modelList?: ModelListItem[];
refresh: (values: ModelConfig, type: Source) => void;
data: Config;
}
@@ -76,9 +76,9 @@ const ModelConfigModal = forwardRef(
console.log('err', err)
});
}
- const handleChange = (_value: string, option: Model | Model[] | undefined) => {
+ const handleChange = (_value: string, option: ModelListItem | ModelListItem[] | undefined) => {
if (source === 'chat') {
- form.setFieldValue('label', (option as Model).name)
+ form.setFieldValue('label', (option as ModelListItem).name)
}
}
diff --git a/web/src/views/SpaceManagement/components/SpaceModal.tsx b/web/src/views/SpaceManagement/components/SpaceModal.tsx
index c02a8e9d..725db4b9 100644
--- a/web/src/views/SpaceManagement/components/SpaceModal.tsx
+++ b/web/src/views/SpaceManagement/components/SpaceModal.tsx
@@ -1,24 +1,31 @@
-import { forwardRef, useImperativeHandle, useState, useEffect } from 'react';
-import { Form, Input, App, Select } from 'antd';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+import { Form, Input, App, Steps, Button } from 'antd';
import { useTranslation } from 'react-i18next';
-import type { SpaceModalData, SpaceModalRef, Space } from '../types'
+import type { SpaceModalData, SpaceModalRef, Space, StorageType } from '../types'
import RbModal from '@/components/RbModal'
import { createWorkspace } from '@/api/workspaces'
import RadioGroupCard from '@/components/RadioGroupCard'
-import { getModelListUrl, getModelList } from '@/api/models'
+import { getModelListUrl } from '@/api/models'
import CustomSelect from '@/components/CustomSelect'
-import type { ModelListItem } from '@/views/ModelManagement/types'
+import UploadImages from '@/components/Upload/UploadImages'
+import { getFileLink } from '@/api/fileStorage'
+import ragIcon from '@/assets/images/space/rag.png'
+import neo4jIcon from '@/assets/images/space/neo4j.png'
const FormItem = Form.Item;
interface SpaceModalProps {
refresh: () => void;
}
-const types = [
+const types: StorageType[] = [
'rag',
'neo4j',
]
+const typeIcons: Record = {
+ rag: ragIcon,
+ neo4j: neo4jIcon
+}
const SpaceModal = forwardRef(({
refresh
@@ -29,7 +36,7 @@ const SpaceModal = forwardRef(({
const [form] = Form.useForm();
const [loading, setLoading] = useState(false)
const [editVo, setEditVo] = useState(null)
- const [modelList, setModelList] = useState([])
+ const [currentStep, setCurrentStep] = useState(0)
const values = Form.useWatch([], form);
@@ -39,7 +46,11 @@ const SpaceModal = forwardRef(({
form.resetFields();
setLoading(false)
setEditVo(null)
+ setCurrentStep(0)
};
+ const handlePrevStep = () => {
+ setCurrentStep(prev => prev - 1)
+ }
const handleOpen = (space?: Space) => {
if (space) {
@@ -58,33 +69,41 @@ const SpaceModal = forwardRef(({
form
.validateFields()
.then(() => {
- setLoading(true)
- createWorkspace(values as SpaceModalData)
- .then(() => {
- setLoading(false)
- refresh()
- handleClose()
- message.success(t('common.createSuccess'))
- })
- .catch(() => {
- setLoading(false)
- });
+ if (currentStep === 0) {
+ setCurrentStep(1)
+ } else {
+ const { icon, ...rest } = values
+ let formData: SpaceModalData = {
+ ...rest
+ }
+ if (icon?.response?.data.file_id) {
+ getFileLink(icon?.response?.data.file_id).then(res => {
+ const logoRes = res as { url: string }
+ formData.icon = logoRes.url
+ formData.iconType = 'remote'
+ handleUpdate(formData)
+ }).catch(() => {
+ handleUpdate(formData)
+ })
+ }
+ }
})
.catch((err) => {
console.log('err', err)
});
}
-
- useEffect(() => {
- getModels()
- }, [])
-
- const getModels = () => {
- getModelList({ type: 'llm,chat', pagesize: 100, page: 1, is_active: true })
- .then(res => {
- const response = res as { items: ModelListItem[] }
- setModelList(response.items)
+ const handleUpdate = (formData: SpaceModalData) => {
+ setLoading(true)
+ createWorkspace(formData)
+ .then(() => {
+ setLoading(false)
+ refresh()
+ handleClose()
+ message.success(t('common.createSuccess'))
})
+ .catch(() => {
+ setLoading(false)
+ });
}
// 暴露给父组件的方法
@@ -98,78 +117,104 @@ const SpaceModal = forwardRef(({
title={t(`space.${editVo?.id ? 'editSpace' : 'createSpace'}`)}
open={visible}
onCancel={handleClose}
- okText={t('common.save')}
onOk={handleSave}
+ footer={[
+ ,
+ ,
+ ]}
confirmLoading={loading}
>
+ ({ title: t(`space.${key}`) } ))}
+ className="rb:mb-6!"
+ />
+
+
-
+
-
-
-
-
-
-
-
-
-
-
({
value: type,
label: t(`space.${type}`),
labelDesc: t(`space.${type}Desc`),
- // icon: typeIcons[type]
+ icon: typeIcons[type]
}))}
+ block={true}
/>
+
+
+ {currentStep === 1 && <>
+
+
+
+
+
+
+
+
+
+ >}
);
diff --git a/web/src/views/SpaceManagement/index.tsx b/web/src/views/SpaceManagement/index.tsx
index 451520ff..af67757f 100644
--- a/web/src/views/SpaceManagement/index.tsx
+++ b/web/src/views/SpaceManagement/index.tsx
@@ -50,7 +50,7 @@ const SpaceManagement: React.FC = () => {
}
return (
<>
-