refactor: Model display creator

--bug=1057605 --user=王孝刚 【模型】模型创建者未显示 https://www.tapd.cn/62980211/s/1719783
This commit is contained in:
wxg0103 2025-06-27 17:32:03 +08:00
parent 9bd490c7ea
commit 8468d08eea

View File

@ -8,7 +8,7 @@
{{ model.name }} {{ model.name }}
<span v-if="currentModel.status === 'ERROR'"> <span v-if="currentModel.status === 'ERROR'">
<el-tooltip effect="dark" :content="errMessage" placement="top"> <el-tooltip effect="dark" :content="errMessage" placement="top">
<el-icon class="danger ml-4" size="18"><Warning /></el-icon> <el-icon class="danger ml-4" size="18"><Warning/></el-icon>
</el-tooltip> </el-tooltip>
</span> </span>
<span v-if="currentModel.status === 'PAUSE_DOWNLOAD'"> <span v-if="currentModel.status === 'PAUSE_DOWNLOAD'">
@ -17,14 +17,14 @@
:content="`${$t('views.model.modelForm.base_model.label')}: ${props.model.model_name} ${$t('views.model.tip.downloadError')}`" :content="`${$t('views.model.modelForm.base_model.label')}: ${props.model.model_name} ${$t('views.model.tip.downloadError')}`"
placement="top" placement="top"
> >
<el-icon class="danger ml-4" size="18"><Warning /></el-icon> <el-icon class="danger ml-4" size="18"><Warning/></el-icon>
</el-tooltip> </el-tooltip>
</span> </span>
</div> </div>
</template> </template>
<template #subTitle> <template #subTitle>
<el-text class="color-secondary lighter" size="small"> <el-text class="color-secondary lighter" size="small">
{{ $t('common.creator') }}: {{ model.username }} {{ $t('common.creator') }}: {{ model.nick_name }}
</el-text> </el-text>
</template> </template>
<template #tag> <template #tag>
@ -35,14 +35,14 @@
<ul> <ul>
<li class="flex mb-4"> <li class="flex mb-4">
<el-text type="info" class="color-secondary" <el-text type="info" class="color-secondary"
>{{ $t('views.model.modelForm.model_type.label') }} >{{ $t('views.model.modelForm.model_type.label') }}
</el-text> </el-text>
<span class="ellipsis ml-16"> <span class="ellipsis ml-16">
{{ $t(modelType[model.model_type as keyof typeof modelType]) }}</span> {{ $t(modelType[model.model_type as keyof typeof modelType]) }}</span>
</li> </li>
<li class="flex"> <li class="flex">
<el-text type="info" class="color-secondary" <el-text type="info" class="color-secondary"
>{{ $t('views.model.modelForm.base_model.label') }} >{{ $t('views.model.modelForm.base_model.label') }}
</el-text> </el-text>
<span class="ellipsis-1 ml-16" style="height: 20px; width: 70%"> <span class="ellipsis-1 ml-16" style="height: 20px; width: 70%">
{{ model.model_name }}</span {{ model.model_name }}</span
@ -51,12 +51,12 @@
</ul> </ul>
<!-- progress --> <!-- progress -->
<div class="progress-mask" v-if="currentModel.status === 'DOWNLOAD'"> <div class="progress-mask" v-if="currentModel.status === 'DOWNLOAD'">
<DownloadLoading class="percentage" /> <DownloadLoading class="percentage"/>
<div class="percentage-label flex-center"> <div class="percentage-label flex-center">
{{ $t('views.model.download.downloading') }} <span class="dotting"></span> {{ $t('views.model.download.downloading') }} <span class="dotting"></span>
<el-button link type="primary" class="ml-16" @click.stop="cancelDownload" <el-button link type="primary" class="ml-16" @click.stop="cancelDownload"
>{{ $t('views.model.download.cancelDownload') }} >{{ $t('views.model.download.cancelDownload') }}
</el-button> </el-button>
</div> </div>
</div> </div>
@ -65,7 +65,7 @@
<el-dropdown trigger="click" v-if="!isShared"> <el-dropdown trigger="click" v-if="!isShared">
<el-button text @click.stop> <el-button text @click.stop>
<el-icon> <el-icon>
<MoreFilled /> <MoreFilled/>
</el-icon> </el-icon>
</el-button> </el-button>
<template #dropdown> <template #dropdown>
@ -82,7 +82,8 @@
v-if="isSystemShare" v-if="isSystemShare"
icon="Lock" icon="Lock"
@click.stop="openAuthorizedWorkspaceDialog(model)" @click.stop="openAuthorizedWorkspaceDialog(model)"
>{{ $t('views.shared.authorized_workspace') }}</el-dropdown-item >{{ $t('views.shared.authorized_workspace') }}
</el-dropdown-item
> >
<el-dropdown-item <el-dropdown-item
@ -112,7 +113,7 @@
</el-dropdown> </el-dropdown>
</template> </template>
<EditModel ref="editModelRef" @submit="emit('change')"></EditModel> <EditModel ref="editModelRef" @submit="emit('change')"></EditModel>
<ParamSettingDialog ref="paramSettingRef" :model="model" /> <ParamSettingDialog ref="paramSettingRef" :model="model"/>
<AuthorizedWorkspace <AuthorizedWorkspace
ref="AuthorizedWorkspaceDialogRef" ref="AuthorizedWorkspaceDialogRef"
v-if="isSystemShare" v-if="isSystemShare"
@ -120,17 +121,17 @@
</card-box> </card-box>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { Provider, Model } from '@/api/type/model' import type {Provider, Model} from '@/api/type/model'
import { computed, ref, onMounted, onBeforeUnmount } from 'vue' import {computed, ref, onMounted, onBeforeUnmount} from 'vue'
import EditModel from '@/views/model/component/EditModel.vue' import EditModel from '@/views/model/component/EditModel.vue'
import DownloadLoading from '@/components/loading/DownloadLoading.vue' import DownloadLoading from '@/components/loading/DownloadLoading.vue'
import { MsgConfirm } from '@/utils/message' import {MsgConfirm, MsgSuccess} from '@/utils/message'
import { modelType } from '@/enums/model' import {modelType} from '@/enums/model'
import ParamSettingDialog from './ParamSettingDialog.vue' import ParamSettingDialog from './ParamSettingDialog.vue'
import AuthorizedWorkspace from '@/views/system-shared/AuthorizedWorkspaceDialog.vue' import AuthorizedWorkspace from '@/views/system-shared/AuthorizedWorkspaceDialog.vue'
import { t } from '@/locales' import {t} from '@/locales'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api' import {loadSharedApi} from '@/utils/dynamics-api/shared-api'
const props = defineProps<{ const props = defineProps<{
model: Model model: Model
@ -177,17 +178,19 @@ const deleteModel = () => {
}, },
) )
.then(() => { .then(() => {
loadSharedApi({ type: 'model', systemType: props.apiType }) loadSharedApi({type: 'model', systemType: props.apiType})
.deleteModel(props.model.id) .deleteModel(props.model.id)
.then(() => { .then(() => {
emit('change') emit('change')
MsgSuccess(t('common.deleteSuccess'))
}) })
}) })
.catch(() => {}) .catch(() => {
})
} }
const cancelDownload = () => { const cancelDownload = () => {
loadSharedApi({ type: 'model', systemType: props.apiType }) loadSharedApi({type: 'model', systemType: props.apiType})
.pauseDownload(props.model.id) .pauseDownload(props.model.id)
.then(() => { .then(() => {
downModel.value = undefined downModel.value = undefined
@ -210,7 +213,7 @@ const icon = computed(() => {
const initInterval = () => { const initInterval = () => {
interval = setInterval(() => { interval = setInterval(() => {
if (currentModel.value.status === 'DOWNLOAD') { if (currentModel.value.status === 'DOWNLOAD') {
loadSharedApi({ type: 'model', systemType: props.apiType }) loadSharedApi({type: 'model', systemType: props.apiType})
.getModelMetaById(props.model.id) .getModelMetaById(props.model.id)
.then((ok: any) => { .then((ok: any) => {
downModel.value = ok.data downModel.value = ok.data
@ -239,6 +242,7 @@ const openParamSetting = () => {
} }
const AuthorizedWorkspaceDialogRef = ref() const AuthorizedWorkspaceDialogRef = ref()
function openAuthorizedWorkspaceDialog(row: any) { function openAuthorizedWorkspaceDialog(row: any) {
if (AuthorizedWorkspaceDialogRef.value) { if (AuthorizedWorkspaceDialogRef.value) {
AuthorizedWorkspaceDialogRef.value.open(row, 'Model') AuthorizedWorkspaceDialogRef.value.open(row, 'Model')