mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
Merge branch 'v2' of https://github.com/maxkb-dev/maxkb into v2
This commit is contained in:
commit
bdf75ba3f0
|
|
@ -79,6 +79,13 @@ const putTool: (tool_id: string, data: toolData, loading?: Ref<boolean>) => Prom
|
|||
return put(`${prefix}/${tool_id}`, data, undefined, loading)
|
||||
}
|
||||
|
||||
const postToolTestConnection: (data: toolData, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||
data,
|
||||
loading,
|
||||
) => {
|
||||
return post(`${prefix}/test_connection`, data, undefined, loading)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除工具
|
||||
|
|
@ -133,4 +140,5 @@ export default {
|
|||
exportTool,
|
||||
putToolIcon,
|
||||
delTool,
|
||||
postToolTestConnection
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="upload-document__component main-calc-height">
|
||||
<el-scrollbar>
|
||||
<div class="upload-component p-24" style="min-width: 850px">
|
||||
<keep-alive>
|
||||
<keep-alive :key="key" :include="['data_source', 'knowledge_base']">
|
||||
<component
|
||||
ref="ActionRef"
|
||||
:is="ak[active]"
|
||||
|
|
@ -25,7 +25,9 @@
|
|||
</div>
|
||||
</el-card>
|
||||
<div class="upload-document__footer text-right border-t">
|
||||
<el-button :disabled="loading" @click="router.go(-1)">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button v-if="active == 'result'" @click="continueImporting">
|
||||
{{ $t('views.document.buttons.continueImporting') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="base_form_list.length > 0 && active == 'knowledge_base'"
|
||||
:loading="loading"
|
||||
|
|
@ -48,23 +50,27 @@
|
|||
>
|
||||
{{ $t('views.document.buttons.import') }}
|
||||
</el-button>
|
||||
<el-button v-if="active == 'result'" type="primary" @click="goDocument">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toDocument')
|
||||
}}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, provide, type Ref, onMounted } from 'vue'
|
||||
import { computed, ref, provide, type Ref, onMounted, nextTick } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import DataSource from '@/views/knowledge-workflow/component/action/DataSource.vue'
|
||||
import Result from '@/views/knowledge-workflow/component/action/Result.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import KnowledgeBase from '@/views/knowledge-workflow/component/action/KnowledgeBase.vue'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api.ts'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import { WorkflowType } from '@/enums/application'
|
||||
provide('upload', (file: any, loading?: Ref<boolean>) => {
|
||||
return applicationApi.postUploadFile(file, id as string, 'KNOWLEDGE', loading)
|
||||
})
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const key = ref<number>(0)
|
||||
const {
|
||||
params: { folderId },
|
||||
query: { id },
|
||||
|
|
@ -132,7 +138,23 @@ function getDetail() {
|
|||
_workflow.value = res.data.work_flow
|
||||
})
|
||||
}
|
||||
|
||||
const continueImporting = () => {
|
||||
active.value = 'data_source'
|
||||
key.value++
|
||||
action_id.value = undefined
|
||||
const c_workflow = _workflow.value
|
||||
_workflow.value = null
|
||||
form_data.value = {}
|
||||
nextTick(() => {
|
||||
_workflow.value = c_workflow
|
||||
})
|
||||
}
|
||||
const goDocument = () => {
|
||||
const newUrl = router.resolve({
|
||||
path: `/knowledge/${id}/${folderId}/4/document`,
|
||||
}).href
|
||||
window.open(newUrl)
|
||||
}
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
:before-close="close"
|
||||
>
|
||||
<div style="height: calc(100% - 57px)" v-loading="loading">
|
||||
<keep-alive>
|
||||
<keep-alive :key="key" :include="['data_source', 'knowledge_base']">
|
||||
<component
|
||||
ref="ActionRef"
|
||||
:is="ak[active]"
|
||||
|
|
@ -20,10 +20,9 @@
|
|||
</keep-alive>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button :loading="loading" @click="close">{{ $t('common.cancel') }}</el-button>
|
||||
<!-- <el-button v-if="active == 'result'" @click="continueImporting" :loading="loading">
|
||||
<el-button v-if="active == 'result'" @click="continueImporting">
|
||||
{{ $t('views.document.buttons.continueImporting') }}
|
||||
</el-button> -->
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="base_form_list.length > 0 && active == 'knowledge_base'"
|
||||
:loading="loading"
|
||||
|
|
@ -46,35 +45,29 @@
|
|||
>
|
||||
{{ $t('views.document.buttons.import') }}
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
v-if="active == 'result'"
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/4/document`,
|
||||
})
|
||||
"
|
||||
>{{ $t('views.knowledge.ResultSuccess.buttons.toDocument') }}</el-button
|
||||
> -->
|
||||
<el-button v-if="active == 'result'" type="primary" @click="goDocument">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toDocument')
|
||||
}}</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, provide, type Ref } from 'vue'
|
||||
import { computed, ref, provide, type Ref, nextTick } from 'vue'
|
||||
import DataSource from '@/views/knowledge-workflow/component/action/DataSource.vue'
|
||||
import Result from '@/views/knowledge-workflow/component/action/Result.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import KnowledgeBase from '@/views/knowledge-workflow/component/action/KnowledgeBase.vue'
|
||||
import { WorkflowType } from '@/enums/application'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api.ts'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import permissionMap from '@/permission'
|
||||
import { MsgError } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
provide('upload', (file: any, loading?: Ref<boolean>) => {
|
||||
return applicationApi.postUploadFile(file, id, 'KNOWLEDGE', loading)
|
||||
})
|
||||
const key = ref<number>(0)
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
|
|
@ -153,8 +146,21 @@ const upload = () => {
|
|||
}
|
||||
}
|
||||
const continueImporting = () => {
|
||||
action_id.value = undefined
|
||||
active.value = 'data_source'
|
||||
key.value++
|
||||
action_id.value = undefined
|
||||
const c_workflow = _workflow.value
|
||||
_workflow.value = null
|
||||
form_data.value = {}
|
||||
nextTick(() => {
|
||||
_workflow.value = c_workflow
|
||||
})
|
||||
}
|
||||
const goDocument = () => {
|
||||
const newUrl = router.resolve({
|
||||
path: `/knowledge/${id}/${folderId}/4/document`,
|
||||
}).href
|
||||
window.open(newUrl)
|
||||
}
|
||||
defineExpose({ close, open })
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
prop="node_id"
|
||||
:rules="base_form_data_rule.node_id"
|
||||
>
|
||||
<el-row class="w-full" gutter="8">
|
||||
<el-row class="w-full" :gutter="8">
|
||||
<el-col :span="8" v-for="node in source_node_list" :key="node.id">
|
||||
<el-card
|
||||
shadow="never"
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@
|
|||
</h4>
|
||||
<div class="mb-16">
|
||||
<!-- 执行结果 -->
|
||||
<!-- <el-alert
|
||||
v-if="isSuccess"
|
||||
:title="$t('views.workflow.debug.executionSuccess')"
|
||||
type="success"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
<el-alert
|
||||
v-else
|
||||
:title="$t('views.workflow.debug.executionFailed')"
|
||||
type="error"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/> -->
|
||||
<el-alert
|
||||
v-if="state == 'SUCCESS'"
|
||||
:title="$t('views.workflow.debug.executionSuccess')"
|
||||
type="success"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
<el-alert
|
||||
v-if="state == 'FAILURE'"
|
||||
:title="$t('views.workflow.debug.executionFailed')"
|
||||
type="error"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
</div>
|
||||
<p class="lighter mb-8">{{ $t('chat.executionDetails.title') }}</p>
|
||||
<ExecutionDetailContent :detail="detail" app-type="WORK_FLOW"></ExecutionDetailContent>
|
||||
|
|
@ -45,10 +45,15 @@ const knowledge_action = ref<any>()
|
|||
let pollingTimer: any = null
|
||||
|
||||
const getKnowledgeWorkflowAction = () => {
|
||||
if (pollingTimer == null) {
|
||||
return
|
||||
}
|
||||
knowledgeApi
|
||||
.getWorkflowAction(props.knowledge_id, props.id)
|
||||
.then((ok) => {
|
||||
knowledge_action.value = ok.data
|
||||
})
|
||||
.finally(() => {
|
||||
if (['SUCCESS', 'FAILURE', 'REVOKED'].includes(state.value)) {
|
||||
stopPolling()
|
||||
} else {
|
||||
|
|
@ -56,10 +61,6 @@ const getKnowledgeWorkflowAction = () => {
|
|||
pollingTimer = setTimeout(getKnowledgeWorkflowAction, 2000)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 错误时也继续轮询
|
||||
pollingTimer = setTimeout(getKnowledgeWorkflowAction, 2000)
|
||||
})
|
||||
}
|
||||
|
||||
const stopPolling = () => {
|
||||
|
|
@ -70,8 +71,7 @@ const stopPolling = () => {
|
|||
}
|
||||
|
||||
// 启动轮询
|
||||
getKnowledgeWorkflowAction()
|
||||
|
||||
pollingTimer = setTimeout(getKnowledgeWorkflowAction, 0)
|
||||
onUnmounted(() => {
|
||||
stopPolling()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -272,8 +272,7 @@
|
|||
<el-dropdown-item
|
||||
v-if="
|
||||
!item.template_id &&
|
||||
permissionPrecise.copy(item.id) &&
|
||||
item.tool_type !== 'MCP'
|
||||
permissionPrecise.copy(item.id)
|
||||
"
|
||||
@click.stop="copyTool(item)"
|
||||
>
|
||||
|
|
@ -316,8 +315,7 @@
|
|||
<el-dropdown-item
|
||||
v-if="
|
||||
!item.template_id &&
|
||||
permissionPrecise.export(item.id) &&
|
||||
item.tool_type !== 'MCP'
|
||||
permissionPrecise.export(item.id)
|
||||
"
|
||||
@click.stop="exportTool(item)"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -180,8 +180,6 @@ import type { FormInstance } from 'element-plus'
|
|||
import { t } from '@/locales'
|
||||
import { useRoute } from 'vue-router'
|
||||
import DropdownMenu from '@/components/workflow-dropdown-menu/index.vue'
|
||||
const w = inject('workflowMode')
|
||||
console.log(w)
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
|
|
|
|||
Loading…
Reference in New Issue