diff --git a/webapp/packages/chat-sdk/src/Chat/type.ts b/webapp/packages/chat-sdk/src/Chat/type.ts index 5eb6b8ff7..5e23050e0 100644 --- a/webapp/packages/chat-sdk/src/Chat/type.ts +++ b/webapp/packages/chat-sdk/src/Chat/type.ts @@ -90,13 +90,27 @@ export type AgentType = { updatedAt: string; enableSearch: number; agentConfig: string; - llmConfig: { - provider: string; - baseUrl: string; - apiKey: string; - modelName: string; - temperature: number; - timeOut: number; + modelConfig: { + chatModel: { + provider: string; + baseUrl: string; + apiKey: string; + modelName: string; + temperature: number; + timeOut: number; + }; + embeddingModel: { + apiKey: string; + baseUrl: string; + // logRequests: true, + // logResponses: true, + // maxRetries: number, + // maxToken: number, + modelName: string; + modelPath: string; + provider: string; + vocabularyPath: string; + }; }; multiTurnConfig: { enableMultiTurn: boolean; diff --git a/webapp/packages/supersonic-fe/src/components/MainTitleMark/index.tsx b/webapp/packages/supersonic-fe/src/components/MainTitleMark/index.tsx new file mode 100644 index 000000000..866059f77 --- /dev/null +++ b/webapp/packages/supersonic-fe/src/components/MainTitleMark/index.tsx @@ -0,0 +1,15 @@ +import styles from './style.less'; + +type Props = {}; + +const MainTitleMark: React.FC = ({}) => { + return ( +
+ + + +
+ ); +}; + +export default MainTitleMark; diff --git a/webapp/packages/supersonic-fe/src/components/MainTitleMark/style.less b/webapp/packages/supersonic-fe/src/components/MainTitleMark/style.less new file mode 100644 index 000000000..7c34779d5 --- /dev/null +++ b/webapp/packages/supersonic-fe/src/components/MainTitleMark/style.less @@ -0,0 +1,25 @@ +.mainTitleMark { + margin-right: 24px; + margin-left: 8px; + + .mark { + display: inline-block; + width: 4px; + height: 11px; + background: var(--tme-primary-color); + border-radius: 4px; + transform: rotate(15deg); + + &:not(:last-of-type) { + margin-right: 4px; + } + + &:nth-of-type(2) { + opacity: 0.6; + } + + &:nth-of-type(3) { + opacity: 0.2; + } + } +} diff --git a/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx b/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx index a093f2200..a2906ef85 100644 --- a/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx +++ b/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx @@ -12,6 +12,7 @@ import { message, Space, } from 'antd'; +import MainTitleMark from '@/components/MainTitleMark'; import { AgentType } from './type'; import { useEffect, useState } from 'react'; import styles from './style.less'; @@ -43,10 +44,19 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli const [llmTestLoading, setLlmTestLoading] = useState(false); const [formData, setFormData] = useState({ enableSearch: true, - llmConfig: { + modelConfig: { + chatModel: { + timeOut: 60, + provider: 'OPEN_AI', + temperature: 0, + }, + embeddingModel: { + provider: 'OPEN_AI', + }, + }, + embeddingStore: { + provider: 'MILVUS', timeOut: 60, - provider: 'OPEN_AI', - temperature: 0, }, agentConfig: { ...defaultAgentConfig, @@ -57,8 +67,8 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli useEffect(() => { if (editAgent) { const sourceData = { ...editAgent }; - if (!sourceData.llmConfig) { - delete sourceData.llmConfig; + if (!sourceData.modelConfig) { + delete sourceData.modelConfig; } const config = jsonParse(editAgent.agentConfig, {}); @@ -217,10 +227,15 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli }, { label: '大模型配置', - key: 'llmConfig', + key: 'modelConfig', children: (
- +
+ + 语言模型 + +
+ - - + + - + - + = ({ editAgent, onSaveAgent, onCreateToolBtnCli }} /> - + + +
+ + 向量模型 + +
+ + + + + + + + {formData?.modelConfig?.embeddingModel?.provider === 'IN_MEMORY' ? ( + <> + + + + + + + + ) : ( + <> + + + + { + const value = event.target.value; + return encryptPassword(value); + }} + getValueProps={(value) => { + return { + value: value ? decryptPassword(value) : '', + }; + }} + > + + + + )} +
+ ), + }, + { + label: '向量库配置', + key: 'embeddingStore', + children: ( +
+ + + + {formData?.embeddingStore?.provider === 'IN_MEMORY' ? ( + <> + + + + + ) : ( + <> + + + + { + const value = event.target.value; + return encryptPassword(value); + }} + getValueProps={(value) => { + return { + value: value ? decryptPassword(value) : '', + }; + }} + > + + + + + + + )} +
+ ), + }, + { + label: '提示词配置', + key: 'promptConfig', + children: ( +
+ + +
), }, @@ -332,12 +474,12 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli 新增工具 )} - {activeKey === 'llmConfig' && ( + {activeKey === 'modelConfig' && (