From e0046d1a4cb6210971da5b4b33a3b00a638bf782 Mon Sep 17 00:00:00 2001 From: Maaaax Date: Mon, 3 Mar 2025 16:40:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=9A=E5=88=86?= =?UTF-8?q?=E4=BD=8D=E5=8A=9F=E8=83=BD;=E6=89=93=E5=8C=85=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E4=BF=AE=E5=A4=8D=EF=BC=9B=E5=A2=9E=E5=8A=A0=E5=AD=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scalar/front/src/api/lossApi.ts | 4 +- .../front/src/components/LossShow/Chart.tsx | 29 +++++++- .../src/components/LossShow/FileTreeList.tsx | 4 +- .../src/components/LossShow/Smoothing.tsx | 70 +++++++++++++++---- .../Scalar/front/src/entity/lossShow.ts | 38 +++++++--- .../Scalar/front/src/i18n/lossShow/en.json | 4 +- .../Scalar/front/src/i18n/lossShow/zh.json | 4 +- .../Scalar/front/updata-index.js | 2 +- 8 files changed, 125 insertions(+), 30 deletions(-) diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/api/lossApi.ts b/plugins/mindstudio-insight-plugins/Scalar/front/src/api/lossApi.ts index 478a45b614..c00c836581 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/api/lossApi.ts +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/api/lossApi.ts @@ -62,7 +62,9 @@ export interface SmoothingChart { type: 'smoothing'; enable: boolean; algorithm: string; - weight: number; + weight?: number; + windowSize?:number; + top?:number } export interface DateItem { step: number; diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx index 3546012b73..adf670e646 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx @@ -470,16 +470,18 @@ export const DataChart = observer(({ lossShowInfo, tag, isExpand }: const tagIndex = line.key.indexOf(':'); const tag = line.key.slice(0, tagIndex); const filePath = line.key.slice(tagIndex + 1); + const keys = lossShowInfo.mergeFileList[tag].find(item => item.file === filePath)?.fileList || []; return ((
Tag: - {tag} + {tag}
{t('filePath')}: {filePath}
+ {keys.length ? generateMergeFileList(keys, 'subfile') : <>}
{t('legendName')}: { @@ -497,6 +499,30 @@ export const DataChart = observer(({ lossShowInfo, tag, isExpand }: } return <>; }; + /** + * @description: 合并文件时,展示原始文件 + * @param {string[]} checkedKeys 已勾选的文件 + * @param {string} fileTip 提示语 + * @return {*} + */ + const generateMergeFileList = (checkedKeys: string[], fileTip: string) => { + if (lossShowInfo.isTagPolymerize) { + return checkedKeys.map(fileKey => { + const index = fileKey.lastIndexOf(':'); + const filePath = fileKey.slice(index + 1); + return filePath; + }).map(item => (
+ {t(fileTip)}: + {item} +
)); + } else { + return checkedKeys.map(item => (
+ {t(fileTip)}: + {item} +
)); + } + + }; useEffect(() => { init(); }, [lossShowInfo.getShowList(tag), lossShowInfo.renderChart]); @@ -543,6 +569,7 @@ export const DataChart = observer(({ lossShowInfo, tag, isExpand }: { mergeOrUnset('merge'); }} width='800px' style={{ top: 280 }} className='tokenConfigModal' onCancel={mergeHandleCancel} maskClosable={false} key='mergeConfig' okText={t('ok')} cancelText={t('cancel')}>
+ {generateMergeFileList(checkedKeys, 'selectedFiles')}
{t('mergeFileName')}: { diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/FileTreeList.tsx b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/FileTreeList.tsx index 636eef9dd7..7af28f7163 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/FileTreeList.tsx +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/FileTreeList.tsx @@ -138,7 +138,7 @@ export const FileTreeList = ({ lossShowInfo, tag, setConfigChange, updateConfig if (!exist) { const obj: TreeItem = { title: '', selectable: false, key: '' }; if (index === len - 1) { - obj.title = isMerge ? ({name}) : name; + obj.title = isMerge ? ({name}) : name; obj.key = path; if (isMerge) { cur.unshift(obj); @@ -331,7 +331,7 @@ export const FileTreeList = ({ lossShowInfo, tag, setConfigChange, updateConfig fileList.find(item => item.tag === oneTag)?.file.forEach(file => { const isMerge = file.isMerge; if (isMerge) { - tree.unshift({ title: ({`${oneTag}:${file.fileName}`}), key: `${oneTag}&&${file.fileName}:${file.filePath}`, selectable: false, checkable: true }); + tree.unshift({ title: ({`${oneTag}:${file.fileName}`}), key: `${oneTag}&&${file.fileName}:${file.filePath}`, selectable: false, checkable: true }); } else { tree.push({ title: `${oneTag}:${file.fileName}`, key: `${oneTag}&&${file.fileName}:${file.filePath}`, selectable: false, checkable: true }); } diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx index eca378ba68..36648592d5 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx @@ -11,12 +11,26 @@ import eventBus from '@/eventBus'; export const Smoothing = ({ lossShowInfo, tag }: { lossShowInfo: LossShowInfo; tag: string | string[] }): JSX.Element => { const { t } = useTranslation('lossShow'); - const [algorithmValue, setAlgorithmValue] = useState(''); - const [rateValue, setRateValue] = useState(0); + const [algorithmValue, setAlgorithmValue] = useState(''); //算法名称 + const [rateValue, setRateValue] = useState(0); //权重值 + const [windowSize, setWindowSize] = useState(20); //windowSize大小 + const [top, setTop] = useState(0.25); //topX大小 const algorithmOptions = [ + { + label: 'None', + value: '', + }, { label: 'First Order IR Sample', value: 'smoothing', + }, + { + label: 'WindowMedian', + value: 'windowMedian', + }, + { + label: 'WindowTopx', + value: 'windowTopx', } ]; @@ -25,26 +39,37 @@ export const Smoothing = ({ lossShowInfo, tag }: { lossShowInfo: LossShowInfo; t debounceUpdataSmoothingConfig(); }; - const rateChange = (value: number | null) => { + const configChange = (type: string, value: number | null) => { if (Number.isNaN(value) || value === null) { return; } - setRateValue(value); + switch (type) { + case 'rateValue': + setRateValue(value); + break; + case 'windowSize': + setWindowSize(value); + break; + case 'top': + setTop(value); + break; + default: + break; + } debounceUpdataSmoothingConfig(); }; const debounceUpdataSmoothingConfig = useDebounce(() => { - if (algorithmValue === '') { - return; - } - lossShowInfo.modifySmoothingConfig(tag, { sampleAlgorithm: algorithmValue, sampleWeight: rateValue }); + lossShowInfo.modifySmoothingConfig(tag, { sampleAlgorithm: algorithmValue, sampleWeight: rateValue, sampleWindowsize: windowSize, sampleTop: top }); eventBus.emit('updataChartData'); }, 500); const init = () => { - const { sampleAlgorithm, sampleWeight } = lossShowInfo.getSmothingConfig(tag); + const { sampleAlgorithm, sampleWeight, sampleWindowsize, sampleTop } = lossShowInfo.getSmothingConfig(tag); setAlgorithmValue(sampleAlgorithm); setRateValue(sampleWeight); + setWindowSize(sampleWindowsize); + setTop(sampleTop); debounceUpdataSmoothingConfig(); }; @@ -60,11 +85,28 @@ export const Smoothing = ({ lossShowInfo, tag }: { lossShowInfo: LossShowInfo; t onChange={algorithmChange} options={algorithmOptions} maxTagCount={'responsive'} size="small" />
-
- - +
+ {algorithmValue === 'smoothing' ?
+ { configChange('rateValue', value); }} + style={{ flex: 1, margin: '0 12px' }} /> + { configChange('rateValue', value); }} size="small" style={{ width: 70 }} /> +
: <>} + {algorithmValue === 'windowMedian' ?
+ WindowSize: + { configChange('windowSize', value); }} /> +
: <>} + {algorithmValue === 'windowTopx' ?
+
+ WindowSize: + { configChange('windowSize', value); }} /> +
+
+ Topx: + { configChange('top', value); }} /> +
+
: <>}
; }; \ No newline at end of file diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts b/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts index 4ef98eb958..1f66e677f1 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts @@ -13,7 +13,8 @@ import type { LineItem, tokenParam, QueryParamItem, - FileMergeResponseBody + FileMergeResponseBody, + SmoothingChart } from '@/api/lossApi'; import { makeAutoObservable } from 'mobx'; import { getRandomRGBColor, getChartColor } from '@/utils/common'; @@ -59,6 +60,8 @@ interface SmoothingConfig { [key: string]: { sampleAlgorithm: string; sampleWeight: number; + sampleWindowsize: number; + sampleTop: number; }; }; interface TokenOptions { @@ -89,7 +92,7 @@ export class LossShowInfo { showTagList: string[] = []; chartInit: boolean = false; tokenOptions: TokenOptions = {}; //token相关配置 - mergeFileList: { [key: string]: { file: string, mergeName: string }[] } = {}; //虚拟文件列表 + mergeFileList: { [key: string]: { file: string, mergeName: string, fileList: string[] }[] } = {}; //虚拟文件列表 constructor() { makeAutoObservable(this); }; @@ -111,7 +114,7 @@ export class LossShowInfo { if (!Object.keys(this.fileList).includes(item.tag)) { this.fileList[item.tag] = {}; this.showList[item.tag] = []; - this.smoothingConfigList[item.tag] = { sampleAlgorithm: '', sampleWeight: 0 }; + this.smoothingConfigList[item.tag] = { sampleAlgorithm: '', sampleWeight: 0, sampleWindowsize: 20, sampleTop: 0.25 }; this.tokenOptions[item.tag] = { files: {}, enable: false }; this.mergeFileList[item.tag] = []; } @@ -171,7 +174,7 @@ export class LossShowInfo { return { name: this.fileList[tag][filePath].lineConfig.name, color: this.fileList[tag][filePath].lineConfig.color, - key: `${tag}:${filePath}` + key: `${tag}:${filePath}`, }; }); return res; @@ -295,13 +298,16 @@ export class LossShowInfo { }); }; - modifySmoothingConfig(tag: string | string[], value: { sampleAlgorithm: string, sampleWeight: number }) { + modifySmoothingConfig(tag: string | string[], value: SmoothingConfig['SmoothingConfig']) { const tagList = typeof tag === 'string' ? [tag] : tag; tagList.forEach(tag => { this.smoothingConfigList[tag].sampleAlgorithm = value.sampleAlgorithm; this.smoothingConfigList[tag].sampleWeight = value.sampleWeight; + this.smoothingConfigList[tag].sampleWindowsize = value.sampleWindowsize; + this.smoothingConfigList[tag].sampleTop = value.sampleTop; Object.keys(this.fileList[tag]).forEach(filePath => { const file = this.fileList[tag][filePath]; + file.queryParam = { start: 0, end: -1 }; if (this.tokenOptions[tag].enable) { file.tokenSmoothingData = {}; } else { @@ -433,9 +439,23 @@ export class LossShowInfo { const graphList: ChartsDataRequestParams['graphList'] = []; Object.keys(this.fileList).forEach((tag: string) => { if (this.showTagList.includes(tag)) { - const { sampleAlgorithm: algorithm, sampleWeight: weight } = this.smoothingConfigList[tag]; + const { sampleAlgorithm: algorithm, sampleWeight: weight, sampleWindowsize: windowSize, sampleTop: top } = this.smoothingConfigList[tag]; Object.keys(this.fileList[tag]).forEach((file: string) => { const tokenOption: TokenChart = { type: 'token', enable: false }; + const smoothingOption: SmoothingChart = { type: 'smoothing', enable: algorithm.length > 0, algorithm }; + if (algorithm === 'smoothing') { + smoothingOption.weight = weight; + } else if (algorithm === 'windowMedian') { + smoothingOption.windowSize = windowSize; + } else if (algorithm === 'windowTopx') { + smoothingOption.windowSize = windowSize; + smoothingOption.top = top; + } else { + //不选择平滑算法 + smoothingOption.enable = false; + smoothingOption.algorithm = ''; + smoothingOption.weight = 0; + } const oneFile = this.fileList[tag][file]; const tokenEnable = this.tokenOptions[tag].enable; const start = oneFile.queryParam.start; @@ -447,7 +467,7 @@ export class LossShowInfo { file, start, end, - graphConfig: [{ type: 'normal', enable: !tokenEnable }, tokenOption, { type: 'smoothing', enable: algorithm.length > 0, algorithm, weight }] + graphConfig: [{ type: 'normal', enable: !tokenEnable }, tokenOption, smoothingOption] }); } }); @@ -504,7 +524,7 @@ export class LossShowInfo { } }; handleMergeFile(mergeName: string, body: FileMergeResponseBody) { - const { action, tags, file } = body.data; + const { action, tags, file, fileList } = body.data; if (action === 'merge') { tags.forEach(t => { this.fileList[t][file] = { @@ -520,7 +540,7 @@ export class LossShowInfo { isMerge: true, queryParam: { start: 0, end: -1 } }; - this.mergeFileList[t].push({ file, mergeName }); + this.mergeFileList[t].push({ file, mergeName, fileList }); this.tokenOptions[t].files[file] = { globalBatchSize: -1, seqLength: -1 }; }); this.fileListChange += 1; diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json index 8fae21d92a..22aa2023d4 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json @@ -42,6 +42,8 @@ "mergeFileName": "Virtual File Name", "mergeTip": "The virtual file cannot be merged again. Please deselect the virtual file.", "mergeNameTip": "The virtual file name cannot be empty.", - "batchTokenTip": "The token parameter cannot be set for the virtual file. Please deselect the virtual file." + "batchTokenTip": "The token parameter cannot be set for the virtual file. Please deselect the virtual file.", + "selectedFiles": "Selected files", + "subfile": "Subfiles" } } \ No newline at end of file diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json index c5c8895b4f..791e413565 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json @@ -42,6 +42,8 @@ "mergeFileName": "虚拟文件名称", "mergeTip": "虚拟文件不能被再次合并,请取消选中虚拟文件", "mergeNameTip": "虚拟文件名不能为空", - "batchTokenTip": "虚拟文件不能被设置Token参数,请取消选中虚拟文件" + "batchTokenTip": "虚拟文件不能被设置Token参数,请取消选中虚拟文件", + "selectedFiles": "已选择的文件", + "subfile": "子文件" } } \ No newline at end of file diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js b/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js index 10b11b3a20..2b538ea44d 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js +++ b/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js @@ -8,7 +8,7 @@ import fs from 'fs'; const distPath = './dist/index.html'; const htmlText = fs.readFileSync(distPath, 'utf-8'); let resultText = ''; -const htmlArr = htmlText.match(/.*\n/g) || []; +const htmlArr = htmlText.match(/<.*>/g) || []; htmlArr.forEach(str => { str = str.replace(/\s?nomodule\s?/g, ' '); str = str.replace(/\s?crossorigin\s?/g, ' '); -- Gitee From e361e2094ef9ff39b4266b89b4792e7ba6fec080 Mon Sep 17 00:00:00 2001 From: Maaaax Date: Tue, 4 Mar 2025 15:38:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../front/src/components/LossShow/Smoothing.tsx | 6 +++--- .../Scalar/front/src/components/LossShow/utils.tsx | 7 +++++-- .../Scalar/front/src/entity/lossShow.ts | 12 ++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx index 36648592d5..fe91f3c46b 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Smoothing.tsx @@ -62,7 +62,7 @@ export const Smoothing = ({ lossShowInfo, tag }: { lossShowInfo: LossShowInfo; t const debounceUpdataSmoothingConfig = useDebounce(() => { lossShowInfo.modifySmoothingConfig(tag, { sampleAlgorithm: algorithmValue, sampleWeight: rateValue, sampleWindowsize: windowSize, sampleTop: top }); eventBus.emit('updataChartData'); - }, 500); + }, 200); const init = () => { const { sampleAlgorithm, sampleWeight, sampleWindowsize, sampleTop } = lossShowInfo.getSmothingConfig(tag); @@ -94,12 +94,12 @@ export const Smoothing = ({ lossShowInfo, tag }: { lossShowInfo: LossShowInfo; t
: <>} {algorithmValue === 'windowMedian' ?
WindowSize: - { configChange('windowSize', value); }} /> + { configChange('windowSize', value); }} />
: <>} {algorithmValue === 'windowTopx' ?
WindowSize: - { configChange('windowSize', value); }} /> + { configChange('windowSize', value); }} />
Topx: diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/utils.tsx b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/utils.tsx index c0ad73e32c..13a1123bce 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/utils.tsx +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/utils.tsx @@ -100,6 +100,8 @@ export const creatDataChart = (chartParam: ChartParam) => { itemStyle: { color: colorCallback(_item, '1'), }, + connectNulls: true, + }; } else { return { @@ -126,7 +128,8 @@ export const creatDataChart = (chartParam: ChartParam) => { borderType: 'solid', heigth: 50 } - } + }, + connectNulls: true, }; } }), @@ -218,7 +221,7 @@ export const getTableData = (data: { [key: string]: DataItem }) => { len = steps.length; } else { keys1 = Object.keys(data[keys[keysLen - 1]]); - steps = [...new Set([...keys0, ...keys1])]; + steps = [...new Set([...keys0, ...keys1])].sort((a: string, b: string) => Number(a) - Number(b)); len = steps.length; } for (let i = 0; i < len; i++) { diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts b/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts index 1f66e677f1..41a4dfcbc1 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/entity/lossShow.ts @@ -154,10 +154,6 @@ export class LossShowInfo { const file = this.fileList[item.tag][item.file]; dataMapArr.forEach(type => { file[dataMap[type]] = item[type] || {}; - if (item[type] && Object.keys(item[type]).length) { - const keys = Object.keys(item[type]).map(Number); - file.queryParam = { start: keys[0], end: keys[keys.length - 1] }; - } }); file.dateConfig.push(...(item.dateConfig ?? [])); }); @@ -396,13 +392,13 @@ export class LossShowInfo { } const tokenEnable: boolean = this.tokenOptions[tag].enable; Object.keys(this.fileList[tag]).forEach((file: string) => { - const { sampleAlgorithm, sampleWeight } = this.smoothingConfigList[tag]; + const { sampleAlgorithm, sampleWeight, sampleWindowsize } = this.smoothingConfigList[tag]; const oneFile = this.fileList[tag][file]; if (oneFile.isChecked) { data[`${tag}:${file}`] = tokenEnable ? oneFile.tokenData : oneFile.data; - smoothingData[`${tag}:${file}_smoothing`] = - (sampleAlgorithm === '' || sampleWeight === 0) - ? (tokenEnable ? oneFile.tokenData : oneFile.data) : (tokenEnable ? oneFile.tokenSmoothingData : oneFile.smoothingData); + const judgeAlg = sampleAlgorithm === '' || (sampleAlgorithm === 'smoothing' && sampleWeight === 0) || ((sampleAlgorithm === 'windowMedian' || sampleAlgorithm === 'windowTopx') && sampleWindowsize === 0); + smoothingData[`${tag}:${file}_smoothing`] = judgeAlg ? + (tokenEnable ? oneFile.tokenData : oneFile.data) : (tokenEnable ? oneFile.tokenSmoothingData : oneFile.smoothingData); dateConfig[`${tag}:${file}`] = oneFile.dateConfig.map(item => ({ coord: [String(item.step), String(item.value)], value: item.date })); } }); -- Gitee From b2694a6ddc16c3ea08dc79d5f6f8351fc5e46441 Mon Sep 17 00:00:00 2001 From: Maaaax Date: Tue, 4 Mar 2025 16:59:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=A3=80=E8=A7=86=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9B=E8=84=9A=E6=9C=AC=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AC=A6=E5=90=88=E5=BC=80=E6=BA=90=E5=90=88=E8=A7=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../front/src/components/LossShow/Chart.tsx | 10 +++---- .../Scalar/front/src/i18n/lossShow/en.json | 18 ++++++------- .../Scalar/front/src/i18n/lossShow/zh.json | 2 +- .../Scalar/front/updata-index.js | 26 +++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx index adf670e646..4d895406a3 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/components/LossShow/Chart.tsx @@ -510,11 +510,11 @@ export const DataChart = observer(({ lossShowInfo, tag, isExpand }: return checkedKeys.map(fileKey => { const index = fileKey.lastIndexOf(':'); const filePath = fileKey.slice(index + 1); - return filePath; - }).map(item => (
- {t(fileTip)}: - {item} -
)); + return (
+ {t(fileTip)}: + {filePath} +
); + }); } else { return checkedKeys.map(item => (
{t(fileTip)}: diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json index 22aa2023d4..6d7bc9d776 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/en.json @@ -27,19 +27,19 @@ "parseState": "Data parsing status", "parseFailed": "Failed to parse data", "tokenEnable": "Enable token", - "tokenConfigChange": "Modify Token Conifg", + "tokenConfigChange": "Modify token conifg", "setBatchLength": "GlobalBatch & SeqLength Setting", "setLine": "Custom polyline", - "fileMerge": "File Merge", - "fileUnset": "Unset File Merge", + "fileMerge": "File merge", + "fileUnset": "Unset file merge", "ok": "OK", "cancel": "Cancel", - "tokenTip": "After the token is enabled, if the configuration is incorrect, no data may be displayed in the chart.", - "batchTokenConfigChange": "Batch modify Token Conifg", - "filePath": "FilePath", - "legendName": "Legend Name", - "legendColor": "Legend Color", - "mergeFileName": "Virtual File Name", + "tokenTip": "After the token is enabled in the chart, if the configuration is incorrect, the chart displays the data of the Step dimension.", + "batchTokenConfigChange": "Batch modify token conifg", + "filePath": "Filepath", + "legendName": "Legend name", + "legendColor": "Legend color", + "mergeFileName": "Virtual filename", "mergeTip": "The virtual file cannot be merged again. Please deselect the virtual file.", "mergeNameTip": "The virtual file name cannot be empty.", "batchTokenTip": "The token parameter cannot be set for the virtual file. Please deselect the virtual file.", diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json index 791e413565..091659ceff 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json +++ b/plugins/mindstudio-insight-plugins/Scalar/front/src/i18n/lossShow/zh.json @@ -34,7 +34,7 @@ "fileUnset": "取消文件合并", "ok": "确认", "cancel": "取消", - "tokenTip": "开启Token后,如果配置不正确,图表可能无数据!", + "tokenTip": "开启Token后,如果配置不正确,图表将展示Step维度的数据", "batchTokenConfigChange": "批量修改Token配置", "filePath": "文件路径", "legendName": "图例名称", diff --git a/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js b/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js index 2b538ea44d..80237ac1d2 100644 --- a/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js +++ b/plugins/mindstudio-insight-plugins/Scalar/front/updata-index.js @@ -1,22 +1,22 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. */ // 此脚本为了删除vite打包后对esmodule模式兼容的部分 import fs from 'fs'; -const distPath = './dist/index.html'; -const htmlText = fs.readFileSync(distPath, 'utf-8'); -let resultText = ''; -const htmlArr = htmlText.match(/<.*>/g) || []; -htmlArr.forEach(str => { - str = str.replace(/\s?nomodule\s?/g, ' '); - str = str.replace(/\s?crossorigin\s?/g, ' '); - str = str.replace(/data-src/g, 'src'); - str = str.replace(/System.import\([\s\S]*getAttribute\([\s\S]*\)\)/g, ''); - if (!/type="module"/i.test(str)) { - resultText += str; +const dist = './dist/index.html'; +const html = fs.readFileSync(dist, 'utf-8'); +let result = ''; +const htmlArrs = html.match(/<.*>/g) || []; +htmlArrs.forEach(string => { + string = string.replace(/\s?nomodule\s?/g, ' '); + string = string.replace(/\s?crossorigin\s?/g, ' '); + string = string.replace(/data-src/g, 'src'); + string = string.replace(/System.import\([\s\S]*getAttribute\([\s\S]*\)\)/g, ''); + if (!/type="module"/i.test(string)) { + result += string; } }); -fs.writeFileSync(distPath, resultText, 'utf-8'); +fs.writeFileSync(dist, result, 'utf-8'); console.log('build end'); -- Gitee