Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 更新本地模型服务时,需要将labels也一起更新 #175

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 32 additions & 15 deletions src/pages/EditModelService/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class EditModelService$$Page extends React.Component {
this.setState({
listModels: res.Model.listModels.nodes,
});
} catch {
} catch (error) {
// console.log(error, '===> err')
}
}
Expand All @@ -196,7 +196,7 @@ class EditModelService$$Page extends React.Component {
RAY_CLUSTER_INDEX: list[0]?.value,
});
}
} catch {
} catch (error) {
// console.log(error, '===> err')
}
}
Expand Down Expand Up @@ -237,11 +237,12 @@ class EditModelService$$Page extends React.Component {
model: getWorker.model.name,
description: getWorker.description,
configType: _configType,
labels: getWorker.labels,
CUDA_VISIBLE_DEVICES: getWorker.additionalEnvs?.CUDA_VISIBLE_DEVICES,
RAY_CLUSTER_INDEX: Number(getWorker.additionalEnvs?.RAY_CLUSTER_INDEX),
NUMBER_GPUS: getWorker.additionalEnvs?.NUMBER_GPUS,
resources: {
cpu: isMarksCpu ? Object.values(marks).indexOf(resources.cpu) : 0,
cpu: isMarksCpu ? Object.values(marks).findIndex(v => v === resources.cpu) : 0,
memory: isMarksMemory
? Object.values(marks).findIndex(v => v === resources.memory?.split('Gi')[0])
: 0,
Expand All @@ -251,7 +252,7 @@ class EditModelService$$Page extends React.Component {
!isMarksMemory && resources.memory !== '512Mi'
? resources.memory?.split('Gi')[0]
: undefined,
customGPU: gpuMarks[resources.nvidiaGPU] ? undefined : resources.nvidiaGPU,
customGPU: !gpuMarks[resources.nvidiaGPU] ? resources.nvidiaGPU : undefined,
},
});
this.setState({
Expand Down Expand Up @@ -287,7 +288,7 @@ class EditModelService$$Page extends React.Component {
: undefined,
});
}
} catch {
} catch (error) {
// console.log(error, '===> error')
}
}
Expand All @@ -313,6 +314,7 @@ class EditModelService$$Page extends React.Component {
name: v.name,
displayName: v.displayName,
description: v.description,
labels: v.labels,
namespace: this.appHelper.utils.getAuthData().project || 'abc',
type:
v.configType && v.configType.includes('fastchat-vllm') ? 'fastchat-vllm' : 'fastchat',
Expand Down Expand Up @@ -606,7 +608,10 @@ class EditModelService$$Page extends React.Component {
disabled: false,
mode: 'single',
onChange: function () {
return Reflect.apply(this.onChangeModel, this, [...Array.prototype.slice.call(arguments)]);
return this.onChangeModel.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this),
placeholder: '请选择模型',
showSearch: true,
Expand Down Expand Up @@ -1114,7 +1119,10 @@ class EditModelService$$Page extends React.Component {
'x-component-props': {
_sdkSwrGetFunc: {},
onChange: function () {
return Reflect.apply(this.onChangeType, this, [...Array.prototype.slice.call(arguments)]);
return this.onChangeType.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this),
},
}}
Expand Down Expand Up @@ -1315,7 +1323,10 @@ class EditModelService$$Page extends React.Component {
disabled={false}
ghost={false}
onClick={function () {
return Reflect.apply(this.onClickCheck, this, [...Array.prototype.slice.call(arguments)]);
return this.onClickCheck.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this)}
shape="default"
size="small"
Expand Down Expand Up @@ -1388,7 +1399,10 @@ class EditModelService$$Page extends React.Component {
disabled={false}
ghost={false}
onClick={function () {
return Reflect.apply(this.handleCancle, this, [...Array.prototype.slice.call(arguments)]);
return this.handleCancle.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this)}
shape="default"
>
Expand All @@ -1401,7 +1415,10 @@ class EditModelService$$Page extends React.Component {
disabled={false}
ghost={false}
onClick={function () {
return Reflect.apply(this.handleConfirm, this, [...Array.prototype.slice.call(arguments)]);
return this.handleConfirm.apply(
this,
Array.prototype.slice.call(arguments).concat([])
);
}.bind(this)}
shape="default"
type="primary"
Expand Down Expand Up @@ -1438,15 +1455,15 @@ const PageWrapper = (props = {}) => {
};
return (
<DataProvider
render={dataProps => (
<EditModelService$$Page {...props} {...dataProps} appHelper={appHelper} self={self} />
)}
self={self}
sdkInitFunc={{
enabled: undefined,
params: undefined,
}}
sdkSwrFuncs={[]}
self={self}
render={dataProps => (
<EditModelService$$Page {...props} {...dataProps} self={self} appHelper={appHelper} />
)}
/>
);
};
Expand All @@ -1455,7 +1472,7 @@ export default PageWrapper;
function __$$eval(expr) {
try {
return expr();
} catch {}
} catch (error) {}
}

function __$$evalArray(expr) {
Expand Down
Loading