Skip to content

Commit 7a6b809

Browse files
committed
fix: Model permission while setting knowledge or application
1 parent ed5cc3a commit 7a6b809

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

ui/src/components/model-select/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
<template #footer v-if="showFooter">
5454
<slot name="footer">
5555
<div class="w-full text-left cursor" @click="openCreateModel(undefined, props.modelType)">
56-
<el-button type="primary" link>
56+
<el-button type="primary" link
57+
v-if="permissionPrecise.create()"
58+
>
5759
<el-icon class="mr-4">
5860
<Plus />
5961
</el-icon>
@@ -86,6 +88,7 @@ import SelectProviderDialog from '@/views/model/component/SelectProviderDialog.v
8688
8789
import { t } from '@/locales'
8890
import useStore from '@/stores'
91+
import permissionMap from '@/permission'
8992
9093
defineOptions({ name: 'ModelSelect' })
9194
const props = defineProps<{
@@ -95,6 +98,10 @@ const props = defineProps<{
9598
modelType?: ''
9699
}>()
97100
101+
const permissionPrecise = computed(() => {
102+
return permissionMap['model']['workspace']
103+
})
104+
98105
const emit = defineEmits(['update:modelValue', 'change', 'submitModel'])
99106
const modelValue = computed({
100107
set: (item) => {

ui/src/views/application/component/AIModeParamSettingDialog.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
<el-button @click.prevent="dialogVisible = false">
2525
{{ $t('common.cancel') }}
2626
</el-button>
27-
<el-button type="primary" @click="submit" :loading="loading">
27+
<el-button type="primary" @click="submit" :loading="loading"
28+
v-if="permissionPrecise.paramSetting(modelID)"
29+
>
2830
{{ $t('common.confirm') }}
2931
</el-button>
3032
</span>
@@ -33,11 +35,13 @@
3335
</template>
3436

3537
<script setup lang="ts">
36-
import { ref } from 'vue'
38+
import { computed, ref } from 'vue'
3739
import type { FormField } from '@/components/dynamics-form/type'
3840
import modelAPi from '@/api/model/model'
3941
import applicationApi from '@/api/application/application'
4042
import DynamicsForm from '@/components/dynamics-form/index.vue'
43+
import permissionMap from '@/permission'
44+
4145
const model_form_field = ref<Array<FormField>>([])
4246
const emit = defineEmits(['refresh'])
4347
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
@@ -47,7 +51,15 @@ const loading = ref(false)
4751
const getApi = (model_id: string, application_id?: string) => {
4852
return modelAPi.getModelParamsForm(model_id, loading)
4953
}
54+
55+
const modelID = ref('')
56+
57+
const permissionPrecise = computed(() => {
58+
return permissionMap['model']['workspace']
59+
})
60+
5061
const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
62+
modelID.value = model_id
5163
form_data.value = {}
5264
const api = getApi(model_id, application_id)
5365
api.then((ok) => {

0 commit comments

Comments
 (0)