Merge branch 'pr@main@application_flow' of github.com:1Panel-dev/MaxKB into pr@main@application_flow

This commit is contained in:
shaohuzhang1 2024-06-25 09:51:24 +08:00
commit e18da50140
5 changed files with 54 additions and 17 deletions

View File

@ -33,10 +33,17 @@
</template>
<!-- 知识库检索 -->
<template v-if="item.type == WorkflowType.SearchDataset">
<div class="card-never border-r-4">
<h5 class="p-8-12">检索内容</h5>
<div class="p-8-12 border-t-dashed lighter">{{ item.question }}</div>
</div>
<div class="card-never border-r-4">
<h5 class="p-8-12">检索结果</h5>
<div class="p-8-12 border-t-dashed lighter">
<template v-for="(paragraph, index) in item.paragraph_list" :key="index">
<template
v-for="(paragraph, paragraphIndex) in item.paragraph_list"
:key="paragraphIndex"
>
<CardBox
shadow="never"
:title="paragraph.title || '-'"
@ -46,7 +53,7 @@
>
<template #icon>
<AppAvatar class="mr-12 avatar-light" :size="22">
{{ index + 1 + '' }}</AppAvatar
{{ paragraphIndex + 1 + '' }}</AppAvatar
>
</template>
<div class="active-button primary">
@ -92,17 +99,28 @@
</div>
</div>
</template>
<!-- AI 对话 -->
<template v-if="item.type == WorkflowType.AiChat">
<!-- AI 对话 / 问题优化-->
<template
v-if="item.type == WorkflowType.AiChat || item.type == WorkflowType.Question"
>
<div class="card-never border-r-4">
<h5 class="p-8-12">角色设定 (System)</h5>
<div class="p-8-12 border-t-dashed lighter">
{{ item.branch_name }}
{{ item.system || '-' }}
</div>
</div>
<div class="card-never border-r-4 mt-8">
<h5 class="p-8-12">历史记录</h5>
<div class="p-8-12 border-t-dashed lighter"></div>
<div class="p-8-12 border-t-dashed lighter">
<p
class="mt-4 mb-4"
v-for="(history, historyIndex) in item.history_message"
:key="historyIndex"
>
<span class="color-secondary mr-4">{{ history.role }}:</span
><span>{{ history.content }}</span>
</p>
</div>
</div>
<div class="card-never border-r-4 mt-8">
<h5 class="p-8-12">本次对话</h5>
@ -115,10 +133,28 @@
ref="editorRef"
editorId="preview-only"
:modelValue="item.answer"
style="background: none"
/>
</div>
</div>
</template>
<!-- 指定回复 -->
<template v-if="item.type === WorkflowType.Reply">
<div class="card-never border-r-4">
<h5 class="p-8-12">回复内容</h5>
<div class="p-8-12 border-t-dashed lighter">
<el-scrollbar height="150">
<MdPreview
ref="editorRef"
editorId="preview-only"
:modelValue="item.answer"
style="background: none"
/>
</el-scrollbar>
</div>
</div>
</template>
</div>
</el-collapse-transition>
</el-card>

View File

@ -653,7 +653,3 @@ h5 {
border: 1px solid var(--el-color-primary);
}
}
.md-editor {
background: none;
}

View File

@ -1,6 +1,12 @@
<template>
<div class="custom-edge">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<div class="custom-edge cursor">
<svg
width="100%"
height="100%"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M12 23.0001C5.925 23.0001 1 18.0751 1 12.0001C1 5.92512 5.925 1.00012 12 1.00012C18.075 1.00012 23 5.92512 23 12.0001C23 18.0751 18.075 23.0001 12 23.0001Z"
fill="#3370FF"
@ -16,7 +22,7 @@
<style lang="scss">
.custom-edge {
color: var(--el-color-primary);
width: 22px;
stroke: none;
width: 22px;
}
</style>

View File

@ -66,9 +66,9 @@ class AppNode extends HtmlResize.view {
{
...anchorData,
x: x - 10,
y: y - 9,
width: 24,
height: 24
y: y - 12,
width: 30,
height: 30
},
[
lh('div', {

View File

@ -89,7 +89,6 @@ export class WorkFlowInstance {
private is_valid_nodes() {
for (const node of this.nodes) {
if (node.type !== WorkflowType.Base && node.type !== WorkflowType.Start) {
console.log(node.properties.stepName)
if (!this.edges.some((edge) => edge.targetNodeId === node.id)) {
throw `未在流程中的节点:${node.properties.stepName}`
}