mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-27 12:12:57 +00:00
feat: 编排数据
This commit is contained in:
parent
c986713d84
commit
29d367bde3
|
|
@ -1,10 +1,42 @@
|
|||
<template>
|
||||
<div></div>
|
||||
<el-cascader :options="options" @visible-change="visibleChange" v-bind="$attrs" separator=" > ">
|
||||
<template #default="{ node, data }">
|
||||
<span>{{ data.label }}</span>
|
||||
</template>
|
||||
</el-cascader>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// const props = defineProps({
|
||||
// lf: Object || String || null
|
||||
// })
|
||||
import { ref, computed } from 'vue'
|
||||
const props = defineProps<{
|
||||
nodeModel: any
|
||||
}>()
|
||||
|
||||
const options = ref([])
|
||||
|
||||
function visibleChange(bool: boolean) {
|
||||
if (bool) {
|
||||
options.value = []
|
||||
getIncomingNode(props.nodeModel.id)
|
||||
}
|
||||
}
|
||||
|
||||
function getIncomingNode(id: string) {
|
||||
const list = props.nodeModel.graphModel.getNodeIncomingNode(id)
|
||||
if (list.length > 0) {
|
||||
list.forEach((item) => {
|
||||
if (!options.value.some((obj: any) => obj.id === item.id)) {
|
||||
options.value.unshift({
|
||||
value: item.id,
|
||||
label: item.properties.stepName,
|
||||
children: item.properties?.fields || []
|
||||
})
|
||||
}
|
||||
})
|
||||
list.forEach((item) => {
|
||||
getIncomingNode(item.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,16 @@ const graphData = {
|
|||
stepName: '知识库检索',
|
||||
input: [{ key: '输入' }],
|
||||
output: [{ key: '输出' }],
|
||||
fields: [
|
||||
{
|
||||
label: '检索结果',
|
||||
value: 'data'
|
||||
},
|
||||
{
|
||||
label: '满足直接回答的分段内容',
|
||||
value: 'paragraph'
|
||||
}
|
||||
],
|
||||
node_data: {
|
||||
dataset_id_list: [],
|
||||
dataset_setting: {
|
||||
|
|
@ -64,17 +74,17 @@ const graphData = {
|
|||
node_data: {
|
||||
branch: [
|
||||
{
|
||||
conditions: [{ field: { node_id: 'xxx', fields: '' }, compare: '', value: '' }],
|
||||
conditions: [{ field: [], compare: '', value: '' }],
|
||||
id: '2391',
|
||||
condition: 'and'
|
||||
},
|
||||
{
|
||||
conditions: [{ field: { node_id: 'xxx', fields: '' }, compare: '', value: '' }],
|
||||
conditions: [{ field: [], compare: '', value: '' }],
|
||||
id: '1143',
|
||||
condition: 'and'
|
||||
},
|
||||
{
|
||||
conditions: [{ field: { node_id: 'xxx', fields: '' }, compare: '', value: '' }],
|
||||
conditions: [{ field: [], compare: '', value: '' }],
|
||||
id: '9208',
|
||||
condition: 'and'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,21 +20,18 @@
|
|||
<el-form-item
|
||||
:prop="'branch.' + index + '.conditions' + cIndex + '.field'"
|
||||
:rules="{
|
||||
type: Array,
|
||||
required: true,
|
||||
message: '请选择变量',
|
||||
trigger: 'change'
|
||||
}"
|
||||
>
|
||||
<el-select
|
||||
<NodeCascader
|
||||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
v-model="condition.field"
|
||||
placeholder="请选择变量"
|
||||
clearable
|
||||
@visible-change="changeHandle()"
|
||||
>
|
||||
<el-option label="Zone one" value="shanghai" />
|
||||
<el-option label="Zone two" value="beijing" />
|
||||
</el-select>
|
||||
v-model="condition.field"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
|
|
@ -85,6 +82,7 @@
|
|||
<script setup lang="ts">
|
||||
import { cloneDeep, set } from 'lodash'
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { randomId } from '@/utils/utils'
|
||||
|
|
@ -94,7 +92,7 @@ const form = {
|
|||
{
|
||||
conditions: [
|
||||
{
|
||||
field: { node_id: 'xxx', fields: '' },
|
||||
field: [],
|
||||
compare: '',
|
||||
value: ''
|
||||
}
|
||||
|
|
@ -121,10 +119,6 @@ const form_data = computed({
|
|||
|
||||
const ConditionNodeFormRef = ref<FormInstance>()
|
||||
|
||||
function changeHandle() {
|
||||
console.log(props.nodeModel.graphModel.getNodeIncomingNode(props.nodeModel.id))
|
||||
}
|
||||
|
||||
const validate = () => {
|
||||
ConditionNodeFormRef.value?.validate()
|
||||
}
|
||||
|
|
@ -144,7 +138,7 @@ function addBranch() {
|
|||
const obj = {
|
||||
conditions: [
|
||||
{
|
||||
field: { node_id: 'xxx', fields: '' },
|
||||
field: [],
|
||||
compare: '',
|
||||
value: ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,14 @@
|
|||
</el-row>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="检索问题输入">
|
||||
<NodeCascader
|
||||
:nodeModel="nodeModel"
|
||||
class="w-full"
|
||||
placeholder="请选择检索问题输入"
|
||||
v-model="form_data.fields"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<h5 class="title-decoration-1 mb-8 mt-8">参数输出</h5>
|
||||
|
|
@ -95,8 +103,10 @@
|
|||
import { set } from 'lodash'
|
||||
import { app } from '@/main'
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import AddDatasetDialog from '@/views/application/components/AddDatasetDialog.vue'
|
||||
import ParamSettingDialog from '@/views/application/components/ParamSettingDialog.vue'
|
||||
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { relatedObject } from '@/utils/utils'
|
||||
|
|
@ -115,7 +125,8 @@ const form = {
|
|||
similarity: 0.6,
|
||||
max_paragraph_char_number: 5000,
|
||||
search_mode: 'embedding'
|
||||
}
|
||||
},
|
||||
fields: []
|
||||
}
|
||||
|
||||
const form_data = computed({
|
||||
|
|
@ -123,7 +134,7 @@ const form_data = computed({
|
|||
if (props.nodeModel.properties.node_data) {
|
||||
return props.nodeModel.properties.node_data
|
||||
} else {
|
||||
set(props.nodeModel.properties, 'node_data', form)
|
||||
set(props.nodeModel.properties, 'node_data', form.value)
|
||||
}
|
||||
return props.nodeModel.properties.node_data
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue