Skip to content

Commit

Permalink
refactor: 增加应用不选择语音模型报错提示
Browse files Browse the repository at this point in the history
--bug=1046729 --user=刘瑞斌 【应用】应用语音播放选择模型播放后,不选择具体的模型,点击播放按钮没有反应 https://www.tapd.cn/57709429/s/1581681
  • Loading branch information
liuruibin committed Sep 19, 2024
1 parent dc71d55 commit 14bf09c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ui/src/views/application/ApplicationSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ import type { FormInstance, FormRules } from 'element-plus'
import type { ApplicationFormType } from '@/api/type/application'
import type { Provider } from '@/api/type/model'
import { relatedObject } from '@/utils/utils'
import { MsgSuccess } from '@/utils/message'
import { MsgSuccess, MsgWarning } from '@/utils/message'
import useStore from '@/stores'
import { t } from '@/locales'
Expand Down Expand Up @@ -634,6 +634,14 @@ function submitSystemDialog(val: string) {
}
const submit = async (formEl: FormInstance | undefined) => {
if (applicationForm.value.tts_model_enable && !applicationForm.value.tts_model_id && applicationForm.value.tts_type === 'TTS') {
MsgWarning(t('请选择语音播放模型'))
return
}
if (applicationForm.value.stt_model_enable && !applicationForm.value.stt_model_id) {
MsgWarning(t('请选择语音输入模型'))
return
}
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
Expand Down
10 changes: 9 additions & 1 deletion ui/src/workflow/nodes/base-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ import useStore from '@/stores'
import applicationApi from '@/api/application'
import type { Provider } from '@/api/type/model'
import FieldFormDialog from './component/FieldFormDialog.vue'
import { MsgError } from '@/utils/message'
import { MsgError, MsgWarning } from '@/utils/message'
import { t } from '@/locales'
const { model } = useStore()
Expand Down Expand Up @@ -308,6 +308,14 @@ const form_data = computed({
const baseNodeFormRef = ref<FormInstance>()
const validate = () => {
if (form_data.value.tts_model_enable && !form_data.value.tts_model_id && form_data.value.tts_type === 'TTS') {
MsgWarning(t('请选择语音播放模型'))
return
}
if (form_data.value.stt_model_enable && !form_data.value.stt_model_id) {
MsgWarning(t('请选择语音输入模型'))
return
}
return baseNodeFormRef.value?.validate().catch((err) => {
return Promise.reject({ node: props.nodeModel, errMessage: err })
})
Expand Down

0 comments on commit 14bf09c

Please sign in to comment.