mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: Knowledge base workflow icons and styles
This commit is contained in:
parent
081eb60411
commit
df6e9ae6e6
|
|
@ -406,13 +406,13 @@ const putKnowledgeWorkflow: (
|
||||||
const exportKnowledgeWorkflow = (
|
const exportKnowledgeWorkflow = (
|
||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
knowledge_name: string,
|
knowledge_name: string,
|
||||||
loading?: Ref<boolean>
|
loading?: Ref<boolean>,
|
||||||
) => {
|
) => {
|
||||||
return exportFile(
|
return exportFile(
|
||||||
knowledge_name + '.kbwf',
|
knowledge_name + '.kbwf',
|
||||||
`${prefix.value}/${knowledge_id}/workflow/export`,
|
`${prefix.value}/${knowledge_id}/workflow/export`,
|
||||||
undefined,
|
undefined,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -421,12 +421,11 @@ const exportKnowledgeWorkflow = (
|
||||||
const importKnowledgeWorkflow: (
|
const importKnowledgeWorkflow: (
|
||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?:Ref<boolean>
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (knowledge_id, data, loading)=>{
|
) => Promise<Result<any>> = (knowledge_id, data, loading) => {
|
||||||
return post(`${prefix.value}/${knowledge_id}/workflow/import`,data,undefined,loading)
|
return post(`${prefix.value}/${knowledge_id}/workflow/import`, data, undefined, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const listKnowledgeVersion: (
|
const listKnowledgeVersion: (
|
||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
|
|
@ -470,7 +469,12 @@ const cancelWorkflowAction: (
|
||||||
knowledge_action_id: string,
|
knowledge_action_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (knowledge_id: string, knowledge_action_id, loading) => {
|
) => Promise<Result<any>> = (knowledge_id: string, knowledge_action_id, loading) => {
|
||||||
return post(`${prefix.value}/${knowledge_id}/action/${knowledge_action_id}/cancel`, {}, loading)
|
return post(
|
||||||
|
`${prefix.value}/${knowledge_id}/action/${knowledge_action_id}/cancel`,
|
||||||
|
{},
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* mcp 节点
|
* mcp 节点
|
||||||
|
|
@ -520,5 +524,5 @@ export default {
|
||||||
getWorkflowActionPage,
|
getWorkflowActionPage,
|
||||||
cancelWorkflowAction,
|
cancelWorkflowAction,
|
||||||
exportKnowledgeWorkflow,
|
exportKnowledgeWorkflow,
|
||||||
importKnowledgeWorkflow
|
importKnowledgeWorkflow,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,27 @@ export const iconMap: any = {
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'app-import': {
|
||||||
|
iconReader: () => {
|
||||||
|
return h('i', [
|
||||||
|
h(
|
||||||
|
'svg',
|
||||||
|
{
|
||||||
|
style: { height: '100%', width: '100%' },
|
||||||
|
viewBox: '0 0 1024 1024',
|
||||||
|
version: '1.1',
|
||||||
|
xmlns: 'http://www.w3.org/2000/svg',
|
||||||
|
},
|
||||||
|
[
|
||||||
|
h('path', {
|
||||||
|
d: 'M519.381333 554.24l92.416 90.325333c8.533333 8.32 8.533333 21.845333 0 30.165334l-30.848 30.165333a22.186667 22.186667 0 0 1-30.890666 0L411.178667 569.173333l-30.890667-30.165333a41.984 41.984 0 0 1 0-60.330667l169.813333-165.973333a22.186667 22.186667 0 0 1 30.848 0l30.848 30.208c8.533333 8.32 8.533333 21.845333 0 30.165333l-100.437333 98.133334 405.376-1.706667h0.213333c12.032 0 21.76 9.642667 21.717334 21.418667l-0.170667 40.405333a21.589333 21.589333 0 0 1-21.76 21.248l-397.354667 1.706667zM674.688 170.666667H172.629333v682.666666h502.058667c12.032 0 21.802667 9.557333 21.802667 21.333334v42.666666c0 11.776-9.770667 21.333333-21.845334 21.333334H129.024A43.178667 43.178667 0 0 1 85.333333 896V128c0-23.552 19.541333-42.666667 43.648-42.666667h545.706667c12.032 0 21.802667 9.557333 21.802667 21.333334v42.666666c0 11.776-9.770667 21.333333-21.845334 21.333334z',
|
||||||
|
fill: 'currentColor',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
])
|
||||||
|
},
|
||||||
|
},
|
||||||
'app-404': {
|
'app-404': {
|
||||||
iconReader: () => {
|
iconReader: () => {
|
||||||
return h('i', [
|
return h('i', [
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,8 @@ export default {
|
||||||
documentSplitTip: 'Each document can preview only the first five segments',
|
documentSplitTip: 'Each document can preview only the first five segments',
|
||||||
paragraphRules: 'Segmentation Rules',
|
paragraphRules: 'Segmentation Rules',
|
||||||
writeContent: 'Content Written',
|
writeContent: 'Content Written',
|
||||||
|
cancel: 'Cancel Execution',
|
||||||
|
cancelExecutionTip: 'Are you sure you want to cancel the selected task? ',
|
||||||
},
|
},
|
||||||
KnowledgeSource: {
|
KnowledgeSource: {
|
||||||
title: 'Knowledge Source',
|
title: 'Knowledge Source',
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ export default {
|
||||||
fail: 'Failed',
|
fail: 'Failed',
|
||||||
all: 'All',
|
all: 'All',
|
||||||
padding: 'Padding',
|
padding: 'Padding',
|
||||||
|
REVOKED: 'Cancelled',
|
||||||
|
REVOKE: 'Cancelling',
|
||||||
},
|
},
|
||||||
param: {
|
param: {
|
||||||
outputParam: 'Output Parameters',
|
outputParam: 'Output Parameters',
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,6 @@ export default {
|
||||||
PENDING: 'Queuing',
|
PENDING: 'Queuing',
|
||||||
GENERATE: 'Generating',
|
GENERATE: 'Generating',
|
||||||
SYNC: 'Syncing',
|
SYNC: 'Syncing',
|
||||||
REVOKE: 'Cancelling',
|
|
||||||
finish: 'Finish',
|
finish: 'Finish',
|
||||||
},
|
},
|
||||||
enableStatus: {
|
enableStatus: {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ export default {
|
||||||
},
|
},
|
||||||
operation: {
|
operation: {
|
||||||
toImportDoc: 'Go to Import Documents',
|
toImportDoc: 'Go to Import Documents',
|
||||||
|
importWorkflow: 'Import Workflow',
|
||||||
|
exportWorkflow: 'Export Workflow',
|
||||||
},
|
},
|
||||||
setting: {
|
setting: {
|
||||||
restoreVersion: 'Restore Previous Version"',
|
restoreVersion: 'Restore Previous Version"',
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ export default {
|
||||||
documentSplitTip: '每个文档仅能预览前五个分段',
|
documentSplitTip: '每个文档仅能预览前五个分段',
|
||||||
paragraphRules: '分段规则',
|
paragraphRules: '分段规则',
|
||||||
writeContent: '写入内容',
|
writeContent: '写入内容',
|
||||||
|
cancel: '取消执行',
|
||||||
|
cancelExecutionTip: '确定取消所选的任务?',
|
||||||
},
|
},
|
||||||
KnowledgeSource: {
|
KnowledgeSource: {
|
||||||
title: '知识来源',
|
title: '知识来源',
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ export default {
|
||||||
fail: '失败',
|
fail: '失败',
|
||||||
all: '全部',
|
all: '全部',
|
||||||
padding: '执行中',
|
padding: '执行中',
|
||||||
|
REVOKED: '已取消',
|
||||||
|
REVOKE: '取消中',
|
||||||
},
|
},
|
||||||
param: {
|
param: {
|
||||||
outputParam: '输出参数',
|
outputParam: '输出参数',
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,6 @@ export default {
|
||||||
PENDING: '排队中',
|
PENDING: '排队中',
|
||||||
GENERATE: '生成中',
|
GENERATE: '生成中',
|
||||||
SYNC: '同步中',
|
SYNC: '同步中',
|
||||||
REVOKE: '取消中',
|
|
||||||
finish: '完成',
|
finish: '完成',
|
||||||
},
|
},
|
||||||
enableStatus: {
|
enableStatus: {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ export default {
|
||||||
},
|
},
|
||||||
operation: {
|
operation: {
|
||||||
toImportDoc: '去导入文档',
|
toImportDoc: '去导入文档',
|
||||||
|
importWorkflow: '导入工作流',
|
||||||
|
exportWorkflow: '导出工作流',
|
||||||
},
|
},
|
||||||
setting: {
|
setting: {
|
||||||
restoreVersion: '恢复版本',
|
restoreVersion: '恢复版本',
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ export default {
|
||||||
documentSplitTip: '每個文件僅能預覽前五個段落',
|
documentSplitTip: '每個文件僅能預覽前五個段落',
|
||||||
paragraphRules: '分段規則',
|
paragraphRules: '分段規則',
|
||||||
writeContent: '寫入內容',
|
writeContent: '寫入內容',
|
||||||
|
cancel: '取消執行',
|
||||||
|
cancelExecutionTip: '確定取消所選的任務?',
|
||||||
},
|
},
|
||||||
KnowledgeSource: {
|
KnowledgeSource: {
|
||||||
title: '知識來源',
|
title: '知識來源',
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ export default {
|
||||||
fail: '失敗',
|
fail: '失敗',
|
||||||
all: '全部',
|
all: '全部',
|
||||||
padding: '執行中',
|
padding: '執行中',
|
||||||
|
REVOKED: '已取消',
|
||||||
|
REVOKE: '取消中',
|
||||||
},
|
},
|
||||||
param: {
|
param: {
|
||||||
outputParam: '輸出參數',
|
outputParam: '輸出參數',
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,6 @@ export default {
|
||||||
PENDING: '排隊中',
|
PENDING: '排隊中',
|
||||||
GENERATE: '生成中',
|
GENERATE: '生成中',
|
||||||
SYNC: '同步中',
|
SYNC: '同步中',
|
||||||
REVOKE: '取消中',
|
|
||||||
finish: '完圓',
|
finish: '完圓',
|
||||||
},
|
},
|
||||||
enableStatus: {
|
enableStatus: {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ export default {
|
||||||
},
|
},
|
||||||
operation: {
|
operation: {
|
||||||
toImportDoc: '去導入文檔',
|
toImportDoc: '去導入文檔',
|
||||||
|
importWorkflow: '導入工作流',
|
||||||
|
exportWorkflow: '導出工作流',
|
||||||
},
|
},
|
||||||
setting: {
|
setting: {
|
||||||
restoreVersion: '恢復版本',
|
restoreVersion: '恢復版本',
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ const taskTypeMap = {
|
||||||
const stateMap: any = {
|
const stateMap: any = {
|
||||||
[State.PENDING]: (type: number) => t('views.document.fileStatus.PENDING'),
|
[State.PENDING]: (type: number) => t('views.document.fileStatus.PENDING'),
|
||||||
[State.STARTED]: (type: number) => startedMap[type],
|
[State.STARTED]: (type: number) => startedMap[type],
|
||||||
[State.REVOKE]: (type: number) => t('views.document.fileStatus.REVOKE'),
|
[State.REVOKE]: (type: number) => t('common.status.REVOKE'),
|
||||||
[State.REVOKED]: (type: number) => t('common.status.success'),
|
[State.REVOKED]: (type: number) => t('common.status.success'),
|
||||||
[State.FAILURE]: (type: number) => t('common.status.fail'),
|
[State.FAILURE]: (type: number) => t('common.status.fail'),
|
||||||
[State.SUCCESS]: (type: number) => t('common.status.success'),
|
[State.SUCCESS]: (type: number) => t('common.status.success'),
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,14 @@
|
||||||
v-else-if="props.currentContent?.state === 'REVOKED'"
|
v-else-if="props.currentContent?.state === 'REVOKED'"
|
||||||
>
|
>
|
||||||
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
|
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
|
||||||
{{ $t('common.status.REVOKED', '已取消') }}
|
{{ $t('common.status.REVOKED') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text
|
<el-text
|
||||||
class="color-text-primary"
|
class="color-text-primary"
|
||||||
v-else-if="props.currentContent?.state === 'REVOKE'"
|
v-else-if="props.currentContent?.state === 'REVOKE'"
|
||||||
>
|
>
|
||||||
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
||||||
{{ $t('views.document.fileStatus.REVOKE', '取消中') }}
|
{{ $t('common.status.REVOKE') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text class="color-text-primary" v-else>
|
<el-text class="color-text-primary" v-else>
|
||||||
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,11 @@
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text class="color-text-primary" v-else-if="row.state === 'REVOKED'">
|
<el-text class="color-text-primary" v-else-if="row.state === 'REVOKED'">
|
||||||
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
|
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
|
||||||
{{ $t('common.status.REVOKED', '已取消') }}
|
{{ $t('common.status.REVOKED') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text class="color-text-primary" v-else-if="row.state === 'REVOKE'">
|
<el-text class="color-text-primary" v-else-if="row.state === 'REVOKE'">
|
||||||
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
||||||
{{ $t('views.document.fileStatus.REVOKE', '取消中') }}
|
{{ $t('common.status.REVOKE') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text class="color-text-primary" v-else>
|
<el-text class="color-text-primary" v-else>
|
||||||
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
<el-icon class="is-loading color-primary"><Loading /></el-icon>
|
||||||
|
|
@ -93,7 +93,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column :label="$t('common.operation')" width="80">
|
<el-table-column :label="$t('common.operation')" width="90">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-tooltip effect="dark" :content="$t('chat.executionDetails.title')" placement="top">
|
<el-tooltip effect="dark" :content="$t('chat.executionDetails.title')" placement="top">
|
||||||
|
|
@ -103,10 +103,11 @@
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:content="$t('chat.executionDetails.cancel', '取消')"
|
:content="$t('chat.executionDetails.cancel')"
|
||||||
placement="top"
|
placement="top"
|
||||||
|
v-if="row.state === 'PADDING'"
|
||||||
>
|
>
|
||||||
<el-button type="primary" text @click.stop="cancel(row)">
|
<el-button type="danger" text @click.stop="cancelExecution(row)">
|
||||||
<el-icon><CircleCloseFilled /></el-icon>
|
<el-icon><CircleCloseFilled /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
@ -133,6 +134,8 @@ import { computed, ref, reactive } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
import type { Dict } from '@/api/type/common'
|
import type { Dict } from '@/api/type/common'
|
||||||
|
import { MsgError, MsgConfirm } from '@/utils/message'
|
||||||
|
import { t } from '@/locales'
|
||||||
const drawer = ref<boolean>(false)
|
const drawer = ref<boolean>(false)
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
|
|
@ -176,10 +179,15 @@ const toDetails = (row: any) => {
|
||||||
ExecutionDetailDrawerRef.value?.open()
|
ExecutionDetailDrawerRef.value?.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
const cancel = (row: any) => {
|
const cancelExecution = (row: any) => {
|
||||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
MsgConfirm(t('common.tip'), t('chat.executionDetails.cancelExecutionTip'), {
|
||||||
.cancelWorkflowAction(active_knowledge_id.value, row.id, loading)
|
confirmButtonText: t('common.confirm'),
|
||||||
.then((ok: any) => {})
|
confirmButtonClass: 'danger',
|
||||||
|
}).then(() => {
|
||||||
|
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||||
|
.cancelWorkflowAction(active_knowledge_id.value, row.id, loading)
|
||||||
|
.then((ok: any) => {})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const changeFilterHandle = () => {
|
const changeFilterHandle = () => {
|
||||||
query.value = { user_name: '', status: '' }
|
query.value = { user_name: '', status: '' }
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,6 @@
|
||||||
<AppIcon iconName="app-to-import-doc" class="color-secondary"></AppIcon>
|
<AppIcon iconName="app-to-import-doc" class="color-secondary"></AppIcon>
|
||||||
{{ $t('workflow.operation.toImportDoc') }}
|
{{ $t('workflow.operation.toImportDoc') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
|
||||||
@click.stop="exportKnowledgeWorkflow(detail.name, detail.id)"
|
|
||||||
v-if="permissionPrecise.workflow_export(id)"
|
|
||||||
>
|
|
||||||
<AppIcon iconName="app-export" class="color-secondary"></AppIcon>
|
|
||||||
{{ $t('common.export') }}
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-upload
|
<el-upload
|
||||||
class="import-button"
|
class="import-button"
|
||||||
ref="elUploadRef"
|
ref="elUploadRef"
|
||||||
|
|
@ -80,9 +73,17 @@
|
||||||
>
|
>
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<AppIcon iconName="app-import" class="color-secondary"></AppIcon>
|
<AppIcon iconName="app-import" class="color-secondary"></AppIcon>
|
||||||
{{ $t('common.import', '导入') }}
|
{{ $t('workflow.operation.importWorkflow') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<el-dropdown-item
|
||||||
|
@click.stop="exportKnowledgeWorkflow(detail.name, detail.id)"
|
||||||
|
v-if="permissionPrecise.workflow_export(id)"
|
||||||
|
>
|
||||||
|
<AppIcon iconName="app-export" class="color-secondary"></AppIcon>
|
||||||
|
{{ $t('workflow.operation.exportWorkflow') }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
|
||||||
<el-dropdown-item @click="openListAction" divided>
|
<el-dropdown-item @click="openListAction" divided>
|
||||||
<AppIcon iconName="app-execution-record" class="color-secondary"></AppIcon>
|
<AppIcon iconName="app-execution-record" class="color-secondary"></AppIcon>
|
||||||
{{ $t('workflow.ExecutionRecord') }}
|
{{ $t('workflow.ExecutionRecord') }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue