mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-05-02 22:24:21 +08:00
Refactor translator module (#1932)
* [improvement][Chat] Support agent permission management #1143 * [improvement][chat]Iterate LLM prompts of parsing and correction. * [improvement][headless]Clean code logic of headless core. * (fix) (chat) 记忆管理更新不生效 (#1912) * [improvement][headless-fe] Added null-check conditions to the data formatting function. * [improvement][headless]Clean code logic of headless translator. * [improvement][headless-fe] Added permissions management for agents. * [improvement][headless-fe] Unified the assistant's permission settings interaction to match the system style. * [improvement](Dict)Support returns dict task list of dimensions by page * [improvement][headless-fe] Revised the interaction for semantic modeling routing and implemented the initial version of metric management switching. * [improvement][launcher]Set system property `s2.test` in junit tests in order to facilitate conditional breakpoints. * [improvement][headless] add validateAndQuery interface in SqlQueryApiController * [improvement][launcher]Use API to get element ID avoiding hard-code. * [improvement][launcher]Support DuckDB database and refactor translator code structure. --------- Co-authored-by: lxwcodemonkey <jolunoluo@tencent.com> Co-authored-by: tristanliu <tristanliu@tencent.com> Co-authored-by: daikon12 <1059907724@qq.com> Co-authored-by: lexluo09 <39718951+lexluo09@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,89 @@
|
||||
import React from 'react';
|
||||
import { message } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { history, useParams, useModel, Outlet } from '@umijs/max';
|
||||
import DomainListTree from './components/DomainList';
|
||||
import styles from './components/style.less';
|
||||
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
||||
import { ISemantic } from './data';
|
||||
import { getDomainList, getDataSetList, getModelDetail } from './service';
|
||||
import PageBreadcrumb from './PageBreadcrumb';
|
||||
|
||||
const classManager: React.FC = ({ children }) => {
|
||||
return <div>{children}</div>;
|
||||
type Props = {};
|
||||
|
||||
const SemanticModel: React.FC<Props> = ({}) => {
|
||||
const params: any = useParams();
|
||||
const domainId = params.domainId;
|
||||
const modelId = params.modelId;
|
||||
const domainModel = useModel('SemanticModel.domainData');
|
||||
const modelModel = useModel('SemanticModel.modelData');
|
||||
const databaseModel = useModel('SemanticModel.databaseData');
|
||||
const metricModel = useModel('SemanticModel.metricData');
|
||||
const { setSelectDomain, setDomainList, selectDomainId } = domainModel;
|
||||
const { selectModel, setSelectModel, setModelTableHistoryParams, MrefreshModelList } = modelModel;
|
||||
const { MrefreshDatabaseList } = databaseModel;
|
||||
|
||||
const { selectMetric, setSelectMetric } = metricModel;
|
||||
|
||||
const initSelectedDomain = (domainList: ISemantic.IDomainItem[]) => {
|
||||
const targetNode = domainList.filter((item: any) => {
|
||||
return `${item.id}` === domainId;
|
||||
})[0];
|
||||
if (!targetNode) {
|
||||
const firstRootNode = domainList.filter((item: any) => {
|
||||
return item.parentId === 0;
|
||||
})[0];
|
||||
if (firstRootNode) {
|
||||
const { id } = firstRootNode;
|
||||
setSelectDomain(firstRootNode);
|
||||
// pushUrlMenu(id, menuKey);
|
||||
}
|
||||
} else {
|
||||
setSelectDomain(targetNode);
|
||||
}
|
||||
};
|
||||
|
||||
const initProjectTree = async () => {
|
||||
const { code, data, msg } = await getDomainList();
|
||||
if (code === 200) {
|
||||
initSelectedDomain(data);
|
||||
setDomainList(data);
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
};
|
||||
|
||||
const initModelData = async () => {
|
||||
const { code, data, msg } = await getModelDetail({ modelId });
|
||||
if (code === 200) {
|
||||
setSelectModel(data);
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
initProjectTree();
|
||||
MrefreshDatabaseList();
|
||||
if (modelId && modelId !== selectModel) {
|
||||
initModelData();
|
||||
}
|
||||
|
||||
return () => {
|
||||
setSelectDomain(undefined);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ background: '#fff' }}>
|
||||
<PageBreadcrumb />
|
||||
</div>
|
||||
<div>
|
||||
<Outlet />
|
||||
{/* <OverviewContainer /> */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default classManager;
|
||||
export default SemanticModel;
|
||||
|
||||
Reference in New Issue
Block a user