fix: STT node
--bug=1062113 --user=张展玮 【应用】语音转文本节点,没有支持模型参数设置 https://www.tapd.cn/62980211/s/1778991v3.2
parent
7baedb9b1c
commit
414756eade
|
|
@ -71,7 +71,7 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
|
||||||
.getModelParamsForm(model_id, loading)
|
.getModelParamsForm(model_id, loading)
|
||||||
.then(( ok: any ) => {
|
.then(( ok: any ) => {
|
||||||
model_form_field.value = ok.data
|
model_form_field.value = ok.data
|
||||||
const res = ok.data
|
const resp = ok.data
|
||||||
.map((item: any) => ({
|
.map((item: any) => ({
|
||||||
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
|
[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) {
|
if (model_setting_data) {
|
||||||
Object.keys(model_setting_data).forEach((key) => {
|
Object.keys(model_setting_data).forEach((key) => {
|
||||||
if (!(key in res)) {
|
if (!(key in resp)) {
|
||||||
delete model_setting_data[key]
|
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)
|
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,15 @@
|
||||||
}}<span class="color-danger">*</span></span
|
}}<span class="color-danger">*</span></span
|
||||||
>
|
>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<ModelSelect
|
<ModelSelect
|
||||||
|
|
@ -91,6 +100,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<STTModeParamSettingDialog ref="STTModeParamSettingDialogRef" @refresh="refreshSTTForm" />
|
||||||
</NodeContainer>
|
</NodeContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -100,12 +110,17 @@ import { computed, onMounted, ref, inject } from 'vue'
|
||||||
import { groupBy, set } from 'lodash'
|
import { groupBy, set } from 'lodash'
|
||||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||||
import type { FormInstance } from 'element-plus'
|
import type { FormInstance } from 'element-plus'
|
||||||
|
import { MsgSuccess } from '@/utils/message'
|
||||||
|
import { t } from '@/locales'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
|
import STTModeParamSettingDialog from '@/views/application/component/STTModelParamSettingDialog.vue'
|
||||||
const getApplicationDetail = inject('getApplicationDetail') as any
|
const getApplicationDetail = inject('getApplicationDetail') as any
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const {} = route as any
|
const {
|
||||||
|
params: { id },
|
||||||
|
} = route as any
|
||||||
|
|
||||||
const apiType = computed(() => {
|
const apiType = computed(() => {
|
||||||
if (route.path.includes('resource-management')) {
|
if (route.path.includes('resource-management')) {
|
||||||
|
|
@ -117,6 +132,8 @@ const apiType = computed(() => {
|
||||||
|
|
||||||
const props = defineProps<{ nodeModel: any }>()
|
const props = defineProps<{ nodeModel: any }>()
|
||||||
const modelOptions = ref<any>(null)
|
const modelOptions = ref<any>(null)
|
||||||
|
const STTModeParamSettingDialogRef = ref<InstanceType<typeof STTModeParamSettingDialog>>()
|
||||||
|
|
||||||
|
|
||||||
const aiChatNodeFormRef = ref<FormInstance>()
|
const aiChatNodeFormRef = ref<FormInstance>()
|
||||||
const nodeCascaderRef = ref()
|
const nodeCascaderRef = ref()
|
||||||
|
|
@ -143,6 +160,7 @@ const form = {
|
||||||
stt_model_id: '',
|
stt_model_id: '',
|
||||||
is_result: true,
|
is_result: true,
|
||||||
audio_list: [],
|
audio_list: [],
|
||||||
|
model_params_setting: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
const form_data = computed({
|
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()
|
const application = getApplicationDetail()
|
||||||
function getSelectModel() {
|
function getSelectModel() {
|
||||||
const obj =
|
const obj =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue