Browse Source

Merge pull request '合并dev-zw' (#288) from dev-zw into dev-opt

dev-opt
cp3hnu 8 months ago
parent
commit
c9e85e2bbb
15 changed files with 116 additions and 23 deletions
  1. +1
    -1
      .gitignore
  2. +8
    -0
      react-ui/config/config.ts
  3. +12
    -0
      react-ui/config/routes.ts
  4. +14
    -8
      react-ui/src/app.tsx
  5. +8
    -1
      react-ui/src/components/PageContainer/index.less
  6. +10
    -3
      react-ui/src/components/PageContainer/index.tsx
  7. +1
    -0
      react-ui/src/enums/index.ts
  8. +1
    -1
      react-ui/src/global.less
  9. +9
    -0
      react-ui/src/pages/Coze/index.tsx
  10. +9
    -3
      react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx
  11. +5
    -0
      react-ui/src/pages/Dataset/config.tsx
  12. +6
    -5
      react-ui/src/pages/Message/components/Content/index.tsx
  13. +1
    -1
      react-ui/src/pages/System/Approval/index.tsx
  14. +16
    -0
      react-ui/src/services/dataset/index.js
  15. +15
    -0
      react-ui/src/utils/downloadfile.ts

+ 1
- 1
.gitignore View File

@@ -65,4 +65,4 @@ mvnw
/react-ui/types/tsconfig.tsbuildinfo /react-ui/types/tsconfig.tsbuildinfo
/react-ui/storybook-static /react-ui/storybook-static
/react-ui/.storybook/scripts /react-ui/.storybook/scripts
/react-ui/dist.zip
/react-ui/@alita/*

+ 8
- 0
react-ui/config/config.ts View File

@@ -164,6 +164,14 @@ export default defineConfig({
master: { master: {
sandbox: true, sandbox: true,
apps: [ apps: [
{
name: 'flint-data',
entry: 'http://36.103.199.74:30009',
},
{
name: 'flint-bml',
entry: 'http://localhost:8082',
},
{ {
name: 'app1', name: 'app1',
entry: '//localhost:7001', entry: '//localhost:7001',


+ 12
- 0
react-ui/config/routes.ts View File

@@ -607,6 +607,18 @@ export default [
}, },
], ],
}, },
{
name: 'coze',
path: '/coze',
routes: [
{
name: '智能体编排',
path: '',
key: 'coze',
component: './Coze/index',
},
],
},
{ {
name: 'mixed', name: 'mixed',
path: '/mixed', path: '/mixed',


+ 14
- 8
react-ui/src/app.tsx View File

@@ -23,6 +23,7 @@ import {
} from './services/session'; } from './services/session';
import './styles/menu.less'; import './styles/menu.less';
import { isLoginPage, needAuth } from './utils'; import { isLoginPage, needAuth } from './utils';
import { addAlpha } from './utils/color';
import { HomeUrl } from './utils/constant'; import { HomeUrl } from './utils/constant';
import { closeAllModals } from './utils/modal'; import { closeAllModals } from './utils/modal';
import { gotoHomePage } from './utils/ui'; import { gotoHomePage } from './utils/ui';
@@ -208,14 +209,14 @@ export const antd: RuntimeAntdConfig = (memo) => {
memo.theme.components ??= {}; memo.theme.components ??= {};
memo.theme.components.Tabs = {}; memo.theme.components.Tabs = {};
memo.theme.components.Button = { memo.theme.components.Button = {
defaultBg: 'rgba(22, 100, 255, 0.06)',
defaultBorderColor: 'rgba(22, 100, 255, 0.11)',
defaultBg: addAlpha(themes['primaryColor'], 0.06),
defaultBorderColor: addAlpha(themes['primaryColor'], 0.11),
defaultColor: themes['textColor'], defaultColor: themes['textColor'],
defaultHoverBg: 'rgba(22, 100, 255, 0.06)',
defaultHoverBorderColor: 'rgba(22, 100, 255, 0.5)',
defaultHoverColor: '#3F7FFF',
defaultActiveBg: 'rgba(22, 100, 255, 0.12)',
defaultActiveBorderColor: 'rgba(22, 100, 255, 0.75)',
defaultHoverBg: addAlpha(themes['primaryColor'], 0.06),
defaultHoverBorderColor: addAlpha(themes['primaryColor'], 0.5),
defaultHoverColor: themes['primaryHoverColor'],
defaultActiveBg: addAlpha(themes['primaryColor'], 0.12),
defaultActiveBorderColor: addAlpha(themes['primaryColor'], 0.75),
defaultActiveColor: themes['primaryColor'], defaultActiveColor: themes['primaryColor'],
contentFontSize: parseInt(themes['fontSize']), contentFontSize: parseInt(themes['fontSize']),
}; };
@@ -245,7 +246,12 @@ export const antd: RuntimeAntdConfig = (memo) => {
separatorColor: 'rgba(29, 29, 32, 0.7)', separatorColor: 'rgba(29, 29, 32, 0.7)',
}; };
memo.theme.components.Tree = { memo.theme.components.Tree = {
directoryNodeSelectedBg: 'rgba(22, 100, 255, 0.7)',
directoryNodeSelectedBg: addAlpha(themes['primaryColor'], 0.7),
};
memo.theme.components.Breadcrumb = {
itemColor: themes['textColorSecondary'],
separatorColor: themes['textColorSecondary'],
linkColor: themes['textColorSecondary'],
}; };


memo.theme.cssVar = true; memo.theme.cssVar = true;


+ 8
- 1
react-ui/src/components/PageContainer/index.less View File

@@ -1,14 +1,21 @@
.kf-page-container { .kf-page-container {
display: flex;
flex-direction: column;
width: 100%;
height: 100%; height: 100%;


&__breadcrumb { &__breadcrumb {
display: flex; display: flex;
flex: none;
align-items: center; align-items: center;
width: 100%;
height: 70px; height: 70px;
padding-left: 30px; padding-left: 30px;
} }


&__content { &__content {
height: calc(100% - 70px);
flex: 1;
width: 100%;
min-height: 0;
} }
} }

+ 10
- 3
react-ui/src/components/PageContainer/index.tsx View File

@@ -1,13 +1,20 @@
import { RightOutlined } from '@ant-design/icons';
import { ProBreadcrumb } from '@ant-design/pro-components'; import { ProBreadcrumb } from '@ant-design/pro-components';
import React from 'react'; import React from 'react';
import './index.less'; import './index.less';


function PageContainer({ children }: { children: React.ReactNode }) { function PageContainer({ children }: { children: React.ReactNode }) {
const { pathname } = location;
const showBreadcrumb = pathname.split('/').filter((v) => v !== '').length >= 2;

return ( return (
<div className="kf-page-container"> <div className="kf-page-container">
<div className="kf-page-container__breadcrumb">
<ProBreadcrumb></ProBreadcrumb>
</div>
{showBreadcrumb && (
<div className="kf-page-container__breadcrumb">
<ProBreadcrumb separator={<RightOutlined style={{ fontSize: 14 }} />}></ProBreadcrumb>
</div>
)}

<div className="kf-page-container__content">{children}</div> <div className="kf-page-container__content">{children}</div>
</div> </div>
); );


+ 1
- 0
react-ui/src/enums/index.ts View File

@@ -174,6 +174,7 @@ export enum ComponentType {


// 消息类型 // 消息类型
export enum MessageType { export enum MessageType {
All = -1,
System = 1, System = 1,
Mine = 2, Mine = 2,
} }


+ 1
- 1
react-ui/src/global.less View File

@@ -72,7 +72,7 @@ body {
background-color: #fff; background-color: #fff;
} }
.ant-pro-global-header-logo img { .ant-pro-global-header-logo img {
height: 21px;
height: 32px;
} }
.ant-pro-layout .ant-layout-sider.ant-pro-sider { .ant-pro-layout .ant-layout-sider.ant-pro-sider {
height: 100vh; height: 100vh;


+ 9
- 0
react-ui/src/pages/Coze/index.tsx View File

@@ -0,0 +1,9 @@
import IframePage from '@/components/IFramePage';

function Coze() {
return (
<IframePage url="http://36.103.199.102:18010/space/7542403354794655744/develop"></IframePage>
);
}

export default Coze;

+ 9
- 3
react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx View File

@@ -11,7 +11,8 @@ import {
ResourceType, ResourceType,
resourceConfig, resourceConfig,
} from '@/pages/Dataset/config'; } from '@/pages/Dataset/config';
import { downLoadZip } from '@/utils/downloadfile';
import { downLoadZip, downloadFileWithUrl } from '@/utils/downloadfile';
import { to } from '@/utils/promise';
import tableCellRender, { TableCellValueType } from '@/utils/table'; import tableCellRender, { TableCellValueType } from '@/utils/table';
import { Button, Flex, Table, TableProps } from 'antd'; import { Button, Flex, Table, TableProps } from 'antd';
import styles from './index.less'; import styles from './index.less';
@@ -41,8 +42,13 @@ function ResourceVersion({ resourceType, info }: ResourceVersionProps) {


// 单个导出 // 单个导出
const downloadAlone = async (record: ResourceFileData) => { const downloadAlone = async (record: ResourceFileData) => {
const url = config.downloadSingleAction;
downLoadZip(url, { url: record.url });
const request = config.getFileUrl;
const [res] = await to(request({ url: record.url }));
if (res && res.data) {
const url = res.data;
downloadFileWithUrl(url, record.file_name);
}
// downLoadZip(url, { url: record.url });
}; };


const columns: TableProps<ResourceFileData>['columns'] = [ const columns: TableProps<ResourceFileData>['columns'] = [


+ 5
- 0
react-ui/src/pages/Dataset/config.tsx View File

@@ -11,10 +11,12 @@ import {
deleteModelVersion, deleteModelVersion,
editDatasetVersion, editDatasetVersion,
editModelVersion, editModelVersion,
getDatasetFileUrlReq,
getDatasetInfo, getDatasetInfo,
getDatasetList, getDatasetList,
getDatasetNextVersionReq, getDatasetNextVersionReq,
getDatasetVersionList, getDatasetVersionList,
getModelFileUrlReq,
getModelInfo, getModelInfo,
getModelList, getModelList,
getModelNextVersionReq, getModelNextVersionReq,
@@ -48,6 +50,7 @@ type ResourceTypeInfo = {
compareVersion: (params: any) => Promise<any>; // 版本对比 compareVersion: (params: any) => Promise<any>; // 版本对比
getNextVersion: (params: any) => Promise<any>; // 获取下一个版本 getNextVersion: (params: any) => Promise<any>; // 获取下一个版本
publish: (params: any) => Promise<any>; // 发布 publish: (params: any) => Promise<any>; // 发布
getFileUrl: (params: any) => Promise<any>; // 获取文件地址
name: string; // 名称 name: string; // 名称
typeParamKey: 'data_type' | 'model_type'; // 类型参数名称,获取资源列表接口使用 typeParamKey: 'data_type' | 'model_type'; // 类型参数名称,获取资源列表接口使用
tagParamKey: 'data_tag' | 'model_tag'; // 标签参数名称,获取资源列表接口使用 tagParamKey: 'data_tag' | 'model_tag'; // 标签参数名称,获取资源列表接口使用
@@ -80,6 +83,7 @@ export const resourceConfig: Record<ResourceType, ResourceTypeInfo> = {
compareVersion: compareDatasetVersion, compareVersion: compareDatasetVersion,
getNextVersion: getDatasetNextVersionReq, getNextVersion: getDatasetNextVersionReq,
publish: publishDatasetReq, publish: publishDatasetReq,
getFileUrl: getDatasetFileUrlReq,
name: '数据集', name: '数据集',
typeParamKey: 'data_type', typeParamKey: 'data_type',
tagParamKey: 'data_tag', tagParamKey: 'data_tag',
@@ -121,6 +125,7 @@ export const resourceConfig: Record<ResourceType, ResourceTypeInfo> = {
compareVersion: compareModelVersion, compareVersion: compareModelVersion,
getNextVersion: getModelNextVersionReq, getNextVersion: getModelNextVersionReq,
publish: publishModelReq, publish: publishModelReq,
getFileUrl: getModelFileUrlReq,
name: '模型', name: '模型',
typeParamKey: 'model_type', typeParamKey: 'model_type',
tagParamKey: 'model_tag', tagParamKey: 'model_tag',


+ 6
- 5
react-ui/src/pages/Message/components/Content/index.tsx View File

@@ -113,11 +113,11 @@ function MessageContent({
}; };
const [res] = await to(readMessagesReq(params, skipLoading)); const [res] = await to(readMessagesReq(params, skipLoading));


// 点击消息置为已读时,不需要修改数据
// 点击消息置为已读时,不需要修改数据
if (!skipResult && res) { if (!skipResult && res) {
// 如果当前是【未读】状态
// 如果当前是【未读】状态 tab
// 【一键已读】后,设置分页为第一页 // 【一键已读】后,设置分页为第一页
// 如果是一页的唯一数据,设置为前一页
// 单个标记为已读,如果是一页的唯一数据,设置为前一页
if (messageStatus === MessageStatus.UnRead) { if (messageStatus === MessageStatus.UnRead) {
onPaginationChange({ onPaginationChange({
...pagination, ...pagination,
@@ -127,9 +127,10 @@ function MessageContent({
: pagination.current : pagination.current
: 1, : 1,
}); });
} else {
// 如果当前是【全部】 tab,直接刷新数据
getMessages();
} }
} else {
getMessages();
} }
}; };




+ 1
- 1
react-ui/src/pages/System/Approval/index.tsx View File

@@ -62,7 +62,7 @@ function ApprovalList() {
// 获取审核列表 // 获取审核列表
const getApprovalList = useCallback(async () => { const getApprovalList = useCallback(async () => {
const params: Record<string, any> = { const params: Record<string, any> = {
current: pagination.current,
pageNum: pagination.current,
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
status: status, status: status,
}; };


+ 16
- 0
react-ui/src/services/dataset/index.js View File

@@ -106,6 +106,14 @@ export function publishDatasetReq(data) {
}); });
} }


// 获取数据集版本单个文件下载地址
export function getDatasetFileUrlReq(params) {
return request(`/api/mmp/newdataset/downloadSingleFile`, {
method: 'GET',
params,
});
}



// ----------------------------模型--------------------------------- // ----------------------------模型---------------------------------


@@ -253,4 +261,12 @@ export function publishModelReq(data) {
}); });
} }


// 获取模型版本单个文件下载地址
export function getModelFileUrlReq(params) {
return request(`/api/mmp/newmodel/downloadSingleFile`, {
method: 'GET',
params,
});
}




+ 15
- 0
react-ui/src/utils/downloadfile.ts View File

@@ -97,3 +97,18 @@ export function downloadCommonFile(
resolveBlob(res, type, fileName); resolveBlob(res, type, fileName);
}); });
} }

/**
* 下载链接文件
* @param url - url 地址
* @param fileName - 文件名
*/
export function downloadFileWithUrl(url: string, fileName: string) {
const aLink = document.createElement('a');
aLink.style.display = 'none';
aLink.href = url;
aLink.setAttribute('download', fileName); // 设置下载文件名称
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink);
}

Loading…
Cancel
Save