mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修复模型管理中,公共模型不能修改 (#826)
This commit is contained in:
parent
a404a5c6e9
commit
98938b8ccf
|
|
@ -91,7 +91,7 @@ class ModelSerializer(serializers.Serializer):
|
|||
return [
|
||||
{'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,
|
||||
'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")]
|
||||
|
||||
class Edit(serializers.Serializer):
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ interface Model {
|
|||
* 模型类型
|
||||
*/
|
||||
model_type: string
|
||||
user_id: string
|
||||
permission_type: 'PUBLIC' | 'PRIVATE'
|
||||
/**
|
||||
* 基础模型
|
||||
|
|
|
|||
|
|
@ -47,7 +47,12 @@
|
|||
|
||||
<div class="percentage-label flex-center">
|
||||
正在下载中 <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
|
||||
>
|
||||
</div>
|
||||
|
|
@ -56,7 +61,7 @@
|
|||
<template #mouseEnter>
|
||||
<div class="operation-button">
|
||||
<el-tooltip effect="dark" content="修改" placement="top">
|
||||
<el-button text @click.stop="openEditModel">
|
||||
<el-button text :disabled="!is_permisstion" @click.stop="openEditModel">
|
||||
<el-icon>
|
||||
<component
|
||||
:is="
|
||||
|
|
@ -68,9 +73,8 @@
|
|||
</el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<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-button>
|
||||
</el-tooltip>
|
||||
|
|
@ -86,14 +90,20 @@ import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
|||
import EditModel from '@/views/template/component/EditModel.vue'
|
||||
import DownloadLoading from '@/components/loading/DownloadLoading.vue'
|
||||
import { MsgConfirm } from '@/utils/message'
|
||||
|
||||
import useStore from '@/stores'
|
||||
const props = defineProps<{
|
||||
model: Model
|
||||
provider_list: Array<Provider>
|
||||
updateModelById: (model_id: string, model: Model) => void
|
||||
}>()
|
||||
|
||||
const { user } = useStore()
|
||||
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(() => {
|
||||
if (downModel.value) {
|
||||
return downModel.value
|
||||
|
|
|
|||
Loading…
Reference in New Issue