diff --git a/ui/src/api/chat-user/chat-user-auth.ts b/ui/src/api/chat-user/chat-user-auth.ts new file mode 100644 index 00000000000..7612dd436bf --- /dev/null +++ b/ui/src/api/chat-user/chat-user-auth.ts @@ -0,0 +1,60 @@ +import {Result} from '@/request/Result' +import {get, post, put} from '@/request/index' +import {type Ref} from 'vue' + +const prefix = '/chat_user/auth' +/** + * 获取认证设置 + */ +const getAuthSetting: (auth_type: string, loading?: Ref) => Promise> = (auth_type, loading) => { + return get(`${prefix}/${auth_type}/detail`, undefined, loading) +} + +/** + * ldap连接测试 + */ +const postAuthSetting: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${prefix}/connection`, data, undefined, loading) +} + +/** + * 修改邮箱设置 + */ +const putAuthSetting: (auth_type: string, data: any, loading?: Ref) => Promise> = ( + auth_type, + data, + loading +) => { + return put(`${prefix}/${auth_type}/info`, data, undefined, loading) +} + +const platformPrefix = '/chat_user/auth/platform' +const getPlatformInfo: (loading?: Ref) => Promise> = (loading) => { + return get(`${platformPrefix}/source`, undefined, loading) +} + +const updateConfig: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${platformPrefix}/source`, data, undefined, loading) +} + +const validateConnection: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return put(`${platformPrefix}/source`, data, undefined, loading) +} + +export default { + getAuthSetting, + postAuthSetting, + putAuthSetting, + getPlatformInfo, + updateConfig, + validateConnection +} diff --git a/ui/src/components/workflow-dropdown-menu/default-model-setting/index.vue b/ui/src/components/workflow-dropdown-menu/default-model-setting/index.vue index a02099e2dc3..2a970f660f7 100644 --- a/ui/src/components/workflow-dropdown-menu/default-model-setting/index.vue +++ b/ui/src/components/workflow-dropdown-menu/default-model-setting/index.vue @@ -4,8 +4,13 @@ v-click-outside="handleClickOutside" class="default-model-setting-menu workflow-dropdown-menu border border-r-6 white-bg" > -
{{ $t('workflow.setting.defaultModelSetting') }}
- +
+

{{ $t('workflow.setting.defaultModelSetting') }}

+

+ {{ $t('workflow.setting.defaultModelSettingTip') }} +

+
+ @@ -78,11 +83,22 @@ const defaulTypeLabels: Record = { ITV: t('workflow.setting.modelType.ITV'), RERANKER: t('workflow.setting.modelType.RERANKER'), } -const defaultModelTypes = ['LLM', 'TTS', 'STT', 'IMAGE', 'TTI', 'TTV', 'ITV', 'RERANKER'].map((type) => ({ - type, - label: defaulTypeLabels[type] || type, -})) -const EMPTY_SETTING = { LLM: {}, TTS: {}, STT: {}, IMAGE: {}, TTI: {}, TTV: {}, ITV: {}, RERANKER: {} } +const defaultModelTypes = ['LLM', 'TTS', 'STT', 'IMAGE', 'TTI', 'TTV', 'ITV', 'RERANKER'].map( + (type) => ({ + type, + label: defaulTypeLabels[type] || type, + }), +) +const EMPTY_SETTING = { + LLM: {}, + TTS: {}, + STT: {}, + IMAGE: {}, + TTI: {}, + TTV: {}, + ITV: {}, + RERANKER: {}, +} const modelSetting = ref({ ...EMPTY_SETTING }) const defaultModelOptions = ref>({}) @@ -149,7 +165,8 @@ const hasChanges = computed( const base = (props.modelValue || {})[type] || {} return ( (cur.model_id || '') !== (base.model_id || '') || - JSON.stringify(cur.model_params_setting || {}) !== JSON.stringify(base.model_params_setting || {}) + JSON.stringify(cur.model_params_setting || {}) !== + JSON.stringify(base.model_params_setting || {}) ) }), ) @@ -172,11 +189,12 @@ function handleSave() { } function applyDefaultModelToAll() { - MsgConfirm( - t('workflow.setting.applyToAll'), - t('workflow.setting.applyToAllConfirmMsg'), - { type: 'warning', customClass: 'apply-to-all-confirm', center: true, confirmButtonText: t('workflow.setting.apply') }, - ).then(() => { + MsgConfirm(t('workflow.setting.applyToAll'), t('workflow.setting.applyToAllConfirmMsg'), { + type: 'warning', + customClass: 'apply-to-all-confirm', + center: true, + confirmButtonText: t('workflow.setting.apply'), + }).then(() => { const graph = props.workflowRef?.getGraphData() let count = 0 // 栈式遍历,循环节点内嵌 graph(loop_body)也入栈覆盖,与发布校验 validate_workflow_default_models 保持一致 diff --git a/ui/src/views/login/index.vue b/ui/src/views/login/index.vue index 70bcf5888d8..f5b6dd8b934 100644 --- a/ui/src/views/login/index.vue +++ b/ui/src/views/login/index.vue @@ -425,48 +425,7 @@ function changeMode(val: string, needMessage: boolean = true) { loginFormRef.value?.clearValidate() } -// onBeforeMount(() => { -// loading.value = true -// user.asyncGetProfile().then((res) => { -// // 企业版和专业版:第三方登录 -// if (user.isPE() || user.isEE()) { -// login -// .getAuthType() -// .then((res) => { -// //如果结果包含LDAP,把LDAP放在第一个 -// const ldapIndex = res.indexOf('LDAP') -// if (ldapIndex !== -1) { -// const [ldap] = res.splice(ldapIndex, 1) -// res.unshift(ldap) -// } -// modeList.value = [...modeList.value, ...res] -// }) -// .finally(() => (loading.value = false)) -// login -// .getQrType() -// .then((res) => { -// if (res.length > 0) { -// modeList.value = ['QR_CODE', ...modeList.value] -// QrList.value = res -// QrList.value.forEach((item) => { -// orgOptions.value.push({ -// key: item, -// value: -// item === 'wecom' -// ? t('views.system.authentication.scanTheQRCode.wecom') -// : item === 'dingtalk' -// ? t('views.system.authentication.scanTheQRCode.dingtalk') -// : t('views.system.authentication.scanTheQRCode.lark'), -// }) -// }) -// } -// }) -// .finally(() => (loading.value = false)) -// } else { -// loading.value = false -// } -// }) -// }) + declare const window: any onMounted(() => { diff --git a/ui/src/views/system/user-manage/component/UserDrawer.vue b/ui/src/views/system/user-manage/component/UserDrawer.vue index 2796c3f6673..f5e9704dde3 100644 --- a/ui/src/views/system/user-manage/component/UserDrawer.vue +++ b/ui/src/views/system/user-manage/component/UserDrawer.vue @@ -1,5 +1,10 @@