(fix)(supersonic-fe) fix add agent error

This commit is contained in:
williamhliu
2024-06-30 09:39:52 +08:00
parent 2b2ce7fa53
commit 1885bea3b8
2 changed files with 9 additions and 2 deletions

View File

@@ -277,7 +277,7 @@ const AgentForm: React.FC<Props> = ({ editAgent, onSaveAgent, onCreateToolBtnCli
{ {
label: '记忆管理', label: '记忆管理',
key: 'memory', key: 'memory',
children: <MemorySection agentId={editAgent!.id!} />, children: <MemorySection agentId={editAgent?.id} />,
}, },
]; ];

View File

@@ -10,7 +10,7 @@ const { TextArea, Search } = Input;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
type Props = { type Props = {
agentId: number; agentId?: number;
}; };
const MemorySection = ({ agentId }: Props) => { const MemorySection = ({ agentId }: Props) => {
@@ -166,6 +166,13 @@ const MemorySection = ({ agentId }: Props) => {
filtersValue, filtersValue,
current, current,
}: { filtersValue?: any; current?: number } = {}) => { }: { filtersValue?: any; current?: number } = {}) => {
if (!agentId) {
return {
data: [],
total: 0,
success: true,
};
}
setLoading(true); setLoading(true);
const res = await getMemeoryList(agentId, filtersValue || filters, current || 1); const res = await getMemeoryList(agentId, filtersValue || filters, current || 1);
setLoading(false); setLoading(false);