mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 22:25:19 +00:00
[improvement][Chat] Support agent permission management (#1923)
* [improvement][Chat] Support agent permission management #1143 * [improvement][chat]Iterate LLM prompts of parsing and correction. * [improvement][headless-fe] Added null-check conditions to the data formatting function. * [improvement][headless]Clean code logic of headless translator. --------- Co-authored-by: lxwcodemonkey <jolunoluo@tencent.com> Co-authored-by: tristanliu <tristanliu@tencent.com>
This commit is contained in:
@@ -3,6 +3,9 @@ import { NumericUnit } from '../common/constants';
|
||||
import { isString } from 'lodash';
|
||||
|
||||
export function formatByDecimalPlaces(value: number | string, decimalPlaces: number) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return 0;
|
||||
}
|
||||
if (isNaN(+value) || decimalPlaces < 0 || decimalPlaces > 100) {
|
||||
return value;
|
||||
}
|
||||
@@ -17,6 +20,9 @@ export function formatByDecimalPlaces(value: number | string, decimalPlaces: num
|
||||
}
|
||||
|
||||
export function formatByThousandSeperator(value: number | string) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return 0;
|
||||
}
|
||||
if (isNaN(+value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -7,3 +7,12 @@
|
||||
.userText {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.selectPerson {
|
||||
:global {
|
||||
.ant-select-selection-item {
|
||||
color: rgba(0, 0, 0, 0.88)!important;
|
||||
background-color: rgba(0, 0, 0, 0.06)!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ const SelectTMEPerson: FC<Props> = ({ placeholder, value, isMultiple = true, onC
|
||||
mode={isMultiple ? 'multiple' : undefined}
|
||||
allowClear
|
||||
showSearch
|
||||
className={styles.selectPerson}
|
||||
onChange={onChange}
|
||||
>
|
||||
{userList.map((item) => {
|
||||
|
||||
@@ -8,6 +8,8 @@ import { uuid, jsonParse } from '@/utils/utils';
|
||||
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 MemorySection from './MemorySection';
|
||||
|
||||
@@ -223,7 +225,16 @@ const AgentForm: React.FC<Props> = ({ editAgent, onSaveAgent, onCreateToolBtnCli
|
||||
>
|
||||
<Switch />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
name="admins"
|
||||
label="管理员"
|
||||
// rules={[{ required: true, message: '请设定数据库连接管理者' }]}
|
||||
>
|
||||
<SelectTMEPerson placeholder="请邀请团队成员" />
|
||||
</FormItem>
|
||||
<FormItem tooltip="选择用户后,该助理只对所选用户可见" name="viewers" label="使用者">
|
||||
<SelectTMEPerson placeholder="请邀请团队成员" />
|
||||
</FormItem>
|
||||
<FormItem name="examples" label="示例问题">
|
||||
<div className={styles.paramsSection}>
|
||||
{examples.map((example) => {
|
||||
|
||||
@@ -207,26 +207,26 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
// width: 200,
|
||||
render: (_: any, record: FieldItem) => {
|
||||
const { type } = record;
|
||||
if (type === EnumDataSourceType.PRIMARY) {
|
||||
return (
|
||||
<Space>
|
||||
<Select
|
||||
style={{ minWidth: 150 }}
|
||||
value={tagObjectId ? tagObjectId : undefined}
|
||||
placeholder="请选择所属对象"
|
||||
onChange={(value) => {
|
||||
onTagObjectChange?.(value);
|
||||
}}
|
||||
options={tagObjectList.map((item: ISemantic.ITagObjectItem) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
})}
|
||||
/>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
// if (type === EnumDataSourceType.PRIMARY) {
|
||||
// return (
|
||||
// <Space>
|
||||
// <Select
|
||||
// style={{ minWidth: 150 }}
|
||||
// value={tagObjectId ? tagObjectId : undefined}
|
||||
// placeholder="请选择所属对象"
|
||||
// onChange={(value) => {
|
||||
// onTagObjectChange?.(value);
|
||||
// }}
|
||||
// options={tagObjectList.map((item: ISemantic.ITagObjectItem) => {
|
||||
// return {
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// };
|
||||
// })}
|
||||
// />
|
||||
// </Space>
|
||||
// );
|
||||
// }
|
||||
if (type === EnumDataSourceType.MEASURES) {
|
||||
return (
|
||||
<Select
|
||||
|
||||
Reference in New Issue
Block a user