feat: application assess (#3312)
This commit is contained in:
parent
046e1c72d6
commit
e02d417af9
@ -33,6 +33,8 @@ class AccessTokenEditSerializer(serializers.Serializer):
|
|||||||
label=_("Whitelist")),
|
label=_("Whitelist")),
|
||||||
show_source = serializers.BooleanField(required=False,
|
show_source = serializers.BooleanField(required=False,
|
||||||
label=_("Whether to display knowledge sources"))
|
label=_("Whether to display knowledge sources"))
|
||||||
|
show_exec = serializers.BooleanField(required=False,
|
||||||
|
label=_("Display execution details"))
|
||||||
language = serializers.CharField(required=False, allow_blank=True, allow_null=True,
|
language = serializers.CharField(required=False, allow_blank=True, allow_null=True,
|
||||||
label=_("language"))
|
label=_("language"))
|
||||||
authentication = serializers.BooleanField(default=False, label="Do you need authentication")
|
authentication = serializers.BooleanField(default=False, label="Do you need authentication")
|
||||||
@ -60,6 +62,8 @@ class AccessTokenSerializer(serializers.Serializer):
|
|||||||
application_access_token.white_list = instance.get('white_list')
|
application_access_token.white_list = instance.get('white_list')
|
||||||
if 'show_source' in instance and instance.get('show_source') is not None:
|
if 'show_source' in instance and instance.get('show_source') is not None:
|
||||||
application_access_token.show_source = instance.get('show_source')
|
application_access_token.show_source = instance.get('show_source')
|
||||||
|
if 'show_exec' in instance and instance.get('show_exec') is not None:
|
||||||
|
application_access_token.show_exec = instance.get('show_exec')
|
||||||
if 'language' in instance and instance.get('language') is not None:
|
if 'language' in instance and instance.get('language') is not None:
|
||||||
application_access_token.language = instance.get('language')
|
application_access_token.language = instance.get('language')
|
||||||
if 'language' not in instance or instance.get('language') is None:
|
if 'language' not in instance or instance.get('language') is None:
|
||||||
|
|||||||
@ -8349,3 +8349,15 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "Application Access"
|
msgid "Application Access"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Display execution details"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "LOCAL"
|
||||||
|
msgstr "Account login"
|
||||||
|
|
||||||
|
msgid "CAS"
|
||||||
|
msgstr "CAS"
|
||||||
|
|
||||||
|
msgid "LDAP"
|
||||||
|
msgstr "LDAP"
|
||||||
@ -8475,3 +8475,15 @@ msgstr "更新外观设置"
|
|||||||
|
|
||||||
msgid "Application Access"
|
msgid "Application Access"
|
||||||
msgstr "应用接入"
|
msgstr "应用接入"
|
||||||
|
|
||||||
|
msgid "Display execution details"
|
||||||
|
msgstr "是否显示执行详情"
|
||||||
|
|
||||||
|
msgid "LOCAL"
|
||||||
|
msgstr "账号登录"
|
||||||
|
|
||||||
|
msgid "CAS"
|
||||||
|
msgstr "CAS"
|
||||||
|
|
||||||
|
msgid "LDAP"
|
||||||
|
msgstr "LDAP"
|
||||||
@ -8475,3 +8475,15 @@ msgstr "更新外觀設置"
|
|||||||
|
|
||||||
msgid "Application Access"
|
msgid "Application Access"
|
||||||
msgstr "應用介入"
|
msgstr "應用介入"
|
||||||
|
|
||||||
|
msgid "Display execution details"
|
||||||
|
msgstr "是否顯示執行詳情"
|
||||||
|
|
||||||
|
msgid "LOCAL"
|
||||||
|
msgstr "帳號登入"
|
||||||
|
|
||||||
|
msgid "CAS"
|
||||||
|
msgstr "CAS"
|
||||||
|
|
||||||
|
msgid "LDAP"
|
||||||
|
msgstr "LDAP"
|
||||||
@ -92,6 +92,18 @@ const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promis
|
|||||||
) => {
|
) => {
|
||||||
return get(`${prefix.value}/${application_id}/access_token`, undefined, loading)
|
return get(`${prefix.value}/${application_id}/access_token`, undefined, loading)
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取应用设置
|
||||||
|
* @param application_id 应用id
|
||||||
|
* @param loading 加载器
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getApplicationSetting: (
|
||||||
|
application_id: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (application_id, loading) => {
|
||||||
|
return get(`${prefix.value}/${application_id}/setting`, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改AccessToken
|
* 修改AccessToken
|
||||||
@ -167,7 +179,14 @@ const open: (application_id: string, loading?: Ref<boolean>) => Promise<Result<s
|
|||||||
const chat: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => {
|
const chat: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => {
|
||||||
return postStream(`/api/chat_message/${chat_id}`, data)
|
return postStream(`/api/chat_message/${chat_id}`, data)
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取对话用户认证类型
|
||||||
|
* @param loading 加载器
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getChatUserAuthType: (loading?: Ref<boolean>) => Promise<any> = (loading) => {
|
||||||
|
return get(`/chat_user/auth/types`, {}, loading)
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
getAllApplication,
|
getAllApplication,
|
||||||
getApplication,
|
getApplication,
|
||||||
@ -182,4 +201,6 @@ export default {
|
|||||||
getStatistics,
|
getStatistics,
|
||||||
open,
|
open,
|
||||||
chat,
|
chat,
|
||||||
|
getChatUserAuthType,
|
||||||
|
getApplicationSetting,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -331,7 +331,13 @@ function openDisplaySettingDialog() {
|
|||||||
currentDisplaySettingDialog.value = DisplaySettingDialog
|
currentDisplaySettingDialog.value = DisplaySettingDialog
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
if (currentDisplaySettingDialog.value == XPackDisplaySettingDialog) {
|
||||||
|
applicationApi.getApplicationSetting(id).then((ok) => {
|
||||||
|
DisplaySettingDialogRef.value?.open(ok.data, detail.value)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,16 @@
|
|||||||
<el-form-item :label="$t('views.applicationOverview.appInfo.LimitDialog.authentication')">
|
<el-form-item :label="$t('views.applicationOverview.appInfo.LimitDialog.authentication')">
|
||||||
<el-switch size="small" v-model="form.authentication" @change="firstGeneration"></el-switch>
|
<el-switch size="small" v-model="form.authentication" @change="firstGeneration"></el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-radio-group v-if="form.authentication" v-model="form.method" class="card__radio">
|
<el-radio-group
|
||||||
<el-card shadow="never" class="mb-16" :class="form.method === 'replace' ? 'active' : ''">
|
v-if="form.authentication"
|
||||||
|
v-model="form.authentication_value.type"
|
||||||
|
class="card__radio"
|
||||||
|
>
|
||||||
|
<el-card
|
||||||
|
shadow="never"
|
||||||
|
class="mb-16"
|
||||||
|
:class="form.authentication_value.type === 'password' ? 'active' : ''"
|
||||||
|
>
|
||||||
<el-radio value="replace" size="large">
|
<el-radio value="replace" size="large">
|
||||||
<p class="mb-4 lighter">
|
<p class="mb-4 lighter">
|
||||||
{{ $t('views.applicationOverview.appInfo.LimitDialog.authenticationValue') }}
|
{{ $t('views.applicationOverview.appInfo.LimitDialog.authenticationValue') }}
|
||||||
@ -40,7 +48,7 @@
|
|||||||
<el-form-item class="ml-24">
|
<el-form-item class="ml-24">
|
||||||
<el-input
|
<el-input
|
||||||
class="authentication-append-input"
|
class="authentication-append-input"
|
||||||
v-model="form.authentication_value"
|
v-model="form.authentication_value.password_value"
|
||||||
readonly
|
readonly
|
||||||
style="width: 268px"
|
style="width: 268px"
|
||||||
>
|
>
|
||||||
@ -69,9 +77,12 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<el-card
|
||||||
<el-card shadow="never" class="mb-16" :class="form.method === 'complete' ? 'active' : ''">
|
shadow="never"
|
||||||
<el-radio value="complete" size="large">
|
class="mb-16"
|
||||||
|
:class="form.authentication_value.type === 'login' ? 'active' : ''"
|
||||||
|
>
|
||||||
|
<el-radio value="login" size="large">
|
||||||
<p class="mb-16 lighter">
|
<p class="mb-16 lighter">
|
||||||
{{ $t('views.system.authentication.title') }}
|
{{ $t('views.system.authentication.title') }}
|
||||||
<el-button type="primary" link @click="router.push({ path: '' })">
|
<el-button type="primary" link @click="router.push({ path: '' })">
|
||||||
@ -88,18 +99,14 @@
|
|||||||
trigger: 'change',
|
trigger: 'change',
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
prop="checkList"
|
prop="authentication_value.login_value"
|
||||||
class="ml-24 border-t"
|
class="ml-24 border-t"
|
||||||
style="padding-top: 16px"
|
style="padding-top: 16px"
|
||||||
>
|
>
|
||||||
<el-checkbox-group v-model="form.checkList">
|
<el-checkbox-group v-model="form.authentication_value.login_value">
|
||||||
<el-checkbox label="账号登录" value="账号登录" />
|
<template v-for="t in auth_list" :key="t.value">
|
||||||
<el-checkbox label="LDAP" value="LDAP" />
|
<el-checkbox :label="t.label" :value="t.value" />
|
||||||
<el-checkbox label="OIDC" value="OIDC" />
|
</template>
|
||||||
<el-checkbox label="CAS" value="CAS" />
|
|
||||||
<el-checkbox label="企业微信" value="企业微信" />
|
|
||||||
<el-checkbox label="钉钉" value="钉钉" />
|
|
||||||
<el-checkbox label="飞书" value="飞书" />
|
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -146,13 +153,13 @@ const {
|
|||||||
} = route
|
} = route
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
const auth_list = ref<Array<{ label: string; value: string }>>([])
|
||||||
const limitFormRef = ref()
|
const limitFormRef = ref()
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
access_num: 0,
|
access_num: 0,
|
||||||
white_active: true,
|
white_active: true,
|
||||||
white_list: '',
|
white_list: '',
|
||||||
authentication_value: '',
|
authentication_value: {},
|
||||||
authentication: false,
|
authentication: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -168,7 +175,16 @@ watch(dialogVisible, (bool) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
watch(
|
||||||
|
() => form.authentication,
|
||||||
|
(b) => {
|
||||||
|
if (b) {
|
||||||
|
applicationApi.getChatUserAuthType().then((ok) => {
|
||||||
|
auth_list.value = ok.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
const open = (data: any) => {
|
const open = (data: any) => {
|
||||||
form.value.access_num = data.access_num
|
form.value.access_num = data.access_num
|
||||||
form.value.white_active = data.white_active
|
form.value.white_active = data.white_active
|
||||||
@ -176,6 +192,9 @@ const open = (data: any) => {
|
|||||||
form.value.authentication_value = data.authentication_value
|
form.value.authentication_value = data.authentication_value
|
||||||
form.value.authentication = data.authentication
|
form.value.authentication = data.authentication
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
applicationApi.getChatUserAuthType().then((ok) => {
|
||||||
|
auth_list.value = ok.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit = async (formEl: FormInstance | undefined) => {
|
const submit = async (formEl: FormInstance | undefined) => {
|
||||||
@ -207,7 +226,7 @@ function generateAuthenticationValue(length: number = 10) {
|
|||||||
.join('')
|
.join('')
|
||||||
}
|
}
|
||||||
function refreshAuthentication() {
|
function refreshAuthentication() {
|
||||||
form.value.authentication_value = generateAuthenticationValue()
|
form.value.authentication_value.password_value = generateAuthenticationValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
function firstGeneration() {
|
function firstGeneration() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user