Skip to content

Commit

Permalink
chore: advance translations
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Sep 9, 2024
1 parent c5f4083 commit dff8a0f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/locales/en-US/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
'resources.table.vender': 'Vender',
'resources.table.temperature': 'Temperature',
'resources.table.core': 'Core',
'resources.table.utilization': 'Utilization',
'resources.table.gpuutilization': 'GPU Utilization',
'resources.table.vramutilization': 'VRAM Utilization',
'resources.table.total': 'Total',
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default {
'resources.table.core': '核数',
'resources.table.gpuutilization': 'GPU 利用率',
'resources.table.vramutilization': '显存利用率',
'resources.table.utilization': '利用率',
'resources.table.total': '总量',
'resources.table.used': '已用',
'resources.table.wokers': 'workers',
Expand Down
20 changes: 15 additions & 5 deletions src/pages/llmodels/components/gpu-card.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
import { convertFileSize } from '@/utils';
import { useIntl } from '@umijs/max';
import _ from 'lodash';
import React from 'react';
import '../style/gpu-card.less';

const GPUCard: React.FC<{
data: any;
}> = ({ data }) => {
const intl = useIntl();
return (
<div className="gpu-card">
<div className="header">
{data.label}({data.worker_name})[Index:{data.index}]
{data.label}({data.worker_name})[
{intl.formatMessage({ id: 'resources.table.index' })}:{data.index}]
</div>
<div className="info">
<span>VRAM:</span>
<span>Total {convertFileSize(data?.memory?.total || 0)}</span>
<span>Used {convertFileSize(data?.memory?.used || 0)}</span>
<span>{intl.formatMessage({ id: 'resources.table.vram' })}:</span>
<span>
Utilization {_.round(data?.memory?.utilization_rate || 0, 2)}%
{intl.formatMessage({ id: 'resources.table.total' })}{' '}
{convertFileSize(data?.memory?.total || 0)}
</span>
<span>
{intl.formatMessage({ id: 'resources.table.used' })}{' '}
{convertFileSize(data?.memory?.used || 0)}
</span>
<span>
{intl.formatMessage({ id: 'resources.table.utilization' })}{' '}
{_.round(data?.memory?.utilization_rate || 0, 2)}%
</span>
</div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/llmodels/components/update-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
if (action === PageAction.EDIT && open) {
form.setFieldsValue({
...props.data,
scheduleType: props.data?.gpu_selector ? 'manual' : 'auto'
scheduleType: props.data?.gpu_selector ? 'manual' : 'auto',
gpu_selector: props.data?.gpu_selector
? props.data?.gpu_selector.gpu_name
: null
});

console.log('form.setFieldsValue', props.data, form.getFieldsValue());
}
};

Expand Down Expand Up @@ -258,7 +263,8 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
});
} else {
onOk({
..._.omit(formdata, ['scheduleType'])
..._.omit(formdata, ['scheduleType']),
gpu_selector: null
});
}
};
Expand Down

0 comments on commit dff8a0f

Please sign in to comment.