fix: 修复模型管理中,公共模型不能修改 (#826)
This commit is contained in:
parent
a404a5c6e9
commit
98938b8ccf
@ -91,7 +91,7 @@ class ModelSerializer(serializers.Serializer):
|
|||||||
return [
|
return [
|
||||||
{'id': str(model.id), 'provider': model.provider, 'name': model.name, 'model_type': model.model_type,
|
{'id': str(model.id), 'provider': model.provider, 'name': model.name, 'model_type': model.model_type,
|
||||||
'model_name': model.model_name, 'status': model.status, 'meta': model.meta,
|
'model_name': model.model_name, 'status': model.status, 'meta': model.meta,
|
||||||
'permission_type': model.permission_type} for model in
|
'permission_type': model.permission_type, 'user_id': model.user_id} for model in
|
||||||
model_query_set.filter(**query_params).order_by("-create_time")]
|
model_query_set.filter(**query_params).order_by("-create_time")]
|
||||||
|
|
||||||
class Edit(serializers.Serializer):
|
class Edit(serializers.Serializer):
|
||||||
|
|||||||
@ -53,6 +53,7 @@ interface Model {
|
|||||||
* 模型类型
|
* 模型类型
|
||||||
*/
|
*/
|
||||||
model_type: string
|
model_type: string
|
||||||
|
user_id: string
|
||||||
permission_type: 'PUBLIC' | 'PRIVATE'
|
permission_type: 'PUBLIC' | 'PRIVATE'
|
||||||
/**
|
/**
|
||||||
* 基础模型
|
* 基础模型
|
||||||
|
|||||||
@ -47,7 +47,12 @@
|
|||||||
|
|
||||||
<div class="percentage-label flex-center">
|
<div class="percentage-label flex-center">
|
||||||
正在下载中 <span class="dotting"></span>
|
正在下载中 <span class="dotting"></span>
|
||||||
<el-button link type="primary" class="ml-16" @click.stop="cancelDownload"
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
class="ml-16"
|
||||||
|
:disabled="!is_permisstion"
|
||||||
|
@click.stop="cancelDownload"
|
||||||
>取消下载</el-button
|
>取消下载</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -56,7 +61,7 @@
|
|||||||
<template #mouseEnter>
|
<template #mouseEnter>
|
||||||
<div class="operation-button">
|
<div class="operation-button">
|
||||||
<el-tooltip effect="dark" content="修改" placement="top">
|
<el-tooltip effect="dark" content="修改" placement="top">
|
||||||
<el-button text @click.stop="openEditModel">
|
<el-button text :disabled="!is_permisstion" @click.stop="openEditModel">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<component
|
<component
|
||||||
:is="
|
:is="
|
||||||
@ -68,9 +73,8 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<el-tooltip effect="dark" content="删除" placement="top">
|
<el-tooltip effect="dark" content="删除" placement="top">
|
||||||
<el-button text @click.stop="deleteModel">
|
<el-button :disabled="!is_permisstion" text @click.stop="deleteModel">
|
||||||
<el-icon><Delete /></el-icon>
|
<el-icon><Delete /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -86,14 +90,20 @@ import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
|||||||
import EditModel from '@/views/template/component/EditModel.vue'
|
import EditModel from '@/views/template/component/EditModel.vue'
|
||||||
import DownloadLoading from '@/components/loading/DownloadLoading.vue'
|
import DownloadLoading from '@/components/loading/DownloadLoading.vue'
|
||||||
import { MsgConfirm } from '@/utils/message'
|
import { MsgConfirm } from '@/utils/message'
|
||||||
|
import useStore from '@/stores'
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
model: Model
|
model: Model
|
||||||
provider_list: Array<Provider>
|
provider_list: Array<Provider>
|
||||||
updateModelById: (model_id: string, model: Model) => void
|
updateModelById: (model_id: string, model: Model) => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { user } = useStore()
|
||||||
const downModel = ref<Model>()
|
const downModel = ref<Model>()
|
||||||
|
|
||||||
|
const is_permisstion = computed(() => {
|
||||||
|
console.log(user.userInfo?.id, props.model.user_id)
|
||||||
|
return user.userInfo?.id == props.model.user_id
|
||||||
|
})
|
||||||
const currentModel = computed(() => {
|
const currentModel = computed(() => {
|
||||||
if (downModel.value) {
|
if (downModel.value) {
|
||||||
return downModel.value
|
return downModel.value
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user