mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-27 20:42:52 +00:00
This commit is contained in:
parent
85138e4e2b
commit
28f315fc3c
|
|
@ -27,10 +27,7 @@
|
|||
<p>{{ $t('views.document.generateQuestion.tip4') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item
|
||||
:label="$t('views.application.form.aiModel.label')"
|
||||
prop="model_id"
|
||||
>
|
||||
<el-form-item :label="$t('views.application.form.aiModel.label')" prop="model_id">
|
||||
<ModelSelect
|
||||
v-model="form.model_id"
|
||||
:placeholder="$t('views.application.form.aiModel.placeholder')"
|
||||
|
|
@ -39,10 +36,7 @@
|
|||
:model-type="'LLM'"
|
||||
></ModelSelect>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('views.application.form.prompt.label')"
|
||||
prop="prompt"
|
||||
>
|
||||
<el-form-item :label="$t('views.application.form.prompt.label')" prop="prompt">
|
||||
<el-input
|
||||
v-model="form.prompt"
|
||||
:placeholder="$t('views.application.form.prompt.placeholder')"
|
||||
|
|
@ -88,7 +82,7 @@ import type { FormInstance } from 'element-plus'
|
|||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId } // id为knowledgeID
|
||||
params: { id, documentId }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const { model, prompt, user } = useStore()
|
||||
|
|
@ -104,7 +98,7 @@ const apiType = ref('') // 文档document或段落paragraph
|
|||
const state = ref<'all' | 'error'>('error')
|
||||
const stateMap = {
|
||||
all: ['0', '1', '2', '3', '4', '5', 'n'],
|
||||
error: ['0', '1', '3', '4', '5', 'n']
|
||||
error: ['0', '1', '3', '4', '5', 'n'],
|
||||
}
|
||||
const FormRef = ref()
|
||||
const knowledgeId = ref<string>()
|
||||
|
|
@ -115,16 +109,16 @@ const rules = reactive({
|
|||
{
|
||||
required: true,
|
||||
message: t('views.application.form.aiModel.placeholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
prompt: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.form.prompt.placeholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
|
|
@ -153,7 +147,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
if (apiType.value === 'paragraph') {
|
||||
const data = {
|
||||
...form.value,
|
||||
paragraph_id_list: idList.value
|
||||
paragraph_id_list: idList.value,
|
||||
}
|
||||
paragraphApi.putBatchGenerateRelated(id, documentId, data, loading).then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
|
|
@ -164,7 +158,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
const data = {
|
||||
...form.value,
|
||||
document_id_list: idList.value,
|
||||
state_list: stateMap[state.value]
|
||||
state_list: stateMap[state.value],
|
||||
}
|
||||
documentApi.putBatchGenerateRelated(id, data, loading).then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
|
|
@ -174,7 +168,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
} else if (apiType.value === 'knowledge') {
|
||||
const data = {
|
||||
...form.value,
|
||||
state_list: stateMap[state.value]
|
||||
state_list: stateMap[state.value],
|
||||
}
|
||||
knowledgeApi.putGenerateRelated(id ? id : knowledgeId.value, data, loading).then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
width: 280px;
|
||||
.el-dropdown-menu__item {
|
||||
padding: 8px 12px;
|
||||
width: 100%;
|
||||
&:hover {
|
||||
background: var(--app-text-color-light-1);
|
||||
}
|
||||
|
|
@ -122,7 +123,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.card__radio {
|
||||
width: 100%;
|
||||
display: block;
|
||||
|
|
@ -173,3 +173,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
.import-button {
|
||||
.el-upload {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
.md-editor {
|
||||
font-weight: 400;
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.md-editor-preview {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,14 @@
|
|||
</el-select>
|
||||
</div>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="primary" class="ml-8"
|
||||
v-hasPermission="[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.APPLICATION_EDIT.getWorkspacePermission]">
|
||||
<el-button
|
||||
type="primary"
|
||||
class="ml-8"
|
||||
v-hasPermission="[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_EDIT.getWorkspacePermission,
|
||||
]"
|
||||
>
|
||||
{{ $t('common.create') }}
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down />
|
||||
|
|
@ -87,6 +93,7 @@
|
|||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-upload
|
||||
class="import-button"
|
||||
ref="elUploadRef"
|
||||
:file-list="[]"
|
||||
action="#"
|
||||
|
|
@ -218,14 +225,33 @@
|
|||
<AppIcon iconName="app-create-chat"></AppIcon>
|
||||
{{ $t('views.application.operation.toChat') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.stop="settingApplication(item)"
|
||||
v-if="hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.APPLICATION_EDIT.getWorkspacePermission],'OR')"
|
||||
<el-dropdown-item
|
||||
@click.stop="settingApplication(item)"
|
||||
v-if="
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_EDIT.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
>
|
||||
<el-icon><Setting /></el-icon>
|
||||
{{ $t('common.setting') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided @click.stop="exportApplication(item)"
|
||||
v-if="hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.APPLICATION_EXPORT.getWorkspacePermission],'OR')"
|
||||
<el-dropdown-item
|
||||
divided
|
||||
@click.stop="exportApplication(item)"
|
||||
v-if="
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_EXPORT.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
>
|
||||
<AppIcon iconName="app-export"></AppIcon>
|
||||
{{ $t('common.export') }}
|
||||
|
|
@ -234,7 +260,15 @@
|
|||
divided
|
||||
icon="Delete"
|
||||
@click.stop="deleteApplication(item)"
|
||||
v-if="hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.APPLICATION_DELETE.getWorkspacePermission],'OR')"
|
||||
v-if="
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_DELETE.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
>{{ $t('common.delete') }}</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
class="paragraph-box cursor"
|
||||
@mouseenter="cardEnter()"
|
||||
@mouseleave="cardLeave()"
|
||||
@click.stop="editParagraph(data)"
|
||||
>
|
||||
<h2 class="mb-16">{{ data.title || '-' }}</h2>
|
||||
<div v-show="show" class="mk-sticky">
|
||||
|
|
@ -11,6 +12,7 @@
|
|||
class="paragraph-box-operation mt-8 mr-8"
|
||||
shadow="always"
|
||||
style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px"
|
||||
@click.stop
|
||||
>
|
||||
<el-switch
|
||||
:loading="changeStateloading"
|
||||
|
|
@ -21,7 +23,7 @@
|
|||
|
||||
<el-divider direction="vertical" />
|
||||
<span class="mr-8">
|
||||
<el-button link @click="editParagraph(data)">
|
||||
<el-button link @click.stop="editParagraph(data)">
|
||||
<el-icon :size="16" :title="$t('views.applicationWorkflow.control.zoomOut')">
|
||||
<EditPen />
|
||||
</el-icon>
|
||||
|
|
@ -40,11 +42,11 @@
|
|||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="openGenerateDialog(data)">
|
||||
<el-dropdown-item @click.stop="openGenerateDialog(data)">
|
||||
<el-icon><Connection /></el-icon>
|
||||
{{ $t('views.document.generateQuestion.title') }}</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click="openSelectDocumentDialog(data)">
|
||||
<el-dropdown-item @click.stop="openSelectDocumentDialog(data)">
|
||||
<AppIcon iconName="app-migrate"></AppIcon>
|
||||
{{ $t('views.document.setting.migration') }}</el-dropdown-item
|
||||
>
|
||||
|
|
@ -77,6 +79,7 @@ import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vu
|
|||
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
||||
import SelectDocumentDialog from '@/views/paragraph/component/SelectDocumentDialog.vue'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { elPaginationKey } from 'element-plus'
|
||||
|
||||
const { paragraph } = useStore()
|
||||
|
||||
|
|
@ -121,7 +124,7 @@ function changeState(row: any) {
|
|||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||
function openGenerateDialog(row: any) {
|
||||
if (GenerateRelatedDialogRef.value) {
|
||||
GenerateRelatedDialogRef.value.open([], 'knowledge', row.id)
|
||||
GenerateRelatedDialogRef.value.open([], 'paragraph', row.id)
|
||||
}
|
||||
}
|
||||
function openSelectDocumentDialog(row?: any) {
|
||||
|
|
@ -165,8 +168,8 @@ function refreshMigrateParagraph() {}
|
|||
background: var(--app-layout-bg-color);
|
||||
border: 1px solid #ffffff;
|
||||
box-shadow: none !important;
|
||||
position: relative;
|
||||
overflow: inherit;
|
||||
// position: relative;
|
||||
// overflow: inherit;
|
||||
&:hover {
|
||||
background: rgba(31, 35, 41, 0.1);
|
||||
border: 1px solid #dee0e3;
|
||||
|
|
@ -181,13 +184,13 @@ function refreshMigrateParagraph() {}
|
|||
float: right;
|
||||
}
|
||||
|
||||
.mk-sticky {
|
||||
height: 0;
|
||||
position: sticky;
|
||||
right: 0;
|
||||
top: 0;
|
||||
overflow: inherit;
|
||||
z-index: 10;
|
||||
}
|
||||
// .mk-sticky {
|
||||
// height: 0;
|
||||
// position: sticky;
|
||||
// right: 0;
|
||||
// top: 0;
|
||||
// overflow: inherit;
|
||||
// z-index: 10;
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -344,9 +344,10 @@ onMounted(() => {
|
|||
max-width: 1000px;
|
||||
margin: 16px auto;
|
||||
|
||||
// .el-checkbox-group {
|
||||
// display: flex;
|
||||
// }
|
||||
.el-checkbox-group {
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
&__main {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
class="paragraph-box cursor"
|
||||
@mouseenter="cardEnter()"
|
||||
@mouseleave="cardLeave()"
|
||||
@click.stop="editParagraph(data)"
|
||||
>
|
||||
<h2 class="mb-16">{{ data.title || '-' }}</h2>
|
||||
<div v-show="show" class="mk-sticky">
|
||||
|
|
@ -11,6 +12,7 @@
|
|||
class="paragraph-box-operation mt-8 mr-8"
|
||||
shadow="always"
|
||||
style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px"
|
||||
@click.stop
|
||||
>
|
||||
<el-switch
|
||||
:loading="changeStateloading"
|
||||
|
|
@ -121,7 +123,7 @@ function changeState(row: any) {
|
|||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||
function openGenerateDialog(row: any) {
|
||||
if (GenerateRelatedDialogRef.value) {
|
||||
GenerateRelatedDialogRef.value.open([], 'knowledge', row.id)
|
||||
GenerateRelatedDialogRef.value.open([], 'paragraph', row.id)
|
||||
}
|
||||
}
|
||||
function openSelectDocumentDialog(row?: any) {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ function changeState(row: any) {
|
|||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||
function openGenerateDialog(row: any) {
|
||||
if (GenerateRelatedDialogRef.value) {
|
||||
GenerateRelatedDialogRef.value.open([], 'knowledge', row.id)
|
||||
GenerateRelatedDialogRef.value.open([], 'paragraph', row.id)
|
||||
}
|
||||
}
|
||||
function openSelectDocumentDialog(row?: any) {
|
||||
|
|
|
|||
|
|
@ -45,8 +45,13 @@
|
|||
</el-select>
|
||||
</div>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="primary" class="ml-8"
|
||||
v-hasPermission="[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.TOOL_CREATE.getWorkspacePermission]"
|
||||
<el-button
|
||||
type="primary"
|
||||
class="ml-8"
|
||||
v-hasPermission="[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.TOOL_CREATE.getWorkspacePermission,
|
||||
]"
|
||||
>
|
||||
{{ $t('common.create') }}
|
||||
<el-icon class="el-icon--right">
|
||||
|
|
@ -65,18 +70,19 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-upload
|
||||
ref="elUploadRef"
|
||||
:file-list="[]"
|
||||
action="#"
|
||||
multiple
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
:limit="1"
|
||||
:on-change="(file: any, fileList: any) => importTool(file)"
|
||||
>
|
||||
<div class="flex align-center">
|
||||
<el-upload
|
||||
ref="elUploadRef"
|
||||
:file-list="[]"
|
||||
action="#"
|
||||
multiple
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
:limit="1"
|
||||
:on-change="(file: any, fileList: any) => importTool(file)"
|
||||
class="import-button"
|
||||
>
|
||||
<el-dropdown-item class="w-full">
|
||||
<div class="flex align-center w-full">
|
||||
<el-avatar shape="square" class="mt-4" :size="36" style="background: none">
|
||||
<img src="@/assets/icon_import.svg" alt="" />
|
||||
</el-avatar>
|
||||
|
|
@ -84,8 +90,8 @@
|
|||
<div class="lighter">{{ $t('common.importCreate') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-item>
|
||||
</el-upload>
|
||||
<el-dropdown-item @click="openCreateFolder" divided>
|
||||
<div class="flex align-center">
|
||||
<AppIcon iconName="app-folder" style="font-size: 32px"></AppIcon>
|
||||
|
|
@ -177,7 +183,10 @@
|
|||
:before-change="() => changeState(item)"
|
||||
size="small"
|
||||
class="mr-4"
|
||||
v-hasPermission="[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.TOOL_EDIT.getWorkspacePermission]"
|
||||
v-hasPermission="[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.TOOL_EDIT.getWorkspacePermission,
|
||||
]"
|
||||
/>
|
||||
<el-divider direction="vertical" />
|
||||
<el-dropdown trigger="click">
|
||||
|
|
@ -189,7 +198,16 @@
|
|||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-if="!item.template_id&&hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.TOOL_EDIT.getWorkspacePermission],'OR')"
|
||||
v-if="
|
||||
!item.template_id &&
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.TOOL_EDIT.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
:disabled="!canEdit(item)"
|
||||
@click.stop="openCreateDialog(item)"
|
||||
>
|
||||
|
|
@ -200,7 +218,16 @@
|
|||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:disabled="!canEdit(item)"
|
||||
v-if="!item.template_id&&hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.TOOL_EXPORT.getWorkspacePermission],'OR')"
|
||||
v-if="
|
||||
!item.template_id &&
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.TOOL_EXPORT.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
@click.stop="copyTool(item)"
|
||||
>
|
||||
<AppIcon iconName="app-copy"></AppIcon>
|
||||
|
|
@ -215,7 +242,16 @@
|
|||
{{ $t('common.param.initParam') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="!item.template_id&&hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.TOOL_EXPORT.getWorkspacePermission],'OR')"
|
||||
v-if="
|
||||
!item.template_id &&
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.TOOL_EXPORT.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
:disabled="!canEdit(item)"
|
||||
@click.stop="exportTool(item)"
|
||||
>
|
||||
|
|
@ -223,7 +259,15 @@
|
|||
{{ $t('common.export') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.TOOL_DELETE.getWorkspacePermission],'OR')"
|
||||
v-if="
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.TOOL_DELETE.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
"
|
||||
:disabled="!canEdit(item)"
|
||||
divided
|
||||
@click.stop="deleteTool(item)"
|
||||
|
|
@ -264,7 +308,6 @@ import SharedWorkspace from '@/views/shared/tool-shared/SharedWorkspace.vue'
|
|||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
|
||||
|
||||
const { folder, user } = useStore()
|
||||
|
||||
const InitParamDrawerRef = ref()
|
||||
|
|
|
|||
Loading…
Reference in New Issue