Skip to content

Commit b8503ee

Browse files
committed
修复:模型多版本显示问题
1 parent 26ba277 commit b8503ee

File tree

7 files changed

+18
-7
lines changed

7 files changed

+18
-7
lines changed

src/components/Server/ServerActionDelete.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const emit = defineEmits({
1616
1717
const doDelete = async () => {
1818
const record = props.record
19-
await Dialog.confirm(t('确定删除模型 {title} 吗?', {title: record.title}))
19+
await Dialog.confirm(t('确定删除模型 {title} v{version} 吗?', {title: record.title, version: record.version}))
2020
Dialog.loadingOn(t('正在删除'))
2121
await sleep(500)
2222
await serverStore.delete(record)

src/components/Server/ServerImportLocalDialog.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ const doSubmit = async () => {
6363
isImporting.value = true
6464
logStatus.value = t('正在解压文件')
6565
try {
66+
// console.log('unzip.start', modelInfo.value.path, target)
6667
await window.$mapi.misc.unzip(modelInfo.value.path, target, {
6768
process: (type: string, file: any) => {
6869
switch (type) {
6970
case 'start':
70-
// logAppend(t('正在解压 {name}', {name: file.fileName}))
71+
logStatus.value = t('正在解压 {name}', {name: file.fileName})
7172
break
7273
case 'end':
7374
break
@@ -77,6 +78,7 @@ const doSubmit = async () => {
7778
}
7879
},
7980
})
81+
// console.log('unzip.end', modelInfo.value.path, target)
8082
// console.log('entry', modelInfo.value.entry)
8183
if (modelInfo.value.entry) {
8284
const executable = target + '/' + modelInfo.value.entry
@@ -210,7 +212,7 @@ const emit = defineEmits({
210212
{{ $t('重新选择') }}
211213
</a-button>
212214
</div>
213-
<div class="flex-grow pl-3">
215+
<div class="flex-grow pl-3 text-sm truncate">
214216
{{ logStatus }}
215217
</div>
216218
</div>

src/lang/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"02261f68": "Cross language",
7373
"02286f86": "Connecting",
7474
"022cab31": "Running",
75+
"03537548": "确定删除模型 {title} v{version} 吗?",
7576
"041806bc": "GPU Priority",
7677
"041b5a9a": "GPU Mode",
7778
"04e64feb": "USB Connection",

src/lang/source.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
"直接退出": "379a84eb",
134134
"相同的种子可以确保每次生成结果数据一致": "5232d376",
135135
"确定": "000ef0ec",
136+
"确定删除模型 {title} v{version} 吗?": "03537548",
136137
"确定删除模型 {title} 吗?": "702bab32",
137138
"确定裁剪": "382747b5",
138139
"确定退出软件?": "0b2004f2",

src/lang/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"02261f68": "跨语种",
7373
"02286f86": "连接中",
7474
"022cab31": "运行中",
75+
"03537548": "确定删除模型 {title} v{version} 吗?",
7576
"041806bc": "GPU优先",
7677
"041b5a9a": "GPU模式",
7778
"04e64feb": "USB连接",

src/pages/Server.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ const typeName = (type: string) => {
122122
</div>
123123
<div class="inline-block mr-4">
124124
{{ record.title }}
125+
<div class="inline-block rounded-3xl bg-gray-100 px-3">
126+
v{{ record.version }}
127+
</div>
125128
</div>
126129
</div>
127130
<div>

src/store/modules/server.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const serverStore = defineStore("server", {
8282
}
8383
let changed = false
8484
for (let lr of localRecords) {
85-
const record = this.records.find((record) => record.name === lr.name)
85+
const record = this.records.find((record) => record.key === lr.key)
8686
if (!record) {
8787
lr.status = createServerStatus(lr)
8888
lr.runtime = createServerRuntime(lr)
@@ -99,8 +99,11 @@ export const serverStore = defineStore("server", {
9999
await this.sync()
100100
}
101101
},
102+
findRecord(server: ServerRecord) {
103+
return this.records.find((record) => record.key = server.key)
104+
},
102105
async start(server: ServerRecord) {
103-
const record = this.records.find((record) => record.name === server.name)
106+
const record = this.findRecord(server)
104107
if (record?.status === EnumServerStatus.STOPPED || record?.status === EnumServerStatus.ERROR) {
105108
} else {
106109
throw new Error('StatusError')
@@ -163,7 +166,7 @@ export const serverStore = defineStore("server", {
163166
serverRuntime.pingCheckTimer = setTimeout(pingCheck, 10 * 1000)
164167
},
165168
async stop(server: ServerRecord) {
166-
const record = this.records.find((record) => record.name === server.name)
169+
const record = this.findRecord(server)
167170
if (record?.status === EnumServerStatus.RUNNING) {
168171
} else {
169172
throw new Error('StatusError')
@@ -188,7 +191,7 @@ export const serverStore = defineStore("server", {
188191
await this.sync()
189192
},
190193
async delete(server: ServerRecord) {
191-
const index = this.records.findIndex((record) => record.name === server.name)
194+
const index = this.records.findIndex((record) => record.key === server.key)
192195
if (index === -1) {
193196
return
194197
}

0 commit comments

Comments
 (0)