mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-24 10:27:28 +08:00
Merge fixes and improvements (#1910)
Co-authored-by: tristanliu <tristanliu@tencent.com>
This commit is contained in:
@@ -18,6 +18,7 @@ export default defineConfig({
|
||||
API_BASE_URL: '/api/semantic/', // 直接在define中挂载裸露的全局变量还需要配置eslint,ts相关配置才能导致在使用中不会飘红,冗余较高,这里挂在进程环境下
|
||||
CHAT_API_BASE_URL: '/api/chat/',
|
||||
AUTH_API_BASE_URL: '/api/auth/',
|
||||
SHOW_TAG: false,
|
||||
...ENV_CONFIG,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -115,12 +115,12 @@ const ROUTES = [
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
path: '/tag',
|
||||
name: 'tag',
|
||||
component: './SemanticModel/Insights',
|
||||
envEnableList: [ENV_KEY.SEMANTIC],
|
||||
hideInMenu: process.env.SHOW_TAG ? false : true,
|
||||
routes: [
|
||||
{
|
||||
path: '/tag',
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
"@umijs/route-utils": "2.2.2",
|
||||
"ace-builds": "^1.4.12",
|
||||
"ahooks": "^3.7.7",
|
||||
"antd": "5.11.2",
|
||||
"antd": "^5.17.4",
|
||||
"classnames": "^2.2.6",
|
||||
"compression-webpack-plugin": "^11.0.0",
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
|
||||
@@ -38,6 +38,7 @@ const BatchCtrlDropDownButton: FC<BatchCtrlDropDownButtonProps> = ({
|
||||
exportTagButton: {
|
||||
key: 'exportTagButton',
|
||||
label: '导出为标签',
|
||||
hidden: !!!process.env.SHOW_TAG,
|
||||
icon: <ExportOutlined />,
|
||||
disabled: disabledList?.includes('exportTagButton'),
|
||||
},
|
||||
@@ -142,9 +143,11 @@ const BatchCtrlDropDownButton: FC<BatchCtrlDropDownButtonProps> = ({
|
||||
icon: <DeleteOutlined />,
|
||||
disabled: disabledList?.includes('batchDelete'),
|
||||
},
|
||||
].filter((item) => {
|
||||
return !hiddenList.includes(item.key);
|
||||
});
|
||||
]
|
||||
.filter((item) => {
|
||||
return !hiddenList.includes(item.key);
|
||||
})
|
||||
.filter((item) => !!!item.hidden);
|
||||
|
||||
const popoverConfig = {
|
||||
title: '选择下载区间',
|
||||
|
||||
@@ -217,7 +217,11 @@ const MemorySection = ({ agentId }: Props) => {
|
||||
};
|
||||
|
||||
const loadMemoryList = async (
|
||||
{ filtersValue, current }: { filtersValue?: any; current?: number } = {},
|
||||
{
|
||||
filtersValue,
|
||||
current,
|
||||
pageSize,
|
||||
}: { filtersValue?: any; current?: number; pageSize?: number } = {},
|
||||
sort?: any,
|
||||
) => {
|
||||
if (!agentId) {
|
||||
@@ -249,10 +253,11 @@ const MemorySection = ({ agentId }: Props) => {
|
||||
agentId,
|
||||
chatMemoryFilter: filtersValue || filters,
|
||||
current: current || 1,
|
||||
pageSize,
|
||||
...sortParams,
|
||||
});
|
||||
setLoading(false);
|
||||
const { list, total, pageSize, pageNum } = res.data;
|
||||
const { list, total, pageNum } = res.data;
|
||||
setDataSource(list);
|
||||
setPagination({
|
||||
pageSize,
|
||||
|
||||
@@ -35,15 +35,20 @@ export function getMetricList(modelId: number) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMemeoryList(data: { agentId: number; chatMemoryFilter: any; current: number }) {
|
||||
const { agentId, chatMemoryFilter, current } = data;
|
||||
export function getMemeoryList(data: {
|
||||
agentId: number;
|
||||
chatMemoryFilter: any;
|
||||
current: number;
|
||||
pageSize: number;
|
||||
}) {
|
||||
const { agentId, chatMemoryFilter, current, pageSize } = data;
|
||||
return request<Result<{ list: MetricType[] }>>('/api/chat/memory/pageMemories', {
|
||||
method: 'POST',
|
||||
data: {
|
||||
...data,
|
||||
chatMemoryFilter: { agentId, ...chatMemoryFilter },
|
||||
current,
|
||||
pageSize: 10,
|
||||
pageSize: pageSize || 10,
|
||||
sort: 'desc',
|
||||
// orderCondition: 'updatedAt',
|
||||
},
|
||||
|
||||
@@ -190,14 +190,14 @@ const ModelBasicForm: React.FC<Props> = ({
|
||||
<FormItem name="description" label="模型描述">
|
||||
<TextArea placeholder="请输入模型描述" />
|
||||
</FormItem>
|
||||
<FormItem name={['ext', 'usId']} label="调度任务ID">
|
||||
{/* <FormItem name={['ext', 'usId']} label="调度任务ID">
|
||||
<Select
|
||||
mode="tags"
|
||||
placeholder="输入ID后回车确认,多ID输入、复制粘贴支持英文逗号自动分隔"
|
||||
tokenSeparators={[',']}
|
||||
maxTagCount={9}
|
||||
/>
|
||||
</FormItem>
|
||||
</FormItem> */}
|
||||
</Spin>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -229,7 +229,9 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
);
|
||||
}
|
||||
if (type === EnumDataSourceType.MEASURES) {
|
||||
const agg = fields.find((field) => field.expr === record.expr)?.agg;
|
||||
const agg = record.expr
|
||||
? fields.find((field) => field.expr === record.expr)?.agg
|
||||
: undefined;
|
||||
return (
|
||||
<Select
|
||||
placeholder="度量算子"
|
||||
@@ -249,26 +251,52 @@ const ModelFieldForm: React.FC<Props> = ({
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
if (type === EnumDataSourceType.CATEGORICAL) {
|
||||
const isTag = fields.find((field) => field.bizName === record.bizName)?.isTag;
|
||||
return (
|
||||
<Space>
|
||||
|
||||
if (process.env.SHOW_TAG) {
|
||||
if (type === EnumDataSourceType.CATEGORICAL) {
|
||||
const isTag = fields.find((field) => field.bizName === record.bizName)?.isTag;
|
||||
return (
|
||||
<Space>
|
||||
<span>设为标签:</span>
|
||||
<Switch
|
||||
defaultChecked
|
||||
size="small"
|
||||
checked={!!isTag}
|
||||
onChange={(value) => {
|
||||
handleFieldChange(record, 'isTag', value);
|
||||
}}
|
||||
/>
|
||||
<Tooltip title="如果勾选,代表维度的取值都是一种“标签”,可用作对实体的圈选">
|
||||
<ExclamationCircleOutlined />
|
||||
</Tooltip>
|
||||
<Space>
|
||||
<span>设为标签:</span>
|
||||
<Switch
|
||||
defaultChecked
|
||||
size="small"
|
||||
checked={!!isTag}
|
||||
onChange={(value) => {
|
||||
handleFieldChange(record, 'isTag', value);
|
||||
}}
|
||||
/>
|
||||
<Tooltip title="如果勾选,代表维度的取值都是一种“标签”,可用作对实体的圈选">
|
||||
<ExclamationCircleOutlined />
|
||||
</Tooltip>
|
||||
</Space>
|
||||
</Space>
|
||||
</Space>
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
if (process.env.SHOW_TAG) {
|
||||
if (type === EnumDataSourceType.CATEGORICAL) {
|
||||
const isTag = fields.find((field) => field.bizName === record.bizName)?.isTag;
|
||||
return (
|
||||
<Space>
|
||||
<Space>
|
||||
<span>设为标签:</span>
|
||||
<Switch
|
||||
defaultChecked
|
||||
size="small"
|
||||
checked={!!isTag}
|
||||
onChange={(value) => {
|
||||
handleFieldChange(record, 'isTag', value);
|
||||
}}
|
||||
/>
|
||||
<Tooltip title="如果勾选,代表维度的取值都是一种“标签”,可用作对实体的圈选">
|
||||
<ExclamationCircleOutlined />
|
||||
</Tooltip>
|
||||
</Space>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
}
|
||||
if ([EnumDataSourceType.TIME, EnumDataSourceType.PARTITION_TIME].includes(type)) {
|
||||
const dateFormat = fields.find((field) => field.bizName === record.bizName)?.dateFormat;
|
||||
|
||||
@@ -33,14 +33,14 @@ export const modelDataClass = {
|
||||
};
|
||||
|
||||
export const DIM_OPTIONS = [
|
||||
{
|
||||
label: '主键',
|
||||
value: EnumDataSourceType.PRIMARY_KEY,
|
||||
},
|
||||
{
|
||||
label: '外键',
|
||||
value: EnumDataSourceType.FOREIGN_KEY,
|
||||
},
|
||||
// {
|
||||
// label: '主键',
|
||||
// value: EnumDataSourceType.PRIMARY_KEY,
|
||||
// },
|
||||
// {
|
||||
// label: '外键',
|
||||
// value: EnumDataSourceType.FOREIGN_KEY,
|
||||
// },
|
||||
{
|
||||
label: '枚举',
|
||||
value: EnumDataSourceType.CATEGORICAL,
|
||||
|
||||
@@ -78,6 +78,9 @@ const TagInfoCreateForm: React.FC<CreateFormProps> = ({
|
||||
const backward = () => setCurrentStep(currentStep - 1);
|
||||
|
||||
const queryModelDetail = async (modelId) => {
|
||||
if (!modelId) {
|
||||
return;
|
||||
}
|
||||
const { code, data } = await getModelDetail({ modelId });
|
||||
if (code === 200) {
|
||||
if (Array.isArray(data?.modelDetail?.fields)) {
|
||||
|
||||
@@ -728,6 +728,7 @@ const MetricInfoCreateForm: React.FC<CreateFormProps> = ({
|
||||
<FormItem
|
||||
name="isTag"
|
||||
valuePropName="checked"
|
||||
hidden={!!!process.env.SHOW_TAG}
|
||||
getValueFromEvent={(value) => {
|
||||
return value === true ? 1 : 0;
|
||||
}}
|
||||
@@ -749,8 +750,9 @@ const MetricInfoCreateForm: React.FC<CreateFormProps> = ({
|
||||
<Switch />
|
||||
</Col>
|
||||
</Row>
|
||||
<Divider />
|
||||
</FormItem>
|
||||
<Divider />
|
||||
|
||||
<FormItem>
|
||||
<Row gutter={20}>
|
||||
<Col flex="1 1 200px">
|
||||
|
||||
@@ -48,6 +48,9 @@ const ModelRelationFormDrawer: React.FC<ModelRelationFormDrawerProps> = ({
|
||||
}, [relationData]);
|
||||
|
||||
const queryModelDetail = async (modelId: number, isSource: boolean) => {
|
||||
if (!modelId) {
|
||||
return;
|
||||
}
|
||||
const { code, data } = await getModelDetail({ modelId });
|
||||
if (code === 200) {
|
||||
if (Array.isArray(data?.modelDetail?.identifiers)) {
|
||||
|
||||
@@ -172,6 +172,7 @@ const ClassDimensionTable: React.FC<Props> = ({}) => {
|
||||
dataIndex: 'isTag',
|
||||
title: '是否标签',
|
||||
// width: 90,
|
||||
hideInTable: !!!process.env.SHOW_TAG,
|
||||
render: (isTag) => {
|
||||
switch (isTag) {
|
||||
case 0:
|
||||
@@ -324,66 +325,69 @@ const ClassDimensionTable: React.FC<Props> = ({}) => {
|
||||
headerTitle={
|
||||
<div style={{ marginLeft: 15 }}>
|
||||
<TableHeaderFilter
|
||||
components={[
|
||||
{
|
||||
label: '维度搜索',
|
||||
component: (
|
||||
<Input.Search
|
||||
style={{ width: 280 }}
|
||||
placeholder="请输入ID/维度名称/英文名称"
|
||||
onSearch={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
key: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '敏感度',
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 140 }}
|
||||
options={SENSITIVE_LEVEL_OPTIONS}
|
||||
placeholder="请选择敏感度"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
sensitiveLevel: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '是否为标签',
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 145 }}
|
||||
placeholder="请选择标签状态"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
isTag: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
options={[
|
||||
{ value: 1, label: '是' },
|
||||
{ value: 0, label: '否' },
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
components={
|
||||
[
|
||||
{
|
||||
label: '维度搜索',
|
||||
component: (
|
||||
<Input.Search
|
||||
style={{ width: 280 }}
|
||||
placeholder="请输入ID/维度名称/英文名称"
|
||||
onSearch={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
key: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '敏感度',
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 140 }}
|
||||
options={SENSITIVE_LEVEL_OPTIONS}
|
||||
placeholder="请选择敏感度"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
sensitiveLevel: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '是否为标签',
|
||||
hidden: !!!process.env.SHOW_TAG,
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 145 }}
|
||||
placeholder="请选择标签状态"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
isTag: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
options={[
|
||||
{ value: 1, label: '是' },
|
||||
{ value: 0, label: '否' },
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
].filter((item) => !!!item.hidden) as any
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ const ClassMetricTable: React.FC<Props> = ({ onEmptyMetricData }) => {
|
||||
{
|
||||
dataIndex: 'isTag',
|
||||
title: '是否标签',
|
||||
// width: 90,
|
||||
hideInTable: !!!process.env.SHOW_TAG,
|
||||
render: (isTag) => {
|
||||
switch (isTag) {
|
||||
case 0:
|
||||
@@ -353,66 +353,69 @@ const ClassMetricTable: React.FC<Props> = ({ onEmptyMetricData }) => {
|
||||
headerTitle={
|
||||
<div style={{ marginLeft: 15 }}>
|
||||
<TableHeaderFilter
|
||||
components={[
|
||||
{
|
||||
label: '指标搜索',
|
||||
component: (
|
||||
<Input.Search
|
||||
style={{ width: 280 }}
|
||||
placeholder="请输入ID/指标名称/英文名称/标签"
|
||||
onSearch={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
key: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '敏感度',
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 140 }}
|
||||
options={SENSITIVE_LEVEL_OPTIONS}
|
||||
placeholder="请选择敏感度"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
sensitiveLevel: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '是否为标签',
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 145 }}
|
||||
placeholder="请选择标签状态"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
isTag: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
options={[
|
||||
{ value: 1, label: '是' },
|
||||
{ value: 0, label: '否' },
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
components={
|
||||
[
|
||||
{
|
||||
label: '指标搜索',
|
||||
component: (
|
||||
<Input.Search
|
||||
style={{ width: 280 }}
|
||||
placeholder="请输入ID/指标名称/英文名称"
|
||||
onSearch={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
key: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '敏感度',
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 140 }}
|
||||
options={SENSITIVE_LEVEL_OPTIONS}
|
||||
placeholder="请选择敏感度"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
sensitiveLevel: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '是否为标签',
|
||||
hidden: !!!process.env.SHOW_TAG,
|
||||
component: (
|
||||
<Select
|
||||
style={{ width: 145 }}
|
||||
placeholder="请选择标签状态"
|
||||
allowClear
|
||||
onChange={(value) => {
|
||||
setFilterParams((preState) => {
|
||||
return {
|
||||
...preState,
|
||||
isTag: value,
|
||||
};
|
||||
});
|
||||
}}
|
||||
options={[
|
||||
{ value: 1, label: '是' },
|
||||
{ value: 0, label: '否' },
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
].filter((item) => !!!item.hidden) as any
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -305,6 +305,7 @@ const DimensionInfoModal: React.FC<CreateFormProps> = ({
|
||||
<InfoTagList />
|
||||
</FormItem> */}
|
||||
<Form.Item
|
||||
hidden={!!!process.env.SHOW_TAG}
|
||||
label={
|
||||
<FormItemTitle
|
||||
title={`设为标签`}
|
||||
|
||||
@@ -73,7 +73,7 @@ const DomainManagerTab: React.FC<Props> = ({
|
||||
{
|
||||
label: '标签对象管理',
|
||||
key: 'tagObjectManage',
|
||||
hidden: !!domainData?.parentId,
|
||||
hidden: !!!process.env.SHOW_TAG ? true : !!domainData?.parentId,
|
||||
children: <TagObjectTable />,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ const DimensionMetricVisibleTableTransfer: React.FC<Props> = ({
|
||||
{
|
||||
dataIndex: 'isTag',
|
||||
title: '是否标签',
|
||||
// hidden: true,
|
||||
hidden: true,
|
||||
render: (isTag) => {
|
||||
if (isTag) {
|
||||
return <span style={{ color: '#0958d9' }}>是</span>;
|
||||
|
||||
@@ -213,7 +213,7 @@ const DimensionValueSettingForm: React.FC<Props> = ({
|
||||
>
|
||||
{dimensionVisible && (
|
||||
<Space size={20} style={{ marginBottom: 20 }}>
|
||||
<Tooltip title={`立即将${KnowledgeConfigTypeWordingMap[type]}值导入字典`}>
|
||||
<Tooltip title={`维度值可见后将定期启动导入任务,如果想立即启动可手动触发`}>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
|
||||
@@ -713,6 +713,7 @@ const MetricInfoCreateForm: React.FC<CreateFormProps> = ({
|
||||
</FormItem>
|
||||
|
||||
<Form.Item
|
||||
hidden={!!!process.env.SHOW_TAG}
|
||||
label={
|
||||
<FormItemTitle
|
||||
title={`设为标签`}
|
||||
|
||||
@@ -452,6 +452,9 @@ export function getUnAvailableItem(data: any): Promise<any> {
|
||||
}
|
||||
|
||||
export function getModelDetail(data: any): Promise<any> {
|
||||
if (!data.modelId) {
|
||||
return;
|
||||
}
|
||||
return request.get(`${process.env.API_BASE_URL}model/getModel/${data.modelId}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user