mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 编排
This commit is contained in:
parent
7b88a09a22
commit
af30ffc5e5
|
|
@ -3,7 +3,7 @@
|
|||
<el-button-group>
|
||||
<el-button size="small" @click="$_zoomIn">放大</el-button>
|
||||
<el-button size="small" @click="$_zoomOut">缩小</el-button>
|
||||
<el-button size="small" @click="$_reset">还原(大小&定位)</el-button>
|
||||
<el-button size="small" @click="$_reset">适应</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -23,6 +23,7 @@ function $_zoomOut() {
|
|||
function $_reset() {
|
||||
props.lf?.resetZoom()
|
||||
props.lf?.resetTranslate()
|
||||
props.lf?.fitView()
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<template>
|
||||
<AppAvatar shape="square" style="background: #D136D1;">
|
||||
<img src="@/assets/icon_start.svg" style="width: 75%" alt="" />
|
||||
</AppAvatar>
|
||||
</template>
|
||||
<script setup lang="ts"></script>
|
||||
|
|
@ -25,7 +25,7 @@ type ShapeItem = {
|
|||
className?: string
|
||||
disabled?: boolean
|
||||
properties?: Record<string, any>
|
||||
callback?: (lf: LogicFlow, container: HTMLElement) => void
|
||||
callback?: (lf: LogicFlow, container?: HTMLElement) => void
|
||||
}
|
||||
|
||||
const graphData = {
|
||||
|
|
@ -52,24 +52,24 @@ const graphData = {
|
|||
id: '34902d3d-a3ff-497f-b8e1-0c34a44d7dd4',
|
||||
type: 'start-node',
|
||||
x: 180,
|
||||
y: 623,
|
||||
y: 723,
|
||||
properties: {
|
||||
height: 200,
|
||||
stepName: '开始',
|
||||
// input: [{ key: '输入' }],
|
||||
input: [{ key: '输入' }],
|
||||
output: [{ key: '输出' }]
|
||||
// node_data: { model: 'shanghai', name: '222222' }
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '34902d3d-a3ff-497f-b8e1-0c34a44d7dd4',
|
||||
id: '34902d3d-a3ff-497f-b8e1-0c34a44d7dd5',
|
||||
type: 'search-dataset-node',
|
||||
x: 500,
|
||||
x: 600,
|
||||
y: 250,
|
||||
properties: {
|
||||
height: 200,
|
||||
stepName: '开始',
|
||||
// input: [{ key: '输入' }],
|
||||
stepName: '知识库检索',
|
||||
input: [{ key: '输入' }],
|
||||
output: [{ key: '输出' }]
|
||||
// node_data: { model: 'shanghai', name: '222222' }
|
||||
}
|
||||
|
|
@ -207,8 +207,8 @@ defineExpose({
|
|||
position: relative;
|
||||
.control {
|
||||
position: absolute;
|
||||
bottom: 50px;
|
||||
right: 50px;
|
||||
bottom: 24px;
|
||||
left: 24px;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ const shapeList = [
|
|||
{
|
||||
type: 'search-dataset-node',
|
||||
text: '关联知识库,查找与问题相关的分段',
|
||||
label: '知识检索',
|
||||
label: '知识库检索',
|
||||
icon: 'search-dataset-node-icon',
|
||||
properties: {
|
||||
height: '',
|
||||
stepName: '知识检索',
|
||||
stepName: '知识库检索',
|
||||
input: [
|
||||
{
|
||||
key: '输入'
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
</NodeContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { set } from 'lodash'
|
||||
import NodeContainer from '@/components/workflow/common/node-container/index.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
import ChatNodeVue from './index.vue'
|
||||
import { AppNode, AppNodeModel } from '@/components/workflow/common/app-node/index'
|
||||
class ChatNode extends AppNode {
|
||||
constructor(props: any) {
|
||||
super(props, ChatNodeVue)
|
||||
}
|
||||
}
|
||||
export default {
|
||||
type: 'start-node',
|
||||
model: AppNodeModel,
|
||||
view: ChatNode
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<NodeContainer :nodeModel="nodeModel" class="start-node">
|
||||
<h5 class="title-decoration-1 mb-8">全局变量</h5>
|
||||
<div class="border-r-4 p-8-12 mb-8 layout-bg lighter">当前时 {time}</div>
|
||||
<h5 class="title-decoration-1 mb-8">参数输出</h5>
|
||||
<div class="border-r-4 p-8-12 mb-8 layout-bg lighter">用户问题 {question}</div>
|
||||
</NodeContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import NodeContainer from '@/components/workflow/common/node-container/index.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
||||
const condition_data = computed({
|
||||
get: () => {
|
||||
if (props.nodeModel.properties.node_data) {
|
||||
return props.nodeModel.properties.node_data
|
||||
} else {
|
||||
props.nodeModel.properties.node_data = {
|
||||
name: '',
|
||||
desc: '',
|
||||
prologue:
|
||||
'您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。\n- MaxKB 主要功能有什么?\n- MaxKB 支持哪些大语言模型?\n- MaxKB 支持哪些文档类型?'
|
||||
}
|
||||
}
|
||||
return props.nodeModel.properties.node_data
|
||||
},
|
||||
set: (value) => {
|
||||
props.nodeModel.properties.node_data = value
|
||||
}
|
||||
})
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
const handleFocus = () => {
|
||||
props.nodeModel.isSelected = false
|
||||
}
|
||||
const aiChatNodeFormRef = ref<FormInstance>()
|
||||
|
||||
const validate = () => {
|
||||
aiChatNodeFormRef.value?.validate()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
props.nodeModel.validate = validate
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -108,6 +108,8 @@ const {
|
|||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
console.log(props.nodeModel)
|
||||
|
||||
const form = {
|
||||
dataset_id_list: [],
|
||||
dataset_setting: {
|
||||
|
|
@ -156,7 +158,9 @@ function addDataset(val: Array<string>) {
|
|||
}
|
||||
|
||||
function openDatasetDialog() {
|
||||
AddDatasetDialogRef.value.open(form_data.value.dataset_id_list)
|
||||
if (AddDatasetDialogRef.value) {
|
||||
AddDatasetDialogRef.value.open(form_data.value.dataset_id_list)
|
||||
}
|
||||
}
|
||||
|
||||
function getDataset() {
|
||||
|
|
|
|||
|
|
@ -11,36 +11,6 @@ import NodeContainer from '@/components/workflow/common/node-container/index.vue
|
|||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
||||
// const chat_data = computed({
|
||||
// get: () => {
|
||||
// if (props.nodeModel.properties.node_data) {
|
||||
// return props.nodeModel.properties.node_data
|
||||
// } else {
|
||||
// props.nodeModel.properties.node_data = {
|
||||
// name: '',
|
||||
// desc: '',
|
||||
// prologue:
|
||||
// '您好,我是 MaxKB 小助手,您可以向我提出 MaxKB 使用问题。\n- MaxKB 主要功能有什么?\n- MaxKB 支持哪些大语言模型?\n- MaxKB 支持哪些文档类型?'
|
||||
// }
|
||||
// }
|
||||
// return props.nodeModel.properties.node_data
|
||||
// },
|
||||
// set: (value) => {
|
||||
// props.nodeModel.properties.node_data = value
|
||||
// }
|
||||
// })
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
const handleFocus = () => {
|
||||
props.nodeModel.isSelected = false
|
||||
}
|
||||
const aiChatNodeFormRef = ref<FormInstance>()
|
||||
|
||||
const validate = () => {
|
||||
aiChatNodeFormRef.value?.validate()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
props.nodeModel.validate = validate
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue