Skip to content

Commit 3e8bf8a

Browse files
committed
fix: Intent node
--bug=1062137 --user=张展玮 【应用】意图识别节点存在空的意图项,可以发布应用成功 https://www.tapd.cn/62980211/s/1779110
1 parent 82fdef1 commit 3e8bf8a

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

ui/src/locales/lang/en-US/views/application-workflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ You are a master of problem optimization, adept at accurately inferring user int
341341
label: 'IntentNode',
342342
text: 'Match user questions with user-defined intent classifications',
343343
other: 'other',
344+
error2: 'Repeated intent',
344345
placeholder: 'Please choose a classification option',
345346
classify: {
346347
label: 'Intent classify',

ui/src/locales/lang/zh-CN/views/application-workflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ export default {
341341
label: '意图识别',
342342
text: '将用户问题与用户预设的意图分类进行匹配',
343343
other: '其他',
344+
error2: '意图重复',
344345
placeholder: '请选择分类项',
345346
classify: {
346347
label: '意图分类',

ui/src/locales/lang/zh-Hant/views/application-workflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ export default {
334334
label: '意圖識別',
335335
text: '將用戶問題與用戶預設的意圖分類進行匹配',
336336
other: '其他',
337+
error2: '意圖重複',
337338
placeholder: '請選擇分類項',
338339
classify: {
339340
label: '意圖分類',

ui/src/workflow/nodes/intent-classify-node/index.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@
9090
/>
9191
</el-form-item>
9292
<el-form-item
93-
:rules="{
94-
required: true,
95-
trigger: 'change',
96-
}"
9793
>
9894
<template #label>
9995
<div class="flex-between">
@@ -113,6 +109,14 @@
113109
v-for="(item, index) in form_data.branch"
114110
v-resize="(wh: any) => resizeBranch(wh, item, index)"
115111
:key="item.id"
112+
>
113+
<el-form-item
114+
:prop="`branch.${index}.content`"
115+
:rules="{
116+
message: $t('views.applicationWorkflow.nodes.intentNode.classify.placeholder'),
117+
trigger: 'change',
118+
required: true,
119+
}"
116120
>
117121
<el-row class="mb-8" :gutter="12" align="middle">
118122
<el-col :span="21">
@@ -138,6 +142,7 @@
138142
</el-button>
139143
</el-col>
140144
</el-row>
145+
</el-form-item>
141146
</div>
142147
</div>
143148
</el-form-item>
@@ -326,10 +331,15 @@ const IntentClassifyNodeFormRef = ref<FormInstance>()
326331
const modelOptions = ref<any>(null)
327332
328333
const validate = () => {
334+
329335
return Promise.all([
330336
nodeCascaderRef.value ? nodeCascaderRef.value.validate() : Promise.resolve(''),
331337
IntentClassifyNodeFormRef.value?.validate(),
332-
]).catch((err: any) => {
338+
]).then(() => {
339+
if (form_data.value.branch.length != new Set(form_data.value.branch.map((item: any) => item.content)).size) {
340+
throw t('views.applicationWorkflow.nodes.intentNode.error2')
341+
}
342+
}).catch((err: any) => {
333343
return Promise.reject({ node: props.nodeModel, errMessage: err })
334344
})
335345
}

0 commit comments

Comments
 (0)