diff --git a/apps/application/serializers/application_access_token.py b/apps/application/serializers/application_access_token.py index b0f6290b656..cf5f37a1ec5 100644 --- a/apps/application/serializers/application_access_token.py +++ b/apps/application/serializers/application_access_token.py @@ -33,6 +33,8 @@ class AccessTokenEditSerializer(serializers.Serializer): label=_("Whitelist")), show_source = serializers.BooleanField(required=False, 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, label=_("language")) authentication = serializers.BooleanField(default=False, label="Do you need authentication") @@ -60,6 +62,8 @@ def edit(self, instance): application_access_token.white_list = instance.get('white_list') if 'show_source' in instance and instance.get('show_source') is not None: 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: application_access_token.language = instance.get('language') if 'language' not in instance or instance.get('language') is None: diff --git a/apps/locales/en_US/LC_MESSAGES/django.po b/apps/locales/en_US/LC_MESSAGES/django.po index cea4575e5d1..51ca094f940 100644 --- a/apps/locales/en_US/LC_MESSAGES/django.po +++ b/apps/locales/en_US/LC_MESSAGES/django.po @@ -8348,4 +8348,16 @@ msgid "Update appearance settings" msgstr "" msgid "Application Access" -msgstr "" \ No newline at end of file +msgstr "" + +msgid "Display execution details" +msgstr "" + +msgid "LOCAL" +msgstr "Account login" + +msgid "CAS" +msgstr "CAS" + +msgid "LDAP" +msgstr "LDAP" \ No newline at end of file diff --git a/apps/locales/zh_CN/LC_MESSAGES/django.po b/apps/locales/zh_CN/LC_MESSAGES/django.po index a7aff262f21..834710b9491 100644 --- a/apps/locales/zh_CN/LC_MESSAGES/django.po +++ b/apps/locales/zh_CN/LC_MESSAGES/django.po @@ -8474,4 +8474,16 @@ msgid "Update appearance settings" msgstr "更新外观设置" msgid "Application Access" -msgstr "应用接入" \ No newline at end of file +msgstr "应用接入" + +msgid "Display execution details" +msgstr "是否显示执行详情" + +msgid "LOCAL" +msgstr "账号登录" + +msgid "CAS" +msgstr "CAS" + +msgid "LDAP" +msgstr "LDAP" \ No newline at end of file diff --git a/apps/locales/zh_Hant/LC_MESSAGES/django.po b/apps/locales/zh_Hant/LC_MESSAGES/django.po index 16fe0fdeb38..cf851ca9e4f 100644 --- a/apps/locales/zh_Hant/LC_MESSAGES/django.po +++ b/apps/locales/zh_Hant/LC_MESSAGES/django.po @@ -8474,4 +8474,16 @@ msgid "Update appearance settings" msgstr "更新外觀設置" msgid "Application Access" -msgstr "應用介入" \ No newline at end of file +msgstr "應用介入" + +msgid "Display execution details" +msgstr "是否顯示執行詳情" + +msgid "LOCAL" +msgstr "帳號登入" + +msgid "CAS" +msgstr "CAS" + +msgid "LDAP" +msgstr "LDAP" \ No newline at end of file diff --git a/ui/src/api/application/application.ts b/ui/src/api/application/application.ts index e0c852cf74e..8811cf5e480 100644 --- a/ui/src/api/application/application.ts +++ b/ui/src/api/application/application.ts @@ -92,6 +92,18 @@ const getAccessToken: (application_id: string, loading?: Ref) => Promis ) => { return get(`${prefix.value}/${application_id}/access_token`, undefined, loading) } +/** + * 获取应用设置 + * @param application_id 应用id + * @param loading 加载器 + * @returns + */ +const getApplicationSetting: ( + application_id: string, + loading?: Ref, +) => Promise> = (application_id, loading) => { + return get(`${prefix.value}/${application_id}/setting`, undefined, loading) +} /** * 修改AccessToken @@ -167,7 +179,14 @@ const open: (application_id: string, loading?: Ref) => Promise Promise = (chat_id, data) => { return postStream(`/api/chat_message/${chat_id}`, data) } - +/** + * 获取对话用户认证类型 + * @param loading 加载器 + * @returns + */ +const getChatUserAuthType: (loading?: Ref) => Promise = (loading) => { + return get(`/chat_user/auth/types`, {}, loading) +} export default { getAllApplication, getApplication, @@ -182,4 +201,6 @@ export default { getStatistics, open, chat, + getChatUserAuthType, + getApplicationSetting, } diff --git a/ui/src/views/application-overview/index.vue b/ui/src/views/application-overview/index.vue index 831799b21ba..61f76a4cebc 100644 --- a/ui/src/views/application-overview/index.vue +++ b/ui/src/views/application-overview/index.vue @@ -331,7 +331,13 @@ function openDisplaySettingDialog() { currentDisplaySettingDialog.value = DisplaySettingDialog } 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) + } }) } diff --git a/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue b/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue index 3292265cf64..fa44ecbe7f9 100644 --- a/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue +++ b/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue @@ -30,8 +30,16 @@ - - + +

{{ $t('views.applicationOverview.appInfo.LimitDialog.authenticationValue') }} @@ -40,7 +48,7 @@ @@ -69,9 +77,12 @@ - - - + +

{{ $t('views.system.authentication.title') }} @@ -88,18 +99,14 @@ trigger: 'change', }, ]" - prop="checkList" + prop="authentication_value.login_value" class="ml-24 border-t" style="padding-top: 16px" > - - - - - - - - + + @@ -146,13 +153,13 @@ const { } = route const emit = defineEmits(['refresh']) - +const auth_list = ref>([]) const limitFormRef = ref() const form = ref({ access_num: 0, white_active: true, white_list: '', - authentication_value: '', + authentication_value: {}, 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) => { form.value.access_num = data.access_num 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 = data.authentication dialogVisible.value = true + applicationApi.getChatUserAuthType().then((ok) => { + auth_list.value = ok.data + }) } const submit = async (formEl: FormInstance | undefined) => { @@ -207,7 +226,7 @@ function generateAuthenticationValue(length: number = 10) { .join('') } function refreshAuthentication() { - form.value.authentication_value = generateAuthenticationValue() + form.value.authentication_value.password_value = generateAuthenticationValue() } function firstGeneration() {