From 29271f727886a50f1dad8068ba41ceba5cb25286 Mon Sep 17 00:00:00 2001 From: williamhliu <137068196+williamhliu@users.noreply.github.com> Date: Mon, 24 Feb 2025 08:18:48 +0800 Subject: [PATCH] (feature)(supersonic-fe) add permission manage in agent (#2095) --- webapp/packages/chat-sdk/package.json | 5 +- .../src/pages/Agent/AgentForm.tsx | 64 +- .../src/pages/Agent/PermissionSection.tsx | 92 + .../supersonic-fe/src/pages/Agent/style.less | 16 +- .../supersonic-fe/src/pages/Agent/type.ts | 6 +- webapp/pnpm-lock.yaml | 28637 +++++++++------- 6 files changed, 16013 insertions(+), 12807 deletions(-) create mode 100644 webapp/packages/supersonic-fe/src/pages/Agent/PermissionSection.tsx diff --git a/webapp/packages/chat-sdk/package.json b/webapp/packages/chat-sdk/package.json index 5e3aa14c5..6826c1610 100644 --- a/webapp/packages/chat-sdk/package.json +++ b/webapp/packages/chat-sdk/package.json @@ -209,5 +209,6 @@ }, "engines": { "node": ">=16" - } -} \ No newline at end of file + }, + "packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee" +} diff --git a/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx b/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx index 4139478c5..978582648 100644 --- a/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx +++ b/webapp/packages/supersonic-fe/src/pages/Agent/AgentForm.tsx @@ -1,6 +1,6 @@ -import { Form, Input, Button, Switch, Tabs, Select, message, Space, Tooltip, Row, Col } from 'antd'; +import { Form, Input, Button, Switch, Tabs, Select, message, Space, Tooltip } from 'antd'; import MainTitleMark from '@/components/MainTitleMark'; -import { AgentType, ChatAppConfig, ChatAppConfigItem } from './type'; +import { AgentType, ChatAppConfig } from './type'; import { useEffect, useState } from 'react'; import styles from './style.less'; import { DeleteOutlined, PlusOutlined } from '@ant-design/icons'; @@ -9,9 +9,9 @@ import ToolsSection from './ToolsSection'; import globalStyles from '@/global.less'; import { QuestionCircleOutlined } from '@ant-design/icons'; import SelectTMEPerson from '@/components/SelectTMEPerson'; -import FormItemTitle from '@/components/FormHelper/FormItemTitle'; -import { getLlmModelTypeList, getLlmModelAppList, getLlmList } from '../../services/system'; +import { getLlmModelAppList, getLlmList } from '../../services/system'; import MemorySection from './MemorySection'; +import PermissionSection from './PermissionSection'; const FormItem = Form.Item; const { TextArea } = Input; @@ -195,16 +195,6 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli - {/* - - - - - */} = ({ editAgent, onSaveAgent, onCreateToolBtnCli > - = ({ editAgent, onSaveAgent, onCreateToolBtnCli - {/* */} - {/* */}
{modelTypeOptions.map((item) => { return ( @@ -312,8 +299,6 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli ); })}
- {/* - */}
{modelTypeOptions.map((item) => { return ( @@ -358,44 +343,10 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli ); })}
- {/* */} - {/*
*/}
), }, - // { - // label: '提示词配置', - // key: 'promptConfig', - // children: ( - //
- // - // - // 提示词模板 - // - // {tips.map((tip) => ( - //
{tip}
- // ))} - // - // } - // > - // - //
- //
- // - // } - // > - // - //
- //
- // ), - // }, { label: '工具配置', key: 'tools', @@ -406,6 +357,11 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli key: 'memory', children: , }, + { + label: '权限管理', + key: 'permissonSetting', + children: , + }, ]; return ( @@ -421,7 +377,7 @@ const AgentForm: React.FC = ({ editAgent, onSaveAgent, onCreateToolBtnCli - {activeKey !== 'memory' && ( + {activeKey !== 'memory' && activeKey !== 'permissonSetting' && (