fix: STT node

--bug=1062113 --user=张展玮 【应用】语音转文本节点,没有支持模型参数设置 https://www.tapd.cn/62980211/s/1778991
This commit is contained in:
zhangzhanwei 2025-09-25 16:01:03 +08:00 committed by zhanweizhang7
parent 7baedb9b1c
commit 414756eade
2 changed files with 41 additions and 4 deletions

View File

@ -71,7 +71,7 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
.getModelParamsForm(model_id, loading)
.then(( ok: any ) => {
model_form_field.value = ok.data
const res = ok.data
const resp = ok.data
.map((item: any) => ({
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
}))
@ -79,12 +79,12 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
if (model_setting_data) {
Object.keys(model_setting_data).forEach((key) => {
if (!(key in res)) {
if (!(key in resp)) {
delete model_setting_data[key]
}
})
}
model_setting_data = { ...res, ...model_setting_data }
model_setting_data = { ...resp, ...model_setting_data }
//
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
})

View File

@ -28,6 +28,15 @@
}}<span class="color-danger">*</span></span
>
</div>
<el-button
type="primary"
link
@click="openSTTParamSettingDialog"
:disabled="!form_data.stt_model_id"
class="mr-4"
>
<AppIcon iconName="app-setting"></AppIcon>
</el-button>
</div>
</template>
<ModelSelect
@ -91,6 +100,7 @@
</el-form-item>
</el-form>
</el-card>
<STTModeParamSettingDialog ref="STTModeParamSettingDialogRef" @refresh="refreshSTTForm" />
</NodeContainer>
</template>
@ -100,12 +110,17 @@ import { computed, onMounted, ref, inject } from 'vue'
import { groupBy, set } from 'lodash'
import NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus'
import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales'
import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import STTModeParamSettingDialog from '@/views/application/component/STTModelParamSettingDialog.vue'
const getApplicationDetail = inject('getApplicationDetail') as any
const route = useRoute()
const {} = route as any
const {
params: { id },
} = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
@ -117,6 +132,8 @@ const apiType = computed(() => {
const props = defineProps<{ nodeModel: any }>()
const modelOptions = ref<any>(null)
const STTModeParamSettingDialogRef = ref<InstanceType<typeof STTModeParamSettingDialog>>()
const aiChatNodeFormRef = ref<FormInstance>()
const nodeCascaderRef = ref()
@ -143,6 +160,7 @@ const form = {
stt_model_id: '',
is_result: true,
audio_list: [],
model_params_setting: {},
}
const form_data = computed({
@ -159,6 +177,25 @@ const form_data = computed({
},
})
const openSTTParamSettingDialog = () => {
const model_id = form_data.value.stt_model_id
if (!model_id) {
MsgSuccess(t('views.application.form.voiceInput.requiredMessage'))
return
}
STTModeParamSettingDialogRef.value?.open(
model_id,
id,
form_data.value.model_params_setting,
)
}
const refreshSTTForm = (data: any) => {
form_data.value.model_params_setting = data
}
const application = getApplicationDetail()
function getSelectModel() {
const obj =