From fbe411477560615ad10018dd172d493d31a6a688 Mon Sep 17 00:00:00 2001 From: williamhliu <137068196+williamhliu@users.noreply.github.com> Date: Sat, 29 Jun 2024 19:55:35 +0800 Subject: [PATCH] (feature)(supersonic-fe) add memory manage (#1287) --- .../src/pages/Agent/AgentForm.tsx | 2 +- .../src/pages/Agent/MemorySection.tsx | 135 ++++++++++++++---- .../supersonic-fe/src/pages/Agent/service.ts | 8 +- .../supersonic-fe/src/pages/Agent/style.less | 32 ++++- .../src/pages/ChatPlugin/style.less | 1 - 5 files changed, 147 insertions(+), 31 deletions(-) diff --git a/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx b/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx index 1f529456a..10e6e5ae8 100644 --- a/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx +++ b/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx @@ -277,7 +277,7 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli { label: '记忆管理', key: 'memory', - children: , + children: , }, ]; diff --git a/webapp/packages/supersonic-fe/src/pages/Agent/MemorySection.tsx b/webapp/packages/supersonic-fe/src/pages/Agent/MemorySection.tsx index a9379ecae..e1f543b30 100644 --- a/webapp/packages/supersonic-fe/src/pages/Agent/MemorySection.tsx +++ b/webapp/packages/supersonic-fe/src/pages/Agent/MemorySection.tsx @@ -3,16 +3,22 @@ import { EditableProTable } from '@ant-design/pro-components'; import React, { useState } from 'react'; import { MemoryType, ReviewEnum, StatusEnum } from './type'; import { getMemeoryList, saveMemory } from './service'; -import { Popover, Input, Badge, Radio } from 'antd'; +import { Popover, Input, Badge, Radio, Select } from 'antd'; import styles from './style.less'; -const { TextArea } = Input; +const { TextArea, Search } = Input; const RadioGroup = Radio.Group; -const MemorySection = () => { +type Props = { + agentId: number; +}; + +const MemorySection = ({ agentId }: Props) => { const [editableKeys, setEditableRowKeys] = useState([]); const [dataSource, setDataSource] = useState([]); const [loading, setLoading] = useState(false); + const [filters, setFilters] = useState({}); + const { question, status, llmReviewRet, humanReviewRet } = filters; const columns: ProColumns[] = [ { @@ -23,7 +29,7 @@ const MemorySection = () => { { title: 'Schema映射', dataIndex: 'dbSchema', - width: 300, + width: 220, valueType: 'textarea', renderFormItem: (_, { record }) => (