Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/src/locales/lang/en-US/views/application-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ You are a master of problem optimization, adept at accurately inferring user int
label: 'IntentNode',
text: 'Match user questions with user-defined intent classifications',
other: 'other',
error2: 'Repeated intent',
placeholder: 'Please choose a classification option',
classify: {
label: 'Intent classify',
Expand Down
1 change: 1 addition & 0 deletions ui/src/locales/lang/zh-CN/views/application-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export default {
label: '意图识别',
text: '将用户问题与用户预设的意图分类进行匹配',
other: '其他',
error2: '意图重复',
placeholder: '请选择分类项',
classify: {
label: '意图分类',
Expand Down
1 change: 1 addition & 0 deletions ui/src/locales/lang/zh-Hant/views/application-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export default {
label: '意圖識別',
text: '將用戶問題與用戶預設的意圖分類進行匹配',
other: '其他',
error2: '意圖重複',
placeholder: '請選擇分類項',
classify: {
label: '意圖分類',
Expand Down
7 changes: 4 additions & 3 deletions ui/src/workflow/nodes/intent-classify-node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,20 @@ class IntentModel extends AppNodeModel {

if (branch_condition_list) {

const FORM_ITEMS_HEIGHT = 382 // 上方表单占用高度
const FORM_ITEMS_HEIGHT = 397 // 上方表单占用高度

for (let index = 0; index < branch_condition_list.length; index++) {
const element = branch_condition_list[index]
const h = get_up_index_height(branch_condition_list, index)

anchors.push({
x: x + width / 2 - 10,
y: showNode
? y - height / 2 + FORM_ITEMS_HEIGHT + h + element.height / 2
? y - height / 2 + FORM_ITEMS_HEIGHT + index *41.3
: y - 15,
id: `${id}_${element.id}_right`,
type: 'right'
})
console.log(y - height / 2 + FORM_ITEMS_HEIGHT + 100/ 2)
}
}
return anchors
Expand Down
23 changes: 16 additions & 7 deletions ui/src/workflow/nodes/intent-classify-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@
/>
</el-form-item>
<el-form-item
:rules="{
required: true,
trigger: 'change',
}"
>
<template #label>
<div class="flex-between">
Expand All @@ -111,8 +107,15 @@
<div>
<div
v-for="(item, index) in form_data.branch"
v-resize="(wh: any) => resizeBranch(wh, item, index)"
:key="item.id"
>
<el-form-item
:prop="`branch.${index}.content`"
:rules="{
message: $t('views.applicationWorkflow.nodes.intentNode.classify.placeholder'),
trigger: 'change',
required: true,
}"
>
<el-row class="mb-8" :gutter="12" align="middle">
<el-col :span="21">
Expand All @@ -129,7 +132,6 @@
<el-button
link
size="large"
class="mt-4"
v-if="!item.isOther"
:disabled="form_data.branch.filter((b: any) => !b.isOther).length <= 1"
@click="deleteClassifyBranch(item.id)"
Expand All @@ -138,6 +140,7 @@
</el-button>
</el-col>
</el-row>
</el-form-item>
</div>
</div>
</el-form-item>
Expand Down Expand Up @@ -187,6 +190,7 @@ function addClassfiyBranch() {
list.splice(list.length - 1, 0, obj)
refreshBranchAnchor(list, true)
set(props.nodeModel.properties.node_data, 'branch', list)
props.nodeModel.refreshBranch()
}

function deleteClassifyBranch(id: string) {
Expand Down Expand Up @@ -326,10 +330,15 @@ const IntentClassifyNodeFormRef = ref<FormInstance>()
const modelOptions = ref<any>(null)

const validate = () => {

return Promise.all([
nodeCascaderRef.value ? nodeCascaderRef.value.validate() : Promise.resolve(''),
IntentClassifyNodeFormRef.value?.validate(),
]).catch((err: any) => {
]).then(() => {
if (form_data.value.branch.length != new Set(form_data.value.branch.map((item: any) => item.content)).size) {
throw t('views.applicationWorkflow.nodes.intentNode.error2')
}
}).catch((err: any) => {
return Promise.reject({ node: props.nodeModel, errMessage: err })
})
}
Expand Down