Skip to content

Commit ff93fb0

Browse files
committed
fix: STT node
--bug=1062113 --user=张展玮 【应用】语音转文本节点,没有支持模型参数设置 https://www.tapd.cn/62980211/s/1778991
1 parent 9b00b85 commit ff93fb0

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

ui/src/views/application/component/STTModelParamSettingDialog.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,20 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
7171
.getModelParamsForm(model_id, loading)
7272
.then(( ok: any ) => {
7373
model_form_field.value = ok.data
74-
const res = ok.data
74+
const resp = ok.data
7575
.map((item: any) => ({
7676
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
7777
}))
7878
.reduce((x: any, y: any) => ({ ...x, ...y }), {})
7979
8080
if (model_setting_data) {
8181
Object.keys(model_setting_data).forEach((key) => {
82-
if (!(key in res)) {
82+
if (!(key in resp)) {
8383
delete model_setting_data[key]
8484
}
8585
})
8686
}
87-
model_setting_data = { ...res, ...model_setting_data }
87+
model_setting_data = { ...resp, ...model_setting_data }
8888
// 渲染动态表单
8989
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
9090
})

ui/src/workflow/nodes/speech-to-text-node/index.vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
}}<span class="color-danger">*</span></span
2929
>
3030
</div>
31+
<el-button
32+
type="primary"
33+
link
34+
@click="openSTTParamSettingDialog"
35+
:disabled="!form_data.stt_model_id"
36+
class="mr-4"
37+
>
38+
<AppIcon iconName="app-setting"></AppIcon>
39+
</el-button>
3140
</div>
3241
</template>
3342
<ModelSelect
@@ -91,6 +100,7 @@
91100
</el-form-item>
92101
</el-form>
93102
</el-card>
103+
<STTModeParamSettingDialog ref="STTModeParamSettingDialogRef" @refresh="refreshSTTForm" />
94104
</NodeContainer>
95105
</template>
96106

@@ -100,12 +110,17 @@ import { computed, onMounted, ref, inject } from 'vue'
100110
import { groupBy, set } from 'lodash'
101111
import NodeCascader from '@/workflow/common/NodeCascader.vue'
102112
import type { FormInstance } from 'element-plus'
113+
import { MsgSuccess } from '@/utils/message'
114+
import { t } from '@/locales'
103115
import { useRoute } from 'vue-router'
104116
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
117+
import STTModeParamSettingDialog from '@/views/application/component/STTModelParamSettingDialog.vue'
105118
const getApplicationDetail = inject('getApplicationDetail') as any
106119
const route = useRoute()
107120
108-
const {} = route as any
121+
const {
122+
params: { id },
123+
} = route as any
109124
110125
const apiType = computed(() => {
111126
if (route.path.includes('resource-management')) {
@@ -117,6 +132,8 @@ const apiType = computed(() => {
117132
118133
const props = defineProps<{ nodeModel: any }>()
119134
const modelOptions = ref<any>(null)
135+
const STTModeParamSettingDialogRef = ref<InstanceType<typeof STTModeParamSettingDialog>>()
136+
120137
121138
const aiChatNodeFormRef = ref<FormInstance>()
122139
const nodeCascaderRef = ref()
@@ -143,6 +160,7 @@ const form = {
143160
stt_model_id: '',
144161
is_result: true,
145162
audio_list: [],
163+
model_params_setting: {},
146164
}
147165
148166
const form_data = computed({
@@ -159,6 +177,25 @@ const form_data = computed({
159177
},
160178
})
161179
180+
181+
const openSTTParamSettingDialog = () => {
182+
const model_id = form_data.value.stt_model_id
183+
if (!model_id) {
184+
MsgSuccess(t('views.application.form.voiceInput.requiredMessage'))
185+
return
186+
}
187+
STTModeParamSettingDialogRef.value?.open(
188+
model_id,
189+
id,
190+
form_data.value.model_params_setting,
191+
)
192+
}
193+
194+
const refreshSTTForm = (data: any) => {
195+
form_data.value.model_params_setting = data
196+
}
197+
198+
162199
const application = getApplicationDetail()
163200
function getSelectModel() {
164201
const obj =

0 commit comments

Comments
 (0)