diff --git a/web/src/views/ApplicationConfig/Cluster.tsx b/web/src/views/ApplicationConfig/Cluster.tsx index 66245446..714c1c49 100644 --- a/web/src/views/ApplicationConfig/Cluster.tsx +++ b/web/src/views/ApplicationConfig/Cluster.tsx @@ -5,7 +5,7 @@ import Card from './components/Card' import { Form, Space, Row, Col, Button, Flex, App, Select } from 'antd' import Tag, { type TagProps } from './components/Tag' import CustomSelect from '@/components/CustomSelect'; -import { getMultiAgentConfig, saveMultiAgentConfig } from '@/api/application'; +import { getMultiAgentConfig, saveMultiAgentConfig, getApplicationList } from '@/api/application'; import type { Config, SubAgentModalRef, @@ -21,6 +21,7 @@ import Empty from '@/components/Empty' import RadioGroupCard from '@/components/RadioGroupCard' import { getModelListUrl } from '@/api/models' import ModelConfigModal from './components/ModelConfigModal' +import type { Application } from '@/views/ApplicationManagement/types' const tagColors = ['processing', 'warning', 'default'] @@ -91,7 +92,27 @@ const Cluster = forwardRef((_props, ref) => { form.setFieldsValue({ ...response, }) - setSubAgents(response.sub_agents || []) + let sub_agents = response.sub_agents || [] + if (sub_agents.length > 0) { + console.log({ ids: sub_agents?.map(item => item.agent_id) }) + getApplicationList({ ids: sub_agents?.map(item => item.agent_id).join(',')}) + .then(res => { + const applicationList = (res as Application[]) || [] + setSubAgents(sub_agents.map(vo => { + const filterVO = applicationList.find(item => item.id === vo.agent_id) + if (filterVO) { + return { + ...vo, + name: filterVO.name, + is_active: filterVO.is_active + } + } + return vo + })) + }) + } else { + setSubAgents(sub_agents) + } }) } const handleSubAgentModal = (agent?: SubAgentItem) => { @@ -171,7 +192,12 @@ const Cluster = forwardRef((_props, ref) => { {agent.name?.[0]}
- {agent.name} + +
{agent.name} + + {agent.is_active ? t('common.enable') : t('common.deleted')} + +
{agent.role &&
{agent.role || '-'}
} {agent.capabilities && {agent.capabilities.map((tag, tagIndex) => {tag})}}
diff --git a/web/src/views/ApplicationConfig/components/SubAgentModal.tsx b/web/src/views/ApplicationConfig/components/SubAgentModal.tsx index f797c334..db2ec93b 100644 --- a/web/src/views/ApplicationConfig/components/SubAgentModal.tsx +++ b/web/src/views/ApplicationConfig/components/SubAgentModal.tsx @@ -40,7 +40,10 @@ const SubAgentModal = forwardRef(({ const handleSave = () => { form.validateFields().then(() => { setLoading(false) - refresh(values) + refresh({ + ...values, + is_active: true + }) handleClose() }) } diff --git a/web/src/views/ApplicationConfig/types.ts b/web/src/views/ApplicationConfig/types.ts index fdf9e295..6eb97f22 100644 --- a/web/src/views/ApplicationConfig/types.ts +++ b/web/src/views/ApplicationConfig/types.ts @@ -186,6 +186,7 @@ export interface SubAgentItem { name: string; role: string; capabilities: string[]; + is_active?: boolean; } export interface SubAgentModalRef { handleOpen: (agent?: SubAgentItem) => void;