fix: The intention is to identify the display issue of the node

This commit is contained in:
wangdan-fit2cloud 2025-09-19 17:55:02 +08:00
parent eb6873c329
commit 5328757521
2 changed files with 71 additions and 66 deletions

View File

@ -21,7 +21,8 @@
data.type === WorkflowType.AiChat ||
data.type === WorkflowType.ImageUnderstandNode ||
data.type === WorkflowType.ImageGenerateNode ||
data.type === WorkflowType.Application
data.type === WorkflowType.Application ||
data.type == WorkflowType.IntentNode
"
>{{ data?.message_tokens + data?.answer_tokens }} tokens</span
>
@ -168,7 +169,7 @@
</div>
</div>
</template>
<!-- AI 对话 / 问题优化-->
<!-- AI 对话 / 问题优化 / 意图识别-->
<template
v-if="
data.type == WorkflowType.AiChat ||
@ -808,7 +809,11 @@
<span class="color-secondary">
{{ $t('views.applicationWorkflow.nodes.loopNode.loopArray.label') }}:</span
>
{{ data.loop_type === 'NUMBER' ? data.number : Object.keys(data.loop_node_data) || '-' }}
{{
data.loop_type === 'NUMBER'
? data.number
: Object.keys(data.loop_node_data) || '-'
}}
</div>
</div>
<h5 class="p-8-12">

View File

@ -53,8 +53,8 @@
</el-form-item>
<el-form-item
prop="content_list"
:label="$t('views.applicationWorkflow.nodes.intentNode.input.label')"
:rules="{
:label="$t('views.applicationWorkflow.nodes.intentNode.input.label')"
:rules="{
required: true,
trigger: 'change',
}"
@ -76,7 +76,6 @@
:placeholder="$t('views.applicationWorkflow.nodes.textToSpeechNode.content.label')"
v-model="form_data.content_list"
/>
</el-form-item>
<el-form-item :label="$t('views.application.form.historyRecord.label')">
<el-input-number
@ -89,53 +88,57 @@
:step-strictly="true"
/>
</el-form-item>
<el-form-item
:label="$t('views.applicationWorkflow.nodes.intentNode.classify.label')"
:rules="{
required: true,
trigger: 'change',
}"
>
<template #label>
<div class="flex-between">
<div>
<span>{{ $t('views.applicationWorkflow.nodes.intentNode.input.label') }}<span class="color-danger">*</span></span>
</div>
<el-button
@click="addClassfiyBranch"
type="primary"
size="large"
link>
<el-icon><Plus /></el-icon>
</el-button>
</div>
</template>
<div>
<div v-for="(item,index) in form_data.branch"
v-resize="(wh: any) => resizeBranch(wh, item, index)"
:key="item.id">
<el-form-item
:rules="{
required: true,
trigger: 'change',
}"
>
<template #label>
<div class="flex-between">
<div>
<span
>{{ $t('views.applicationWorkflow.nodes.intentNode.classify.label')
}}<span class="color-danger">*</span></span
>
</div>
<el-button @click="addClassfiyBranch" type="primary" size="large" link>
<el-icon><Plus /></el-icon>
</el-button>
</div>
</template>
<div>
<div
v-for="(item, index) in form_data.branch"
v-resize="(wh: any) => resizeBranch(wh, item, index)"
:key="item.id"
>
<el-row class="mb-8" :gutter="12" align="middle">
<el-col :span="21">
<el-input
v-model="item.content"
style="width: 210px"
:disabled="item.isOther"
:placeholder="$t('views.applicationWorkflow.nodes.intentNode.classify.placeholder')" />
<el-input
v-model="item.content"
style="width: 210px"
:disabled="item.isOther"
:placeholder="
$t('views.applicationWorkflow.nodes.intentNode.classify.placeholder')
"
/>
</el-col>
<el-col :span="3">
<el-button
link
<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)">
<el-icon><Delete /></el-icon>
class="mt-4"
v-if="!item.isOther"
:disabled="form_data.branch.filter((b: any) => !b.isOther).length <= 1"
@click="deleteClassifyBranch(item.id)"
>
<el-icon><Delete /></el-icon>
</el-button>
</el-col>
</el-row>
</div>
</div>
</el-row>
</div>
</div>
</el-form-item>
</el-form>
</el-card>
@ -176,16 +179,15 @@ const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDi
function addClassfiyBranch() {
const list = cloneDeep(props.nodeModel.properties.node_data.branch)
const obj = {
id: randomId(),
content: '',
isOther: false ,
id: randomId(),
content: '',
isOther: false,
}
list.splice(list.length - 1, 0 , obj)
list.splice(list.length - 1, 0, obj)
refreshBranchAnchor(list, true)
set(props.nodeModel.properties.node_data, 'branch', list)
}
function deleteClassifyBranch(id: string) {
const list = cloneDeep(props.nodeModel.properties.node_data.branch)
@ -194,19 +196,19 @@ function deleteClassifyBranch(id: string) {
return
}
const commonItems = list.filter((item:any) => !item.isOther)
const commonItems = list.filter((item: any) => !item.isOther)
if (commonItems.length <= 1) {
return
return
}
// 线
const delete_anchor_id = `${props.nodeModel.id}_${id}_right`
const edgetToDelete = (props.nodeModel.outgoing?.edges || [])
.filter((edge: any) => edge.sourceAnchorId === delete_anchor_id)
.map((edge: any) => edge.id)
if (edgetToDelete.length > 0) {
props.nodeModel.graphModel.eventCenter.emit('delete_edge', edgetToDelete)
}
}
const newList = list.filter((item: any) => item.id !== id) //
@ -225,19 +227,19 @@ function refreshBranchAnchor(list: Array<any>, is_add: boolean) {
.map((item, index) => {
const exist = branch_condition_list.find((b: any) => b.id === item.id)
if (exist) {
return {index: index, height: exist.height, id: item.id}
return { index: index, height: exist.height, id: item.id }
} else {
if (is_add) {
return {index: index, height: 12, id: item.id}
return { index: index, height: 12, id: item.id }
}
}
})
})
.filter((item) => item)
set(props.nodeModel.properties, 'branch_condition_list', new_branch_condition_list)
props.nodeModel.refreshBranch()
}
const resizeBranch = (wh: any, row: any, index: number) => {
const branch_condition_list = cloneDeep(
props.nodeModel.properties.branch_condition_list
@ -249,16 +251,15 @@ const resizeBranch = (wh: any, row: any, index: number) => {
return {
...item,
height: wh.height, //
index: index
index: index,
}
}
return item
})
set(props.nodeModel.properties, 'branch_condition_list', new_branch_condition_list)
refreshBranchAnchor(props.nodeModel.properties.node_data.branch, true)
refreshBranchAnchor(props.nodeModel.properties.node_data.branch, true)
}
const wheel = (e: any) => {
if (e.ctrlKey === true) {
e.preventDefault()
@ -283,19 +284,18 @@ const form = {
{
id: randomId(),
content: '',
isOther: false
isOther: false,
},
{
id: randomId(),
content: t('views.applicationWorkflow.nodes.intentNode.other'),
isOther: true
}
isOther: true,
},
],
dialogue_number: 1,
content_list: [],
}
function refreshParam(data: any) {
set(props.nodeModel.properties.node_data, 'model_params_setting', data)
}