diff --git a/src/components/delete-modal/index.tsx b/src/components/delete-modal/index.tsx
index 0996032..227403b 100644
--- a/src/components/delete-modal/index.tsx
+++ b/src/components/delete-modal/index.tsx
@@ -15,6 +15,7 @@ const DeleteModal = forwardRef((props, ref) => {
okText?: string;
cancelText?: string;
title?: string;
+ operation: string;
}
>({});
@@ -27,6 +28,7 @@ const DeleteModal = forwardRef((props, ref) => {
title?: string;
cancelText?: string;
okText?: string;
+ operation: string;
}
) => {
setConfig(data);
@@ -94,9 +96,7 @@ const DeleteModal = forwardRef((props, ref) => {
config.content &&
intl.formatMessage(
{
- id: config.selection
- ? 'common.delete.confirm'
- : 'common.delete.single.confirm'
+ id: config.operation || ''
},
{
type: intl.formatMessage({ id: config.content }),
diff --git a/src/locales/en-US/common.ts b/src/locales/en-US/common.ts
index 87ff631..5f6a520 100644
--- a/src/locales/en-US/common.ts
+++ b/src/locales/en-US/common.ts
@@ -194,6 +194,9 @@ export default {
'Are you sure you want to delete the selected {type}?',
'common.delete.single.confirm':
'Are you sure you want to delete {name}?',
+ 'common.stop.confirm': 'Are you sure you want to stop the selected {type}?',
+ 'common.stop.single.confirm':
+ 'Are you sure you want to stop {name}?',
'common.filter.name': 'Filter by name',
'common.form.password': 'Password',
'common.form.username': 'Username',
@@ -204,6 +207,7 @@ export default {
'common.button.docs': 'Documentation',
'common.button.version': 'Version',
'common.title.delete.confirm': 'Confirm delete',
+ 'common.title.stop.confirm': 'Confirm stop',
'common.title.recreate.confirm': 'Confirm recreate',
'common.button.addLabel': 'Add Labels',
'common.button.addSelector': 'Add Selectors',
diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN/common.ts
index a631e2d..97827a2 100644
--- a/src/locales/zh-CN/common.ts
+++ b/src/locales/zh-CN/common.ts
@@ -187,6 +187,9 @@ export default {
'common.delete.confirm': '删除选中的{type},确定吗?',
'common.delete.single.confirm':
'删除 {name},确定吗?',
+ 'common.stop.confirm': '停止选中的{type},确定吗?',
+ 'common.stop.single.confirm':
+ '停止 {name},确定吗?',
'common.filter.name': '名称查询',
'common.form.password': '密码',
'common.form.username': '用户名',
@@ -197,6 +200,7 @@ export default {
'common.button.docs': '文档',
'common.button.version': '版本',
'common.title.delete.confirm': '确认删除',
+ 'common.title.stop.confirm': '确认',
'common.title.recreate.confirm': '确认重新创建',
'common.button.addLabel': '添加标签',
'common.button.addSelector': '添加选择器',
diff --git a/src/pages/api-keys/index.tsx b/src/pages/api-keys/index.tsx
index 96b5de1..68e1f3c 100644
--- a/src/pages/api-keys/index.tsx
+++ b/src/pages/api-keys/index.tsx
@@ -118,6 +118,7 @@ const APIKeys: React.FC = () => {
const handleDelete = (row: ListItem) => {
modalRef.current.show({
content: 'apikeys.table.apikeys',
+ operation: 'common.delete.single.confirm',
name: row.name,
async onOk() {
console.log('OK');
@@ -130,6 +131,7 @@ const APIKeys: React.FC = () => {
const handleDeleteBatch = () => {
modalRef.current.show({
content: 'apikeys.table.apikeys',
+ operation: 'common.delete.confirm',
selection: true,
async onOk() {
await handleBatchRequest(rowSelection.selectedRowKeys, deleteApisKey);
diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx
index f080b19..e67dc4b 100644
--- a/src/pages/llmodels/components/table-list.tsx
+++ b/src/pages/llmodels/components/table-list.tsx
@@ -301,7 +301,7 @@ const Models: React.FC = ({
message.success(intl.formatMessage({ id: 'common.message.success' }));
};
- const handleToggleStart = async (row: ListItem, action: string) => {
+ const handleStartModel = async (row: ListItem) => {
try {
await updateModel({
id: row.id,
@@ -313,7 +313,28 @@ const Models: React.FC = ({
'updated_at',
'rowIndex'
]),
- replicas: action === 'start' ? 1 : 0
+ replicas: 1
+ }
+ });
+ message.success(intl.formatMessage({ id: 'common.message.success' }));
+ } catch (error) {
+ // ingore
+ }
+ };
+
+ const handleStopModel = async (row: ListItem) => {
+ try {
+ await updateModel({
+ id: row.id,
+ data: {
+ ..._.omit(row, [
+ 'id',
+ 'ready_replicas',
+ 'created_at',
+ 'updated_at',
+ 'rowIndex'
+ ]),
+ replicas: 0
}
});
message.success(intl.formatMessage({ id: 'common.message.success' }));
@@ -385,6 +406,7 @@ const Models: React.FC = ({
const handleDelete = async (row: any) => {
modalRef.current.show({
content: 'models.table.models',
+ operation: 'common.delete.single.confirm',
name: row.name,
async onOk() {
await deleteModel(row.id);
@@ -398,6 +420,7 @@ const Models: React.FC = ({
const handleDeleteBatch = () => {
modalRef.current.show({
content: 'models.table.models',
+ operation: 'common.delete.confirm',
selection: true,
async onOk() {
await handleBatchRequest(rowSelection.selectedRowKeys, deleteModel);
@@ -450,6 +473,7 @@ const Models: React.FC = ({
modalRef.current.show({
content: 'models.instances',
okText: 'common.button.delrecreate',
+ operation: 'common.delete.single.confirm',
name: row.name,
async onOk() {
await deleteModelInstance(row.id);
@@ -487,8 +511,21 @@ const Models: React.FC = ({
if (val === 'delete') {
handleDelete(row);
}
- if (val === 'start' || val === 'stop') {
- handleToggleStart(row, val);
+ if (val === 'start') {
+ handleStartModel(row);
+ }
+
+ if (val === 'stop') {
+ modalRef.current.show({
+ content: 'models.instances',
+ title: 'common.title.stop.confirm',
+ okText: 'common.button.stop',
+ operation: 'common.stop.single.confirm',
+ name: row.name,
+ async onOk() {
+ await handleStopModel(row);
+ }
+ });
}
},
[handleEdit, handleOpenPlayGround, handleDelete]
diff --git a/src/pages/llmodels/config/llama-config.ts b/src/pages/llmodels/config/llama-config.ts
index 53bb7cf..33947ca 100644
--- a/src/pages/llmodels/config/llama-config.ts
+++ b/src/pages/llmodels/config/llama-config.ts
@@ -49,8 +49,8 @@ const options = [
value: '--image-strength'
},
{
- label: '--image-sampler',
- value: '--image-sampler',
+ label: '--image-sample-method',
+ value: '--image-sample-method',
options: [
'euler_a',
'euler',
@@ -65,8 +65,8 @@ const options = [
]
},
{
- label: '--image-sampler-steps',
- value: '--image-sample-steps'
+ label: '--image-sampling-steps',
+ value: '--image-sampling-steps'
},
{
label: '--image-cfg-scale',
@@ -85,8 +85,8 @@ const options = [
value: '--image-slg-end'
},
{
- label: '--image-schedule',
- value: '--image-schedule',
+ label: '--image-schedule-method',
+ value: '--image-schedule-method',
options: ['default', 'discrete', 'karras', 'exponential', 'ays', 'gits']
},
{
diff --git a/src/pages/resources/components/add-worker.tsx b/src/pages/resources/components/add-worker.tsx
index 0c25d7a..bd35f49 100644
--- a/src/pages/resources/components/add-worker.tsx
+++ b/src/pages/resources/components/add-worker.tsx
@@ -41,7 +41,7 @@ const AddWorker: React.FC = (props) => {
width={600}
styles={{
body: {
- height: 410
+ height: 420
}
}}
footer={null}
diff --git a/src/pages/resources/components/workers.tsx b/src/pages/resources/components/workers.tsx
index a89048e..0f96d51 100644
--- a/src/pages/resources/components/workers.tsx
+++ b/src/pages/resources/components/workers.tsx
@@ -149,6 +149,7 @@ const Resources: React.FC = () => {
const handleDelete = (row: ListItem) => {
modalRef.current.show({
content: 'worker',
+ operation: 'common.delete.single.confirm',
name: row.name,
async onOk() {
console.log('OK');
@@ -161,6 +162,7 @@ const Resources: React.FC = () => {
const handleDeleteBatch = () => {
modalRef.current.show({
content: 'wokers',
+ operation: 'common.delete.confirm',
selection: true,
async onOk() {
await handleBatchRequest(rowSelection.selectedRowKeys, deleteWorker);
diff --git a/src/pages/users/index.tsx b/src/pages/users/index.tsx
index b71e8dc..846220a 100644
--- a/src/pages/users/index.tsx
+++ b/src/pages/users/index.tsx
@@ -160,6 +160,7 @@ const Users: React.FC = () => {
const handleDelete = (row: ListItem) => {
modalRef.current.show({
content: 'users.table.user',
+ operation: 'common.delete.single.confirm',
name: row.name,
async onOk() {
console.log('OK');
@@ -172,6 +173,7 @@ const Users: React.FC = () => {
const handleDeleteBatch = () => {
modalRef.current.show({
content: 'users.table.user',
+ operation: 'common.delete.confirm',
selection: true,
async onOk() {
await handleBatchRequest(rowSelection.selectedRowKeys, deleteUser);