mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: Application workflow debug use --bug=1059999 --user=张展玮 【资源管理】继承系统管理员角色的用户,在资源管理中调试应用无权限 https://www.tapd.cn/62980211/s/1749113
This commit is contained in:
parent
1a17c7c5df
commit
c48aa77f2f
|
|
@ -1,90 +1,43 @@
|
|||
<template>
|
||||
<div
|
||||
ref="aiChatRef"
|
||||
class="ai-chat"
|
||||
:class="type"
|
||||
:style="{
|
||||
height: firsUserInput ? '100%' : undefined,
|
||||
paddingBottom: applicationDetails.disclaimer ? '20px' : 0,
|
||||
}"
|
||||
>
|
||||
<div
|
||||
v-show="showUserInputContent"
|
||||
:class="firsUserInput ? 'firstUserInput' : 'popperUserInput'"
|
||||
>
|
||||
<UserForm
|
||||
v-model:api_form_data="api_form_data"
|
||||
v-model:form_data="form_data"
|
||||
:application="applicationDetails"
|
||||
:type="type"
|
||||
:first="firsUserInput"
|
||||
@confirm="UserFormConfirm"
|
||||
@cancel="UserFormCancel"
|
||||
ref="userFormRef"
|
||||
></UserForm>
|
||||
<div ref="aiChatRef" class="ai-chat" :class="type" :style="{
|
||||
height: firsUserInput ? '100%' : undefined,
|
||||
paddingBottom: applicationDetails.disclaimer ? '20px' : 0,
|
||||
}">
|
||||
<div v-show="showUserInputContent" :class="firsUserInput ? 'firstUserInput' : 'popperUserInput'">
|
||||
<UserForm v-model:api_form_data="api_form_data" v-model:form_data="form_data" :application="applicationDetails"
|
||||
:type="type" :first="firsUserInput" @confirm="UserFormConfirm" @cancel="UserFormCancel" ref="userFormRef">
|
||||
</UserForm>
|
||||
</div>
|
||||
<template v-if="!(isUserInput || isAPIInput) || !firsUserInput || type === 'log'">
|
||||
<el-scrollbar ref="scrollDiv" @scroll="handleScrollTop">
|
||||
<div ref="dialogScrollbar" class="ai-chat__content p-16">
|
||||
<PrologueContent
|
||||
:type="type"
|
||||
:application="applicationDetails"
|
||||
:available="available"
|
||||
:send-message="sendMessage"
|
||||
></PrologueContent>
|
||||
<PrologueContent :type="type" :application="applicationDetails" :available="available"
|
||||
:send-message="sendMessage"></PrologueContent>
|
||||
|
||||
<template v-for="(item, index) in chatList" :key="index">
|
||||
<!-- 问题 -->
|
||||
<QuestionContent
|
||||
:type="type"
|
||||
:application="applicationDetails"
|
||||
:chat-record="item"
|
||||
></QuestionContent>
|
||||
<QuestionContent :type="type" :application="applicationDetails" :chat-record="item"></QuestionContent>
|
||||
<!-- 回答 -->
|
||||
<AnswerContent
|
||||
:application="applicationDetails"
|
||||
:loading="loading"
|
||||
v-model:chat-record="chatList[index]"
|
||||
:type="type"
|
||||
:send-message="sendMessage"
|
||||
:chat-management="ChatManagement"
|
||||
<AnswerContent :application="applicationDetails" :loading="loading" v-model:chat-record="chatList[index]"
|
||||
:type="type" :send-message="sendMessage" :chat-management="ChatManagement"
|
||||
:executionIsRightPanel="props.executionIsRightPanel"
|
||||
@open-execution-detail="emit('openExecutionDetail', chatList[index])"
|
||||
@openParagraph="emit('openParagraph', chatList[index])"
|
||||
@openParagraphDocument="
|
||||
@openParagraph="emit('openParagraph', chatList[index])" @openParagraphDocument="
|
||||
(val: any) => emit('openParagraphDocument', chatList[index], val)
|
||||
"
|
||||
></AnswerContent>
|
||||
"></AnswerContent>
|
||||
</template>
|
||||
<TransitionContent
|
||||
v-if="transcribing"
|
||||
:text="t('chat.transcribing')"
|
||||
:type="type"
|
||||
:application="applicationDetails"
|
||||
></TransitionContent>
|
||||
<TransitionContent v-if="transcribing" :text="t('chat.transcribing')" :type="type"
|
||||
:application="applicationDetails">
|
||||
</TransitionContent>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
|
||||
<ChatInputOperate
|
||||
:app-id="appId"
|
||||
:application-details="applicationDetails"
|
||||
:is-mobile="isMobile"
|
||||
:type="type"
|
||||
:send-message="sendMessage"
|
||||
:open-chat-id="openChatId"
|
||||
:validate="validate"
|
||||
:chat-management="ChatManagement"
|
||||
v-model:chat-id="chartOpenId"
|
||||
v-model:loading="loading"
|
||||
v-model:show-user-input="showUserInput"
|
||||
v-if="type !== 'log'"
|
||||
>
|
||||
<ChatInputOperate :app-id="appId" :application-details="applicationDetails" :is-mobile="isMobile" :type="type"
|
||||
:send-message="sendMessage" :open-chat-id="openChatId" :validate="validate" :chat-management="ChatManagement"
|
||||
v-model:chat-id="chartOpenId" v-model:loading="loading" v-model:show-user-input="showUserInput"
|
||||
v-if="type !== 'log'">
|
||||
<template #userInput>
|
||||
<el-button
|
||||
v-if="isUserInput || isAPIInput"
|
||||
class="user-input-button mb-8"
|
||||
@click="toggleUserInput"
|
||||
>
|
||||
<el-button v-if="isUserInput || isAPIInput" class="user-input-button mb-8" @click="toggleUserInput">
|
||||
<AppIcon iconName="app-edit" :size="16" class="mr-4"></AppIcon>
|
||||
<span class="ellipsis">
|
||||
{{ userInputTitle || $t('chat.userInput') }}
|
||||
|
|
@ -102,6 +55,7 @@ import { type Ref, ref, nextTick, computed, watch, reactive, onMounted, onBefore
|
|||
import { useRoute } from 'vue-router'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import chatAPI from '@/api/chat/chat'
|
||||
import SystemResourceManagementApplicationAPI from "@/api/system-resource-management/application.ts"
|
||||
import chatLogApi from '@/api/application/chat-log'
|
||||
import { ChatManagement, type chatType } from '@/api/type/application'
|
||||
import { randomId } from '@/utils/common'
|
||||
|
|
@ -329,7 +283,11 @@ const getChatMessageAPI = () => {
|
|||
}
|
||||
const getOpenChatAPI = () => {
|
||||
if (props.type === 'debug-ai-chat') {
|
||||
return applicationApi.open
|
||||
if (route.path.includes('resource-management')) {
|
||||
return SystemResourceManagementApplicationAPI.open
|
||||
} else {
|
||||
return applicationApi.open
|
||||
}
|
||||
} else {
|
||||
return (a?: string, loading?: Ref<boolean>) => {
|
||||
return chatAPI.open(loading)
|
||||
|
|
@ -650,20 +608,24 @@ defineExpose({
|
|||
</script>
|
||||
<style lang="scss">
|
||||
@use './index.scss';
|
||||
|
||||
.firstUserInput {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
|
||||
.user-form-container {
|
||||
max-width: 70%;
|
||||
}
|
||||
}
|
||||
|
||||
.debug-ai-chat {
|
||||
.user-form-container {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.popperUserInput {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
|
|
@ -675,10 +637,12 @@ defineExpose({
|
|||
|
||||
.video-stop-button {
|
||||
box-shadow: 0px 6px 24px 0px rgba(31, 35, 41, 0.08);
|
||||
|
||||
&:hover {
|
||||
background: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 768px) {
|
||||
.firstUserInput {
|
||||
.user-form-container {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,14 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
debug: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.RESOURCE_APPLICATION_DEBUG
|
||||
],
|
||||
'OR'
|
||||
),
|
||||
folderDelete: () => false,
|
||||
overview_embed: () =>
|
||||
hasPermission(
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ const workspace = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
debug: (source_id:string) =>
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(source_id)],[],'AND'),
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_DEBUG.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_DEBUG.getApplicationWorkspaceResourcePermission(source_id)
|
||||
],
|
||||
'OR'
|
||||
),
|
||||
folderEdit: () =>
|
||||
hasPermission(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<el-button icon="Plus" @click="showPopover = !showPopover">
|
||||
{{ $t('views.applicationWorkflow.setting.addComponent') }}
|
||||
</el-button>
|
||||
<el-button @click="clickShowDebug" :disabled="showDebug">
|
||||
<el-button @click="clickShowDebug" :disabled="showDebug" v-if="permissionPrecise.debug(id)">
|
||||
<AppIcon iconName="app-debug-outlined" class="mr-4"></AppIcon>
|
||||
{{ $t('views.applicationWorkflow.setting.debug') }}
|
||||
</el-button>
|
||||
|
|
@ -156,6 +156,7 @@ import { hasPermission } from '@/utils/permission'
|
|||
import { t } from '@/locales'
|
||||
import { ComplexPermission } from '@/utils/permission/type'
|
||||
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import permissionMap from '@/permission'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
provide('getApplicationDetail', () => detail)
|
||||
const { theme } = useStore()
|
||||
|
|
@ -172,6 +173,10 @@ const apiType = computed(() => {
|
|||
}
|
||||
})
|
||||
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application'][apiType.value]
|
||||
})
|
||||
|
||||
const isDefaultTheme = computed(() => {
|
||||
return theme.isDefaultTheme()
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue