mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: Add Document Search node function
This commit is contained in:
parent
5189816069
commit
93efd15f04
|
|
@ -0,0 +1,4 @@
|
|||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.875 4.38719H9.375V1.875H3.125V13.125H6.25V14.375H2.5C2.33424 14.375 2.17527 14.3091 2.05806 14.1919C1.94085 14.0747 1.875 13.9158 1.875 13.75V1.25C1.875 1.08424 1.94085 0.925268 2.05806 0.808058C2.17527 0.690848 2.33424 0.625 2.5 0.625H10.3125L13.125 3.57156V6.25H11.875V4.38719Z" fill="white"/>
|
||||
<path d="M10.3125 13.75C10.9566 13.75 11.5552 13.5551 12.0525 13.2211L13.2218 14.3903C13.3438 14.5124 13.5417 14.5124 13.6638 14.3903L14.1941 13.86C14.3161 13.738 14.3161 13.5401 14.1941 13.4181L12.9987 12.2227C13.2774 11.7552 13.4375 11.2088 13.4375 10.625C13.4375 8.89906 12.0384 7.49995 10.3125 7.49995C8.58661 7.49995 7.1875 8.89906 7.1875 10.625C7.1875 12.3508 8.58661 13.75 10.3125 13.75ZM12.1875 10.625C12.1875 11.6605 11.348 12.5 10.3125 12.5C9.27696 12.5 8.4375 11.6605 8.4375 10.625C8.4375 9.58942 9.27696 8.74995 10.3125 8.74995C11.348 8.74995 12.1875 9.58942 12.1875 10.625Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1015 B |
|
|
@ -1,5 +1,5 @@
|
|||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.00018 2.5C4.00018 1.94772 4.4479 1.5 5.00018 1.5H14.7931C14.9257 1.5 15.0529 1.55268 15.1466 1.64645L19.8537 6.35355C19.9475 6.44732 20.0002 6.5745 20.0002 6.70711V21.5C20.0002 22.0523 19.5525 22.5 19.0002 22.5H5.00018C4.4479 22.5 4.00018 22.0523 4.00018 21.5V2.5Z" fill="#34C724"/>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 2.5C4 1.94772 4.44772 1.5 5 1.5H14.7929C14.9255 1.5 15.0527 1.55268 15.1464 1.64645L19.8536 6.35355C19.9473 6.44732 20 6.5745 20 6.70711V21.5C20 22.0523 19.5523 22.5 19 22.5H5C4.44772 22.5 4 22.0523 4 21.5V2.5Z" fill="#34C724"/>
|
||||
<path d="M15 1.54492C15.054 1.56949 15.1037 1.6037 15.1464 1.64646L19.8536 6.35357C19.8963 6.39632 19.9305 6.44602 19.9551 6.50001H16C15.4477 6.50001 15 6.0523 15 5.50001V1.54492Z" fill="#2CA91F"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 11.5C7.5 11.2239 7.72386 11 8 11H13.3971C13.6733 11 13.8971 11.2239 13.8971 11.5V12.1723L15.8207 11.4333C15.9744 11.3742 16.1474 11.3946 16.2831 11.4879C16.4189 11.5812 16.5 11.7353 16.5 11.9V16.3C16.5 16.4647 16.4189 16.6188 16.2831 16.7121C16.1474 16.8054 15.9744 16.8258 15.8207 16.7667L13.8971 16.0277V16.7C13.8971 16.9761 13.6733 17.2 13.3971 17.2H8C7.72386 17.2 7.5 16.9761 7.5 16.7V11.5ZM9.25 13.5C9.66421 13.5 10 13.1642 10 12.75C10 12.3358 9.66421 12 9.25 12C8.83579 12 8.5 12.3358 8.5 12.75C8.5 13.1642 8.83579 13.5 9.25 13.5Z" fill="white"/>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
|
@ -3,7 +3,7 @@
|
|||
<div class="flex-between cursor" @click="data['show'] = !data['show']">
|
||||
<div class="flex align-center">
|
||||
<el-icon class="mr-8 arrow-icon" :class="data['show'] ? 'rotate-90' : ''">
|
||||
<CaretRight/>
|
||||
<CaretRight />
|
||||
</el-icon>
|
||||
<component
|
||||
:is="iconComponent(`${data.type}-icon`)"
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
data.type === WorkflowType.Application ||
|
||||
data.type == WorkflowType.IntentNode
|
||||
"
|
||||
>{{ data?.message_tokens + data?.answer_tokens }} tokens</span
|
||||
>{{ data?.message_tokens + data?.answer_tokens }} tokens</span
|
||||
>
|
||||
<span class="mr-16 color-secondary">{{ data?.run_time?.toFixed(2) || 0.0 }} s</span>
|
||||
<el-icon class="color-success" :size="16" v-if="data.status === 200">
|
||||
<CircleCheck/>
|
||||
<CircleCheck />
|
||||
</el-icon>
|
||||
<el-icon class="color-danger" :size="16" v-else>
|
||||
<CircleClose/>
|
||||
<CircleClose />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<template v-for="(f, i) in data.document_list" :key="i">
|
||||
<el-card shadow="never" style="--el-card-padding: 8px" class="file cursor">
|
||||
<div class="flex align-center">
|
||||
<img :src="getImgUrl(f && f?.name)" alt="" width="24"/>
|
||||
<img :src="getImgUrl(f && f?.name)" alt="" width="24" />
|
||||
<div class="ml-4 ellipsis" :title="f && f?.name">
|
||||
{{ f && f?.name }}
|
||||
</div>
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
<template v-for="(f, i) in data.other_list" :key="i">
|
||||
<el-card shadow="never" style="--el-card-padding: 8px" class="file cursor">
|
||||
<div class="flex align-center">
|
||||
<img :src="getImgUrl(f && f?.name)" alt="" width="24"/>
|
||||
<img :src="getImgUrl(f && f?.name)" alt="" width="24" />
|
||||
<div class="ml-4 ellipsis" :title="f && f?.name">
|
||||
{{ f && f?.name }}
|
||||
</div>
|
||||
|
|
@ -463,8 +463,7 @@
|
|||
<template v-if="data.type === WorkflowType.FormNode">
|
||||
<div class="card-never border-r-6">
|
||||
<h5 class="p-8-12">
|
||||
{{
|
||||
$t('common.param.outputParam')
|
||||
{{ $t('common.param.outputParam')
|
||||
}}<span style="color: #f54a45">{{
|
||||
data.is_submit ? '' : `(${$t('chat.executionDetails.noSubmit')})`
|
||||
}}</span>
|
||||
|
|
@ -516,7 +515,7 @@
|
|||
class="border-r-6 mr-8"
|
||||
/>
|
||||
|
||||
<span v-else>{{ h.text }}<br/></span>
|
||||
<span v-else>{{ h.text }}<br /></span>
|
||||
</template>
|
||||
</span>
|
||||
|
||||
|
|
@ -600,7 +599,7 @@
|
|||
class="border-r-6 mr-8"
|
||||
/>
|
||||
|
||||
<span v-else>{{ h.text }}<br/></span>
|
||||
<span v-else>{{ h.text }}<br /></span>
|
||||
</template>
|
||||
</span>
|
||||
|
||||
|
|
@ -919,7 +918,7 @@
|
|||
<template v-if="data.type === WorkflowType.LoopNode">
|
||||
<el-radio-group v-model="currentLoopNode" class="app-radio-button-group mb-8">
|
||||
<template v-for="(loop, loopIndex) in data.loop_node_data" :key="loopIndex">
|
||||
<el-radio-button :label="loopIndex" :value="loopIndex"/>
|
||||
<el-radio-button :label="loopIndex" :value="loopIndex" />
|
||||
</template>
|
||||
</el-radio-group>
|
||||
<template
|
||||
|
|
@ -994,6 +993,24 @@
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 文档检索 -->
|
||||
<template v-if="data.type === WorkflowType.SearchDocument">
|
||||
<div class="card-never border-r-6">
|
||||
<h5 class="p-8-12 flex align-center">
|
||||
<span class="mr-4"> {{ $t('common.param.outputParam') }}</span>
|
||||
</h5>
|
||||
<div class="p-8-12 border-t-dashed lighter">
|
||||
<div class="mb-8">
|
||||
<span class="color-secondary"> knowledge_list:</span>
|
||||
{{ data.knowledge_items?.map((v:any) => v.name).join(',') }}
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<span class="color-secondary"> document_list:</span>
|
||||
{{ data.document_items?.map((v:any) => v.name).join(',') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<slot></slot>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -1007,16 +1024,15 @@
|
|||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, computed} from 'vue'
|
||||
import ParagraphCard
|
||||
from '@/components/ai-chat/component/knowledge-source-component/ParagraphCard.vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import ParagraphCard from '@/components/ai-chat/component/knowledge-source-component/ParagraphCard.vue'
|
||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import {iconComponent} from '@/workflow/icons/utils'
|
||||
import {WorkflowType} from '@/enums/application'
|
||||
import {getImgUrl} from '@/utils/common'
|
||||
import {arraySort} from '@/utils/array'
|
||||
import { iconComponent } from '@/workflow/icons/utils'
|
||||
import { WorkflowType } from '@/enums/application'
|
||||
import { getImgUrl } from '@/utils/common'
|
||||
import { arraySort } from '@/utils/array'
|
||||
|
||||
import {t} from '@/locales'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const props = defineProps<{
|
||||
data: any
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ export default {
|
|||
aiCapability: 'AI capability',
|
||||
businessLogic: 'Business logic',
|
||||
other: 'Other',
|
||||
dataProcessing: 'Data Processing',
|
||||
},
|
||||
startNode: {
|
||||
label: 'Start',
|
||||
|
|
@ -145,12 +146,15 @@ export default {
|
|||
selectKnowledge: 'Search Scope',
|
||||
searchSetting: 'Search Settings',
|
||||
custom: 'Manual',
|
||||
customTooltip: 'Manually set tag filtering conditions',
|
||||
auto: 'Automatic',
|
||||
autoTooltip: 'Automatically filter setting tag conditions based on the search question',
|
||||
document_list: 'Document List',
|
||||
knowledge_list: 'Knowledge Base List',
|
||||
result: 'Search Results',
|
||||
searchParam: 'Search Parameters',
|
||||
select_variable: 'Select Variable',
|
||||
valueMessage: `Value or {variable} `,
|
||||
showKnowledge: {
|
||||
label: 'Results are displayed in the knowledge source',
|
||||
requiredMessage: 'Please set parameters',
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ export default {
|
|||
aiCapability: 'AI能力',
|
||||
businessLogic: '业务逻辑',
|
||||
other: '其他',
|
||||
dataProcessing: '数据处理',
|
||||
},
|
||||
startNode: {
|
||||
label: '开始',
|
||||
|
|
@ -153,12 +154,15 @@ export default {
|
|||
selectKnowledge: '检索范围',
|
||||
searchSetting: '检索设置',
|
||||
custom: '手动',
|
||||
customTooltip: '手动设置标签过滤条件',
|
||||
auto: '自动',
|
||||
autoTooltip: '根据检索问题自动匹配文档标签',
|
||||
document_list: '文档列表',
|
||||
knowledge_list: '知识库列表',
|
||||
result: '检索结果',
|
||||
searchParam: '检索参数',
|
||||
select_variable: '选择变量',
|
||||
valueMessage: `值或{变量}`,
|
||||
showKnowledge: {
|
||||
label: '结果显示在知识来源中',
|
||||
requiredMessage: '请设置参数',
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ export default {
|
|||
aiCapability: 'AI能力',
|
||||
businessLogic: '業務邏輯',
|
||||
other: '其他',
|
||||
dataProcessing: '數據處理',
|
||||
},
|
||||
startNode: {
|
||||
label: '開始',
|
||||
|
|
@ -146,12 +147,15 @@ export default {
|
|||
selectKnowledge: '檢索範圍',
|
||||
searchSetting: '檢索設定',
|
||||
custom: '手動',
|
||||
customTooltip: '手動設置標籤過濾條件',
|
||||
auto: '自動',
|
||||
autoTooltip: '根據檢索問題自動匹配文檔標簽',
|
||||
document_list: '文件清單',
|
||||
knowledge_list: '知識庫列表',
|
||||
result: '檢索結果',
|
||||
searchParam: '檢索參數',
|
||||
select_variable: '選擇變數',
|
||||
valueMessage: `值或{變量}`,
|
||||
showKnowledge: {
|
||||
label: '結果顯示在知識來源',
|
||||
requiredMessage: '請設定參數',
|
||||
|
|
@ -398,13 +402,13 @@ export default {
|
|||
loopItem: '循環元素',
|
||||
loopVariable: '循環變量',
|
||||
},
|
||||
loopBodyNode: {label: '循環體', text: '循環體'},
|
||||
loopBodyNode: { label: '循環體', text: '循環體' },
|
||||
loopContinueNode: {
|
||||
label: 'Continue',
|
||||
text: '用於終止當前循環,執行下次循環',
|
||||
isContinue: 'Continue',
|
||||
},
|
||||
loopBreakNode: {label: 'Break', text: '終止當前循環,跳出循環體', isBreak: 'Break'},
|
||||
loopBreakNode: { label: 'Break', text: '終止當前循環,跳出循環體', isBreak: 'Break' },
|
||||
variableSplittingNode: {
|
||||
label: '變量拆分',
|
||||
text: '用於拆分變量',
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ export const searchDocumentNode = {
|
|||
label: t('views.applicationWorkflow.nodes.searchDocumentNode.label'),
|
||||
height: 355,
|
||||
properties: {
|
||||
width: 600,
|
||||
stepName: t('views.applicationWorkflow.nodes.searchDocumentNode.label'),
|
||||
config: {
|
||||
fields: [
|
||||
|
|
@ -625,7 +626,7 @@ export const menuNodes = [
|
|||
list: [conditionNode, formNode, variableAssignNode, replyNode, loopNode],
|
||||
},
|
||||
{
|
||||
label: t('views.applicationWorkflow.nodes.classify.dataProcessing', '数据处理'),
|
||||
label: t('views.applicationWorkflow.nodes.classify.dataProcessing'),
|
||||
list: [variableSplittingNode, parameterExtractionNode],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-avatar shape="square" class="avatar-blue">
|
||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/workflow/icon_doc-search.svg" style="width: 58%" alt="" />
|
||||
</el-avatar>
|
||||
</template>
|
||||
<script setup lang="ts"></script>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@
|
|||
>
|
||||
<div class="flex-between">
|
||||
<div class="flex align-center">
|
||||
<img class="mr-12" src="@/assets/workflow/icon_file-video.svg" alt="" />
|
||||
<img class="mr-12" width="32" src="@/assets/workflow/icon_file-video.svg" alt="" />
|
||||
<div>
|
||||
<p class="line-height-22 mt-4">
|
||||
{{ $t('common.fileUpload.video') }}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@submit.prevent
|
||||
:model="form_data"
|
||||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
hide-required-asterisk
|
||||
label-width="auto"
|
||||
ref="knowledgeNodeFormRef"
|
||||
>
|
||||
|
|
@ -17,8 +17,11 @@
|
|||
{{ $t('views.applicationWorkflow.nodes.searchDocumentNode.selectKnowledge') }}
|
||||
</span>
|
||||
<span>
|
||||
<el-button v-if="form_data.search_scope_type === 'custom'"
|
||||
type="primary" link @click="openKnowledgeDialog"
|
||||
<el-button
|
||||
v-if="form_data.search_scope_type === 'custom'"
|
||||
type="primary"
|
||||
link
|
||||
@click="openKnowledgeDialog"
|
||||
>
|
||||
<AppIcon iconName="app-add-outlined"></AppIcon>
|
||||
</el-button>
|
||||
|
|
@ -59,7 +62,7 @@
|
|||
</div>
|
||||
<el-button text @click="removeKnowledge(item)">
|
||||
<el-icon>
|
||||
<Close/>
|
||||
<Close />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
|
|
@ -78,7 +81,8 @@
|
|||
<div class="flex-between">
|
||||
<span>
|
||||
{{ $t('views.applicationWorkflow.nodes.searchDocumentNode.select_variable') }}
|
||||
</span>
|
||||
<span class="color-danger">*</span></span
|
||||
>
|
||||
<span>
|
||||
<el-select
|
||||
:teleported="false"
|
||||
|
|
@ -88,11 +92,15 @@
|
|||
@change="form_data.search_scope_reference = []"
|
||||
>
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.nodes.searchDocumentNode.knowledge_list')"
|
||||
:label="
|
||||
$t('views.applicationWorkflow.nodes.searchDocumentNode.knowledge_list')
|
||||
"
|
||||
value="knowledge"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.nodes.searchDocumentNode.document_list')"
|
||||
:label="
|
||||
$t('views.applicationWorkflow.nodes.searchDocumentNode.document_list')
|
||||
"
|
||||
value="document"
|
||||
/>
|
||||
</el-select>
|
||||
|
|
@ -110,19 +118,31 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('views.applicationWorkflow.nodes.searchDocumentNode.searchSetting')">
|
||||
:label="$t('views.applicationWorkflow.nodes.searchDocumentNode.searchSetting')"
|
||||
>
|
||||
<el-radio-group v-model="form_data.search_mode">
|
||||
<el-radio value="auto">
|
||||
{{ $t('views.applicationWorkflow.nodes.searchDocumentNode.auto') }}
|
||||
<el-tooltip content="根据检索问题自动匹配文档标签" placement="top">
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
</el-tooltip>
|
||||
<span class="flex align-center">
|
||||
{{ $t('views.applicationWorkflow.nodes.searchDocumentNode.auto') }}
|
||||
<el-tooltip
|
||||
:content="$t('views.applicationWorkflow.nodes.searchDocumentNode.autoTooltip')"
|
||||
placement="top"
|
||||
>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon ml-4"></AppIcon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</el-radio>
|
||||
<el-radio value="custom">
|
||||
{{ $t('views.applicationWorkflow.nodes.searchDocumentNode.custom') }}
|
||||
<el-tooltip content="手动设置标签过滤条件" placement="top">
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
</el-tooltip>
|
||||
<el-radio value="custom" v-if="form_data.search_scope_type === 'custom'">
|
||||
<span class="flex align-center">
|
||||
{{ $t('views.applicationWorkflow.nodes.searchDocumentNode.custom') }}
|
||||
<el-tooltip
|
||||
c
|
||||
:content="$t('views.applicationWorkflow.nodes.searchDocumentNode.customTooltip')"
|
||||
placement="top"
|
||||
>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon ml-4"></AppIcon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
|
@ -150,36 +170,60 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
<div v-else>
|
||||
<div>
|
||||
<span>
|
||||
<div class="flex align-center mb-8">
|
||||
<el-text type="info" class="lighter" size="small">
|
||||
{{ $t('views.applicationWorkflow.nodes.conditionNode.conditions.info') }}
|
||||
</span>
|
||||
<el-select v-model="form_data.search_condition_type" size="small"
|
||||
style="width: 60px; margin: 0 8px">
|
||||
<el-option
|
||||
:label="$t('views.applicationWorkflow.condition.AND')"
|
||||
value="AND"
|
||||
/>
|
||||
<el-option :label="$t('views.applicationWorkflow.condition.OR')" value="OR"/>
|
||||
</el-text>
|
||||
<el-select
|
||||
v-model="form_data.search_condition_type"
|
||||
size="small"
|
||||
style="width: 60px; margin: 0 8px"
|
||||
>
|
||||
<el-option :label="$t('views.applicationWorkflow.condition.AND')" value="AND" />
|
||||
<el-option :label="$t('views.applicationWorkflow.condition.OR')" value="OR" />
|
||||
</el-select>
|
||||
<span>
|
||||
<el-text type="info" class="lighter" size="small">
|
||||
{{ $t('views.applicationWorkflow.nodes.conditionNode.conditions.label') }}
|
||||
</span>
|
||||
</el-text>
|
||||
</div>
|
||||
<div v-for="(c, index) in form_data.search_condition_list" :key="index">
|
||||
<el-select v-model="c.key" style="width: 70px;" size="small">
|
||||
<el-option v-for="tag in form_data.knowledge_tags" :key="tag" :label="tag.key" :value="tag.key"/>
|
||||
</el-select>
|
||||
<el-select v-model="c.compare" style="width: 60px;" size="small">
|
||||
<el-option v-for="item in compareList" :key="item.value" :value="item.value"
|
||||
:label="item.label"/>
|
||||
</el-select>
|
||||
<el-input v-model="c.value" style="width: 80px" size="small"></el-input>
|
||||
<el-button text @click="delCondition(index)">
|
||||
<AppIcon iconName="app-delete"></AppIcon>
|
||||
</el-button>
|
||||
<el-row :gutter="8" class="mb-8">
|
||||
<el-col :span="8">
|
||||
<el-select v-model="c.key" filterable>
|
||||
<el-option
|
||||
v-for="tag in form_data.knowledge_tags"
|
||||
:key="tag"
|
||||
:label="tag.key"
|
||||
:value="tag.key"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-select v-model="c.compare">
|
||||
<el-option
|
||||
v-for="item in compareList"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-input
|
||||
v-model="c.value"
|
||||
:placeholder="
|
||||
$t('views.applicationWorkflow.nodes.searchDocumentNode.valueMessage')
|
||||
"
|
||||
></el-input>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<el-button link @click="delCondition(index)" type="info" class="mt-4">
|
||||
<AppIcon iconName="app-delete"></AppIcon>
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-button link type="primary" @click="addCondition" class="mt-4">
|
||||
<el-button link type="primary" @click="addCondition" class="mt-8">
|
||||
<AppIcon iconName="app-add-outlined" class="mr-4"></AppIcon>
|
||||
{{ $t('views.applicationWorkflow.nodes.conditionNode.addCondition') }}
|
||||
</el-button>
|
||||
|
|
@ -204,8 +248,8 @@ import AddKnowledgeDialog from '@/views/application/component/AddKnowledgeDialog
|
|||
import type { FormInstance } from 'element-plus'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { relatedObject } from '@/utils/array'
|
||||
import { t } from "@/locales";
|
||||
import AppIcon from "@/components/app-icon/AppIcon.vue";
|
||||
import { t } from '@/locales'
|
||||
import AppIcon from '@/components/app-icon/AppIcon.vue'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
|
|
@ -214,9 +258,9 @@ const route = useRoute()
|
|||
const props = defineProps<{ nodeModel: any }>()
|
||||
const nodeCascaderRef = ref()
|
||||
const compareList = [
|
||||
{value: 'contain', label: t('views.applicationWorkflow.compare.contain')},
|
||||
{value: 'not_contain', label: t('views.applicationWorkflow.compare.not_contain')},
|
||||
{value: 'eq', label: t('views.applicationWorkflow.compare.eq')},
|
||||
{ value: 'contain', label: t('views.applicationWorkflow.compare.contain') },
|
||||
{ value: 'not_contain', label: t('views.applicationWorkflow.compare.not_contain') },
|
||||
{ value: 'eq', label: t('views.applicationWorkflow.compare.eq') },
|
||||
]
|
||||
|
||||
const apiType = computed(() => {
|
||||
|
|
@ -268,7 +312,11 @@ function removeKnowledge(id: any) {
|
|||
}
|
||||
|
||||
function addKnowledge(val: Array<any>) {
|
||||
set(props.nodeModel.properties.node_data, 'knowledge_id_list', val.map((item) => item.id))
|
||||
set(
|
||||
props.nodeModel.properties.node_data,
|
||||
'knowledge_id_list',
|
||||
val.map((item) => item.id),
|
||||
)
|
||||
set(props.nodeModel.properties.node_data, 'knowledge_list', val)
|
||||
knowledgeList.value = val
|
||||
}
|
||||
|
|
@ -295,25 +343,23 @@ function delCondition(index: number) {
|
|||
set(form_data.value, 'search_condition_list', list)
|
||||
}
|
||||
|
||||
|
||||
function getAllTags(knowledge_ids: any) {
|
||||
if (knowledge_ids.length === 0) {
|
||||
set(form_data.value, 'knowledge_tags', [])
|
||||
return
|
||||
}
|
||||
loadSharedApi({type: 'knowledge', systemType: apiType.value})
|
||||
.getAllTags({knowledge_ids: knowledge_ids}, {})
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getAllTags({ knowledge_ids: knowledge_ids }, {})
|
||||
.then((res: any) => {
|
||||
set(form_data.value, 'knowledge_tags', res.data)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
watch(
|
||||
() => form_data.value.knowledge_id_list,
|
||||
(val) => {
|
||||
getAllTags(val)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
const validate = () => {
|
||||
|
|
@ -321,7 +367,7 @@ const validate = () => {
|
|||
nodeCascaderRef.value?.validate(),
|
||||
knowledgeNodeFormRef.value?.validate(),
|
||||
]).catch((err) => {
|
||||
return Promise.reject({node: props.nodeModel, errMessage: err})
|
||||
return Promise.reject({ node: props.nodeModel, errMessage: err })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue