Skip to content

Commit 8a1506f

Browse files
committed
fix: add focus event to ModelSelect for dynamic model fetching
--bug=1062087 --user=王孝刚 【应用编排】在图片生成节点-选择模型下拉框中添加模型后,没有及时回显 https://www.tapd.cn/62980211/s/1777730
1 parent 716f2a4 commit 8a1506f

File tree

2 files changed

+36
-27
lines changed

2 files changed

+36
-27
lines changed

ui/src/workflow/nodes/image-to-video/index.vue

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
<div class="flex-between w-full">
2525
<div>
2626
<span
27-
>{{ $t('views.applicationWorkflow.nodes.imageToVideoGenerate.model.label')
27+
>{{
28+
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.model.label')
2829
}}<span class="color-danger">*</span></span
2930
>
3031
</div>
@@ -45,6 +46,7 @@
4546
@wheel="wheel"
4647
:teleported="false"
4748
v-model="form_data.model_id"
49+
@focus="getSelectModel"
4850
:placeholder="
4951
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.model.requiredMessage')
5052
"
@@ -67,13 +69,14 @@
6769
<div class="flex align-center">
6870
<div class="mr-4">
6971
<span
70-
>{{ $t('views.applicationWorkflow.nodes.imageToVideoGenerate.prompt.label')
72+
>{{
73+
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.prompt.label')
7174
}}<span class="color-danger">*</span></span
7275
>
7376
</div>
7477
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
7578
<template #content
76-
>{{ $t('views.applicationWorkflow.nodes.imageToVideoGenerate.prompt.tooltip') }}
79+
>{{ $t('views.applicationWorkflow.nodes.imageToVideoGenerate.prompt.tooltip') }}
7780
</template>
7881
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
7982
</el-tooltip>
@@ -100,12 +103,12 @@
100103
<div class="flex align-center">
101104
<div class="mr-4">
102105
<span>{{
103-
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.negative_prompt.label')
104-
}}</span>
106+
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.negative_prompt.label')
107+
}}</span>
105108
</div>
106109
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
107110
<template #content
108-
>{{
111+
>{{
109112
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.negative_prompt.tooltip')
110113
}}
111114
</template>
@@ -136,7 +139,8 @@
136139
}"
137140
>
138141
<template #label
139-
>{{ $t('views.applicationWorkflow.nodes.imageToVideoGenerate.first_frame.label')
142+
>{{
143+
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.first_frame.label')
140144
}}<span class="color-danger">*</span></template
141145
>
142146
<NodeCascader
@@ -161,8 +165,10 @@
161165
}"
162166
>
163167
<template #label
164-
>{{ $t('views.applicationWorkflow.nodes.imageToVideoGenerate.last_frame.label')
165-
}}</template
168+
>{{
169+
$t('views.applicationWorkflow.nodes.imageToVideoGenerate.last_frame.label')
170+
}}
171+
</template
166172
>
167173
<NodeCascader
168174
ref="nodeCascaderRef"
@@ -183,8 +189,8 @@
183189
<div class="flex align-center">
184190
<div class="mr-4">
185191
<span>{{
186-
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
187-
}}</span>
192+
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
193+
}}</span>
188194
</div>
189195
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
190196
<template #content>
@@ -194,29 +200,30 @@
194200
</el-tooltip>
195201
</div>
196202
</template>
197-
<el-switch size="small" v-model="form_data.is_result" />
203+
<el-switch size="small" v-model="form_data.is_result"/>
198204
</el-form-item>
199205
</el-form>
200206
</el-card>
201-
<AIModeParamSettingDialog ref="AIModeParamSettingDialogRef" @refresh="refreshParam" />
207+
<AIModeParamSettingDialog ref="AIModeParamSettingDialogRef" @refresh="refreshParam"/>
202208
</NodeContainer>
203209
</template>
204210

205211
<script setup lang="ts">
206212
import NodeContainer from '@/workflow/common/NodeContainer.vue'
207-
import { computed, nextTick, onMounted, ref, inject } from 'vue'
208-
import { groupBy, set } from 'lodash'
209-
import type { FormInstance } from 'element-plus'
213+
import {computed, nextTick, onMounted, ref, inject} from 'vue'
214+
import {groupBy, set} from 'lodash'
215+
import type {FormInstance} from 'element-plus'
210216
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
211-
import { t } from '@/locales'
212-
import { useRoute } from 'vue-router'
213-
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
217+
import {t} from '@/locales'
218+
import {useRoute} from 'vue-router'
219+
import {loadSharedApi} from '@/utils/dynamics-api/shared-api'
214220
import NodeCascader from "@/workflow/common/NodeCascader.vue";
221+
215222
const getApplicationDetail = inject('getApplicationDetail') as any
216223
const route = useRoute()
217224
218225
const {
219-
params: { id },
226+
params: {id},
220227
} = route as any
221228
222229
const apiType = computed(() => {
@@ -234,7 +241,7 @@ const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDi
234241
const aiChatNodeFormRef = ref<FormInstance>()
235242
const validate = () => {
236243
return aiChatNodeFormRef.value?.validate().catch((err) => {
237-
return Promise.reject({ node: props.nodeModel, errMessage: err })
244+
return Promise.reject({node: props.nodeModel, errMessage: err})
238245
})
239246
}
240247
@@ -279,17 +286,18 @@ const form_data = computed({
279286
})
280287
281288
const application = getApplicationDetail()
289+
282290
function getSelectModel() {
283291
const obj =
284292
apiType.value === 'systemManage'
285293
? {
286-
model_type: 'ITV',
287-
workspace_id: application.value?.workspace_id,
288-
}
294+
model_type: 'ITV',
295+
workspace_id: application.value?.workspace_id,
296+
}
289297
: {
290-
model_type: 'ITV',
291-
}
292-
loadSharedApi({ type: 'model', systemType: apiType.value })
298+
model_type: 'ITV',
299+
}
300+
loadSharedApi({type: 'model', systemType: apiType.value})
293301
.getSelectModelList(obj)
294302
.then((res: any) => {
295303
modelOptions.value = groupBy(res?.data, 'provider')

ui/src/workflow/nodes/text-to-video/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<ModelSelect
4444
@change="model_change"
4545
@wheel="wheel"
46+
@focus="getSelectModel"
4647
:teleported="false"
4748
v-model="form_data.model_id"
4849
:placeholder="

0 commit comments

Comments
 (0)