mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-19 21:14:25 +08:00
(feature)(chat-sdk) add unit (#2067)
This commit is contained in:
@@ -209,5 +209,6 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
RangeValue,
|
||||
SimilarQuestionType,
|
||||
} from '../../common/type';
|
||||
import { createContext, useEffect, useRef, useState } from 'react';
|
||||
import { createContext, useEffect, useState } from 'react';
|
||||
import { chatExecute, chatParse, queryData, deleteQuery, switchEntity } from '../../service';
|
||||
import { PARSE_ERROR_TIP, PREFIX_CLS, SEARCH_EXCEPTION_TIP } from '../../common/constants';
|
||||
import { message, Spin } from 'antd';
|
||||
@@ -490,9 +490,7 @@ const ChatItem: React.FC<Props> = ({
|
||||
onSwitchEntity={onSwitchEntity}
|
||||
onFiltersChange={onFiltersChange}
|
||||
onDateInfoChange={onDateInfoChange}
|
||||
onRefresh={() => {
|
||||
onRefresh();
|
||||
}}
|
||||
onRefresh={onRefresh}
|
||||
handlePresetClick={handlePresetClick}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -40,6 +40,12 @@ const BarChart: React.FC<Props> = ({
|
||||
}) => {
|
||||
const chartRef = useRef<any>();
|
||||
const instanceRef = useRef<ECharts>();
|
||||
const { downloadChartAsImage } = useExportByEcharts({
|
||||
instanceRef,
|
||||
question,
|
||||
});
|
||||
|
||||
const { register } = useContext(ChartItemContext);
|
||||
|
||||
const { queryColumns, queryResults, entityInfo } = data;
|
||||
|
||||
@@ -189,13 +195,6 @@ const BarChart: React.FC<Props> = ({
|
||||
|
||||
const prefixCls = `${PREFIX_CLS}-bar`;
|
||||
|
||||
const { downloadChartAsImage } = useExportByEcharts({
|
||||
instanceRef,
|
||||
question,
|
||||
});
|
||||
|
||||
const { register } = useContext(ChartItemContext);
|
||||
|
||||
register('downloadChartAsImage', downloadChartAsImage);
|
||||
|
||||
return (
|
||||
|
||||
@@ -93,7 +93,9 @@ export const getFormattedValue = (value: number | string, remainZero?: boolean)
|
||||
|
||||
export const formatNumberWithCN = (num: number) => {
|
||||
if (isNaN(num)) return '-';
|
||||
if (num >= 10000) {
|
||||
if (num >= 100000000) {
|
||||
return (num / 100000000).toFixed(1) + '亿';
|
||||
} else if (num >= 10000) {
|
||||
return (num / 10000).toFixed(1) + '万';
|
||||
} else {
|
||||
return formatByDecimalPlaces(num, 2);
|
||||
|
||||
@@ -4,5 +4,9 @@ export default {
|
||||
target: 'http://127.0.0.1:9080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/aibi/api/': {
|
||||
target: 'http://127.0.0.1:9080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ISemantic } from '../../data';
|
||||
import { ColumnsConfig } from '../../components/TableColumnRender';
|
||||
import ViewSearchFormModal from './ViewSearchFormModal';
|
||||
import { toDatasetEditPage } from '@/pages/SemanticModel/utils';
|
||||
import UploadFile from './UploadFile';
|
||||
|
||||
type Props = {
|
||||
// dataSetList: ISemantic.IDatasetItem[];
|
||||
@@ -92,9 +93,6 @@ const DataSetTable: React.FC<Props> = ({ disabledEdit = false }) => {
|
||||
<a
|
||||
onClick={() => {
|
||||
toDatasetEditPage(record.domainId, record.id, 'relation');
|
||||
// setEditFormStep(1);
|
||||
// setViewItem(record);
|
||||
// setCreateDataSourceModalOpen(true);
|
||||
}}
|
||||
>
|
||||
{name}
|
||||
@@ -146,9 +144,6 @@ const DataSetTable: React.FC<Props> = ({ disabledEdit = false }) => {
|
||||
key="metricEditBtn"
|
||||
onClick={() => {
|
||||
toDatasetEditPage(record.domainId, record.id);
|
||||
// setEditFormStep(0);
|
||||
// setViewItem(record);
|
||||
// setCreateDataSourceModalOpen(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
@@ -189,6 +184,12 @@ const DataSetTable: React.FC<Props> = ({ disabledEdit = false }) => {
|
||||
启用
|
||||
</Button>
|
||||
)}
|
||||
<UploadFile
|
||||
key="uploadFile"
|
||||
buttonType="link"
|
||||
domainId={record.domainId}
|
||||
datasetId={record.id}
|
||||
/>
|
||||
<Popconfirm
|
||||
title="确认删除?"
|
||||
okText="是"
|
||||
@@ -229,6 +230,13 @@ const DataSetTable: React.FC<Props> = ({ disabledEdit = false }) => {
|
||||
disabledEdit
|
||||
? [<></>]
|
||||
: [
|
||||
<UploadFile
|
||||
key="uploadFile"
|
||||
domainId={selectDomainId}
|
||||
onFileUploaded={() => {
|
||||
queryDataSetList();
|
||||
}}
|
||||
/>,
|
||||
<Button
|
||||
key="create"
|
||||
type="primary"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { getToken } from '@/utils/utils';
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import type { UploadProps } from 'antd';
|
||||
import { Button, message, Upload } from 'antd';
|
||||
|
||||
type Props = {
|
||||
buttonType?: string;
|
||||
domainId?: number;
|
||||
datasetId?: string;
|
||||
onFileUploaded?: () => void;
|
||||
};
|
||||
|
||||
const UploadFile = ({ buttonType, domainId, datasetId, onFileUploaded }: Props) => {
|
||||
const props: UploadProps = {
|
||||
name: 'multipartFile',
|
||||
action: `/aibi/api/data/file/uploadFileNew?type=DATASET&domainId=${domainId}${
|
||||
datasetId ? `&dataSetId=${datasetId}` : ''
|
||||
}`,
|
||||
showUploadList: false,
|
||||
onChange(info) {
|
||||
if (info.file.status !== 'uploading') {
|
||||
console.log(info.file, info.fileList);
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
message.success('导入成功');
|
||||
onFileUploaded?.();
|
||||
} else if (info.file.status === 'error') {
|
||||
message.error('导入失败');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<Upload {...props}>
|
||||
{buttonType === 'link' ? (
|
||||
<a>导入文件</a>
|
||||
) : (
|
||||
<Button icon={<UploadOutlined />}>导入文件</Button>
|
||||
)}
|
||||
</Upload>
|
||||
);
|
||||
};
|
||||
|
||||
export default UploadFile;
|
||||
28637
webapp/pnpm-lock.yaml
generated
28637
webapp/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user