diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue
index 2c2801b32..0ca571259 100644
--- a/ui/src/components/ai-chat/index.vue
+++ b/ui/src/components/ai-chat/index.vue
@@ -401,7 +401,7 @@ function handleInputFieldList() {
}
}
default:
- break
+ return v
}
})
: v.properties.input_field_list ? v.properties.input_field_list
diff --git a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue
index 1b96f879f..b8085cb64 100644
--- a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue
@@ -54,7 +54,7 @@ const formValue = computed({
})
const addOption = () => {
- formValue.value.option_list.push('')
+ formValue.value.option_list.push({ value: '' })
}
const delOption = (index: number) => {
@@ -77,4 +77,8 @@ onMounted(() => {
formValue.value.option_list = props.modelValue.option_list || []
})
-
+
diff --git a/ui/src/workflow/nodes/base-node/component/ApiInputFieldTable.vue b/ui/src/workflow/nodes/base-node/component/ApiInputFieldTable.vue
index b9ec6d5d3..b57a71270 100644
--- a/ui/src/workflow/nodes/base-node/component/ApiInputFieldTable.vue
+++ b/ui/src/workflow/nodes/base-node/component/ApiInputFieldTable.vue
@@ -5,7 +5,7 @@
- 添加
+ 添加参数
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ :input_type_list="inputTypeList"
+ ref="DynamicsFormConstructorRef"
+ >
@@ -112,89 +25,100 @@
diff --git a/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue b/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue
index b2b1f1f60..b7aa0de20 100644
--- a/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue
+++ b/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue
@@ -5,7 +5,7 @@
- 添加
+ 添加参数
-
-
-
+
- 文本框
- 日期
- 下拉选项
+ {{ row.label.label }}
+ {{ row.label }}
+
+
+
+
+
+ 文本框
+ 滑块
+ 开关
+ 单选框
+ 日期
-
+
@@ -63,15 +70,11 @@ import { MsgError } from '@/utils/message'
const props = defineProps<{ nodeModel: any }>()
-const currentIndex = ref(null)
const UserFieldFormDialogRef = ref()
const inputFieldList = ref([])
function openAddDialog(data?: any, index?: any) {
- if (typeof index !== 'undefined') {
- currentIndex.value = index
- }
- UserFieldFormDialogRef.value.open(data)
+ UserFieldFormDialogRef.value.open(data, index)
}
function deleteField(index: any) {
@@ -80,27 +83,26 @@ function deleteField(index: any) {
}
-function refreshFieldList(data: any) {
+function refreshFieldList(data: any, index: any) {
for (let i = 0; i < inputFieldList.value.length; i++) {
- if (inputFieldList.value[i].variable === data.variable && currentIndex.value !== i) {
- MsgError('参数已存在: ' + data.variable)
+ if (inputFieldList.value[i].field === data.field && index !== i) {
+ MsgError('参数已存在: ' + data.field)
return
}
}
// 查看另一个list又没有重复的
let arr = props.nodeModel.properties.api_input_field_list
for (let i = 0; i < arr.length; i++) {
- if (arr[i].variable === data.variable) {
- MsgError('参数已存在: ' + data.variable)
+ if (arr[i].variable === data.field) {
+ MsgError('参数已存在: ' + data.field)
return
}
}
- if (currentIndex.value !== null) {
- inputFieldList.value.splice(currentIndex.value, 1, data)
+ if (index !== null) {
+ inputFieldList.value.splice(index, 1, data)
} else {
inputFieldList.value.push(data)
}
- currentIndex.value = null
UserFieldFormDialogRef.value.close()
props.nodeModel.graphModel.eventCenter.emit('refreshFieldList')
}
@@ -119,6 +121,23 @@ onMounted(() => {
} else {
inputFieldList.value.push(...props.nodeModel.properties.user_input_field_list)
}
+ // 兼容旧数据
+ inputFieldList.value.forEach((item, index) => {
+ item.label = item.label || item.name
+ item.field = item.field || item.variable
+ item.required = item.required || item.is_required
+ switch (item.type) {
+ case 'input':
+ item.input_type = 'TextInput'
+ break
+ case 'select':
+ item.input_type = 'SingleSelect'
+ break
+ case 'date':
+ item.input_type = 'DatePicker'
+ break
+ }
+ })
set(props.nodeModel.properties, 'user_input_field_list', inputFieldList)
})
diff --git a/ui/src/workflow/nodes/start-node/index.vue b/ui/src/workflow/nodes/start-node/index.vue
index c5aef22cc..d501ebb4a 100644
--- a/ui/src/workflow/nodes/start-node/index.vue
+++ b/ui/src/workflow/nodes/start-node/index.vue
@@ -35,14 +35,18 @@ const globalFields = [
{ label: '历史聊天记录', value: 'history_context' },
{ label: '对话id', value: 'chat_id' }
]
-const inputFieldList = ref([])
const getRefreshFieldList = () => {
const user_input_fields = props.nodeModel.graphModel.nodes
.filter((v: any) => v.id === 'base-node')
.map((v: any) => cloneDeep(v.properties.user_input_field_list))
.reduce((x: any, y: any) => [...x, ...y], [])
- .map((i: any) => ({ label: i.name, value: i.variable }))
+ .map((i: any) => {
+ if (i.label && i.label.input_type === 'TooltipLabel') {
+ return { label: i.label.label, value: i.field || i.variable }
+ }
+ return { label: i.label || i.name, value: i.field || i.variable }
+ })
const api_input_fields = props.nodeModel.graphModel.nodes
.filter((v: any) => v.id === 'base-node')
.map((v: any) => cloneDeep(v.properties.api_input_field_list))