mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-28 14:52:58 +00:00
fix: style
This commit is contained in:
parent
0316afa299
commit
857f988992
|
|
@ -100,10 +100,10 @@ const emit = defineEmits([
|
|||
])
|
||||
|
||||
const showAvatar = computed(() => {
|
||||
return user.isEnterprise() ? props.application.show_avatar : true
|
||||
return (user.isEE() || user.isPE())? props.application.show_avatar : true
|
||||
})
|
||||
const showUserAvatar = computed(() => {
|
||||
return user.isEnterprise() ? props.application.show_user_avatar : true
|
||||
return user.isEE() || user.isPE() ? props.application.show_user_avatar : true
|
||||
})
|
||||
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
|
||||
if (type === 'old') {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<div class="ai-chat__operate p-16">
|
||||
<slot name="operateBefore" />
|
||||
<div class="operate-textarea">
|
||||
<el-scrollbar max-height="136">
|
||||
<div
|
||||
|
|
@ -170,13 +169,7 @@
|
|||
v-model="inputValue"
|
||||
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 10 }"
|
||||
type="textarea"
|
||||
:placeholder="
|
||||
recorderStatus === 'START'
|
||||
? `${$t('chat.inputPlaceholder.speaking')}...`
|
||||
: recorderStatus === 'TRANSCRIBING'
|
||||
? `${$t('chat.inputPlaceholder.recorderLoading')}...`
|
||||
: $t('chat.inputPlaceholder.default')
|
||||
"
|
||||
:placeholder="inputPlaceholder"
|
||||
:maxlength="100000"
|
||||
@keydown.enter="sendChatHandle($event)"
|
||||
@paste="handlePaste"
|
||||
|
|
@ -294,6 +287,7 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, nextTick, watch, type Ref } from 'vue'
|
||||
import { t } from '@/locales'
|
||||
import Recorder from 'recorder-core'
|
||||
import TouchChat from './TouchChat.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
|
|
@ -305,7 +299,7 @@ import bus from '@/bus'
|
|||
import 'recorder-core/src/engine/mp3'
|
||||
import 'recorder-core/src/engine/mp3-engine'
|
||||
import { MsgWarning } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { debounce } from 'lodash'
|
||||
import chatAPI from '@/api/chat/chat'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
|
@ -353,6 +347,14 @@ const localLoading = computed({
|
|||
},
|
||||
})
|
||||
|
||||
const inputPlaceholder = computed(() => {
|
||||
return recorderStatus.value === 'START'
|
||||
? `${t('chat.inputPlaceholder.speaking')}...`
|
||||
: recorderStatus.value === 'TRANSCRIBING'
|
||||
? `${t('chat.inputPlaceholder.recorderLoading')}...`
|
||||
: `${t('chat.inputPlaceholder.default')}`
|
||||
})
|
||||
|
||||
const upload = ref()
|
||||
|
||||
const imageExtensions = ['JPG', 'JPEG', 'PNG', 'GIF', 'BMP']
|
||||
|
|
@ -800,7 +802,6 @@ function mouseenter(row: any) {
|
|||
function mouseleave() {
|
||||
showDelete.value = ''
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
bus.on('chat-input', (message: string) => {
|
||||
inputValue.value = message
|
||||
|
|
|
|||
|
|
@ -39,9 +39,7 @@
|
|||
</el-text>
|
||||
</el-card>
|
||||
<div class="flex align-center border-t" style="padding: 12px 0 8px">
|
||||
<el-avatar class="mr-8 avatar-blue" shape="square" :size="18">
|
||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
|
||||
</el-avatar>
|
||||
<KnowledgeIcon :type="data?.knowledge_type" :size="18" class="mr-8" />
|
||||
<span class="ellipsis-1 break-all" :title="data?.knowledge_name">
|
||||
{{ data?.knowledge_name || '-' }}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ const props = defineProps<{
|
|||
const { user } = useStore()
|
||||
|
||||
const showAvatar = computed(() => {
|
||||
return user.isEnterprise() ? props.application.show_avatar : true
|
||||
return (user.isEE() || user.isPE()) ? props.application.show_avatar : true
|
||||
})
|
||||
const showUserAvatar = computed(() => {
|
||||
return user.isEnterprise() ? props.application.show_user_avatar : true
|
||||
return user.isEE() || user.isPE() ? props.application.show_user_avatar : true
|
||||
})
|
||||
|
||||
const toQuickQuestion = (match: string, offset: number, input: string) => {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ const props = defineProps<{
|
|||
const { user } = useStore()
|
||||
|
||||
const showAvatar = computed(() => {
|
||||
return user.isEnterprise() ? props.application.show_user_avatar : true
|
||||
return user.isEE() || user.isPE() ? props.application.show_user_avatar : true
|
||||
})
|
||||
|
||||
const document_list = computed(() => {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const useApplicationStore = defineStore('application', {
|
|||
async asyncGetAccessToken(id: string, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const user = useUserStore()
|
||||
if (user.isEnterprise()) {
|
||||
if (user.isEE() || user.isPE()) {
|
||||
applicationXpackApi
|
||||
.getAccessToken(id, loading)
|
||||
.then((data) => {
|
||||
|
|
|
|||
|
|
@ -215,6 +215,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 768px) {
|
||||
.el-dialog {
|
||||
width: 90% !important;
|
||||
}
|
||||
}
|
||||
|
||||
// el-form
|
||||
|
||||
.el-form {
|
||||
|
|
|
|||
|
|
@ -1,138 +0,0 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="$t('common.EditAvatarDialog.title')"
|
||||
v-model="dialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
width="550"
|
||||
>
|
||||
<el-radio-group v-model="radioType" class="radio-block mb-16">
|
||||
<el-radio value="default">
|
||||
<p>{{ $t('common.EditAvatarDialog.default') }}</p>
|
||||
<el-avatar
|
||||
v-if="detail?.name"
|
||||
:name="detail?.name"
|
||||
pinyinColor
|
||||
class="mt-8 mb-8"
|
||||
shape="square"
|
||||
:size="32"
|
||||
/>
|
||||
</el-radio>
|
||||
<el-radio value="custom">
|
||||
<p>{{ $t('common.EditAvatarDialog.customizeUpload') }}</p>
|
||||
<div class="flex mt-8">
|
||||
<el-avatar
|
||||
v-if="fileURL"
|
||||
shape="square"
|
||||
:size="32"
|
||||
style="background: none"
|
||||
class="mr-16"
|
||||
>
|
||||
<img :src="fileURL" alt="" />
|
||||
</el-avatar>
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
action="#"
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
accept="image/jpeg, image/png, image/gif"
|
||||
:on-change="onChange"
|
||||
>
|
||||
<el-button icon="Upload" :disabled="radioType !== 'custom'">{{
|
||||
$t('common.EditAvatarDialog.upload')
|
||||
}}</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
<div class="el-upload__tip info mt-8">
|
||||
{{ $t('common.EditAvatarDialog.sizeTip') }}
|
||||
</div>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submit" :loading="loading">
|
||||
{{ $t('common.save') }}</el-button
|
||||
>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import overviewApi from '@/api/application/application-key'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { defaultIcon, isAppIcon } from '@/utils/common'
|
||||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const { application } = useStore()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id } //应用id
|
||||
} = route
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const iconFile = ref<any>(null)
|
||||
const fileURL = ref<any>(null)
|
||||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
const loading = ref(false)
|
||||
const detail = ref<any>(null)
|
||||
const radioType = ref('default')
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
iconFile.value = null
|
||||
fileURL.value = null
|
||||
}
|
||||
})
|
||||
|
||||
const open = (data: any) => {
|
||||
radioType.value = isAppIcon(data.icon) ? 'custom' : 'default'
|
||||
fileURL.value = isAppIcon(data.icon) ? data.icon : null
|
||||
detail.value = cloneDeep(data)
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const onChange = (file: any) => {
|
||||
//1、判断文件大小是否合法,文件限制不能大于10MB
|
||||
const isLimit = file?.size / 1024 / 1024 < 10
|
||||
if (!isLimit) {
|
||||
// @ts-ignore
|
||||
MsgError(t('common.EditAvatarDialog.fileSizeExceeded'))
|
||||
return false
|
||||
} else {
|
||||
iconFile.value = file
|
||||
fileURL.value = URL.createObjectURL(file.raw)
|
||||
}
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if (radioType.value === 'default') {
|
||||
application.asyncPutApplication(id as string, { icon: defaultIcon }, loading).then((res) => {
|
||||
emit('refresh')
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else if (radioType.value === 'custom' && iconFile.value) {
|
||||
const fd = new FormData()
|
||||
fd.append('file', iconFile.value.raw)
|
||||
// todo
|
||||
// overviewApi.putAppIcon(id as string, fd, loading).then((res: any) => {
|
||||
// emit('refresh')
|
||||
// MsgSuccess(t('common.saveSuccess'))
|
||||
// dialogVisible.value = false
|
||||
// })
|
||||
} else {
|
||||
MsgError(t('common.EditAvatarDialog.uploadImagePrompt'))
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -195,7 +195,6 @@
|
|||
:api-input-params="mapToUrlParams(apiInputParams)"
|
||||
/>
|
||||
<APIKeyDialog ref="APIKeyDialogRef"/>
|
||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon"/>
|
||||
|
||||
<!-- 社区版访问限制 -->
|
||||
<component :is="currentLimitDialog" ref="LimitDialogRef" @refresh="refresh"/>
|
||||
|
|
@ -212,7 +211,6 @@ import LimitDialog from './component/LimitDialog.vue'
|
|||
import XPackLimitDrawer from './xpack-component/XPackLimitDrawer.vue'
|
||||
import DisplaySettingDialog from './component/DisplaySettingDialog.vue'
|
||||
import XPackDisplaySettingDialog from './xpack-component/XPackDisplaySettingDialog.vue'
|
||||
import EditAvatarDialog from './component/EditAvatarDialog.vue'
|
||||
import StatisticsCharts from './component/StatisticsCharts.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import {nowDate, beforeDay} from '@/utils/time'
|
||||
|
|
@ -244,7 +242,6 @@ const apiUrl = window.location.origin + '/doc/chat/'
|
|||
|
||||
const baseUrl = window.location.origin + '/api/application/'
|
||||
|
||||
const EditAvatarDialogRef = ref()
|
||||
const APIKeyDialogRef = ref()
|
||||
const EmbedDialogRef = ref()
|
||||
|
||||
|
|
@ -345,10 +342,6 @@ function openLimitDialog() {
|
|||
})
|
||||
}
|
||||
|
||||
function openEditAvatar() {
|
||||
EditAvatarDialogRef.value.open(detail.value)
|
||||
}
|
||||
|
||||
function changeDayHandle(val: number | string) {
|
||||
if (val !== 'other') {
|
||||
daterange.value.start_time = beforeDay(val)
|
||||
|
|
|
|||
|
|
@ -34,11 +34,12 @@
|
|||
v-if="form.authentication"
|
||||
v-model="form.authentication_value.type"
|
||||
class="card__radio"
|
||||
@change="(val: string) => val === 'password' && refreshAuthentication()"
|
||||
>
|
||||
<el-card
|
||||
shadow="never"
|
||||
class="mb-16"
|
||||
:class="form.authentication_value.type === 'password' ? 'active' : ''"
|
||||
:class="form.authentication_value?.type === 'password' ? 'active' : ''"
|
||||
>
|
||||
<el-radio value="password" size="large">
|
||||
<p class="mb-4 lighter">
|
||||
|
|
@ -160,7 +161,9 @@ const form = ref<any>({
|
|||
access_num: 0,
|
||||
white_active: true,
|
||||
white_list: '',
|
||||
authentication_value: {},
|
||||
authentication_value: {
|
||||
type: 'password',
|
||||
},
|
||||
authentication: false,
|
||||
})
|
||||
|
||||
|
|
@ -190,7 +193,12 @@ const open = (data: any) => {
|
|||
form.value.access_num = data.access_num
|
||||
form.value.white_active = data.white_active
|
||||
form.value.white_list = data.white_list?.length ? data.white_list?.join('\n') : ''
|
||||
form.value.authentication_value = data.authentication_value
|
||||
form.value.authentication_value = data.authentication_value || {
|
||||
type: 'password',
|
||||
}
|
||||
if (form.value.authentication_value.type === 'password') {
|
||||
refreshAuthentication()
|
||||
}
|
||||
form.value.authentication = data.authentication
|
||||
dialogVisible.value = true
|
||||
applicationApi.getChatUserAuthType().then((ok) => {
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ import type { Action } from 'element-plus'
|
|||
import Workflow from '@/workflow/index.vue'
|
||||
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
|
||||
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import {isAppIcon, resetUrl} from '@/utils/common'
|
||||
import ApplicationAPI from '@/api/application/application'
|
||||
import { isAppIcon,resetUrl } from '@/utils/common'
|
||||
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { mapToUrlParams } from '@/utils/application'
|
||||
|
|
@ -274,38 +274,57 @@ function clickoutside() {
|
|||
showPopover.value = false
|
||||
}
|
||||
const publish = () => {
|
||||
const workflow = getGraphData()
|
||||
const workflowInstance = new WorkFlowInstance(workflow)
|
||||
try {
|
||||
workflowInstance.is_valid()
|
||||
} catch (e: any) {
|
||||
MsgError(e.toString())
|
||||
return
|
||||
}
|
||||
applicationApi
|
||||
.putApplication(id, { work_flow: workflow }, loading)
|
||||
.then((ok) => {
|
||||
return applicationApi.publish(id, {}, loading)
|
||||
})
|
||||
.then((ok: any) => {
|
||||
detail.value.name = ok.data.name
|
||||
MsgSuccess(t('views.application.tip.publishSuccess'))
|
||||
workflowRef.value
|
||||
?.validate()
|
||||
.then(() => {
|
||||
const workflow = getGraphData()
|
||||
const workflowInstance = new WorkFlowInstance(workflow)
|
||||
try {
|
||||
workflowInstance.is_valid()
|
||||
} catch (e: any) {
|
||||
MsgError(e.toString())
|
||||
return
|
||||
}
|
||||
ApplicationAPI.putApplication(id, { work_flow: workflow }, loading)
|
||||
.then((ok) => {
|
||||
return ApplicationAPI.publish(id, {}, loading)
|
||||
})
|
||||
.then((ok: any) => {
|
||||
detail.value.name = ok.data.name
|
||||
MsgSuccess(t('views.application.tip.publishSuccess'))
|
||||
})
|
||||
.catch((res: any) => {
|
||||
const node = res.node
|
||||
const err_message = res.errMessage
|
||||
if (typeof err_message == 'string') {
|
||||
MsgError(
|
||||
res.node.properties?.stepName +
|
||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
||||
err_message.toLowerCase(),
|
||||
)
|
||||
} else {
|
||||
const keys = Object.keys(err_message)
|
||||
MsgError(
|
||||
node.properties?.stepName +
|
||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
||||
err_message[keys[0]]?.[0]?.message.toLowerCase(),
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch((res: any) => {
|
||||
const node = res.node
|
||||
const err_message = res.errMessage
|
||||
if (typeof err_message == 'string') {
|
||||
MsgError(
|
||||
res.node.properties?.stepName +
|
||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
||||
err_message.toLowerCase(),
|
||||
res.node.properties?.stepName + ` ${t('views.applicationWorkflow.node')},` + err_message,
|
||||
)
|
||||
} else {
|
||||
const keys = Object.keys(err_message)
|
||||
MsgError(
|
||||
node.properties?.stepName +
|
||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
||||
err_message[keys[0]]?.[0]?.message.toLowerCase(),
|
||||
` ${t('views.applicationWorkflow.node')},` +
|
||||
err_message[keys[0]]?.[0]?.message,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
|
@ -391,6 +410,12 @@ function getDetail() {
|
|||
workflowRef.value?.render(detail.value.work_flow)
|
||||
cloneWorkFlow.value = getGraphData()
|
||||
})
|
||||
// 企业版和专业版
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
ApplicationAPI.getApplicationSetting(id).then((ok) => {
|
||||
detail.value = { ...detail.value, ...ok.data }
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -407,7 +432,7 @@ function saveApplication(bool?: boolean, back?: boolean) {
|
|||
cloneWorkFlow.value = getGraphData()
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
if (back) {
|
||||
go()
|
||||
go()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -415,32 +440,103 @@ function saveApplication(bool?: boolean, back?: boolean) {
|
|||
loading.value = false
|
||||
})
|
||||
}
|
||||
const go=()=>{
|
||||
return router.push({ path: get_route() })
|
||||
const go = () => {
|
||||
return router.push({ path: get_route() })
|
||||
}
|
||||
|
||||
const get_route=()=>{
|
||||
if( hasPermission( [new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[],'AND'),
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(id)],'OR')){
|
||||
return `/application/${id}/WORK_FLOW/overview`
|
||||
} else if (hasPermission([new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'AND'),
|
||||
new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,],[PermissionConst.APPLICATION_ACCESS_READ.getWorkspacePermissionWorkspaceManageRole],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),
|
||||
new ComplexPermission([],[PermissionConst.APPLICATION_ACCESS_READ.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),],'OR')) {
|
||||
return `/application/${id}/WORK_FLOW/access`
|
||||
} else if (hasPermission([new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'AND'),
|
||||
new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],[PermissionConst.APPLICATION_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),
|
||||
new ComplexPermission([],[PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),],'OR')) {
|
||||
return `/application/${id}/WORK_FLOW/chat-user`
|
||||
} else if (hasPermission([new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[],'AND'),
|
||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getApplicationWorkspaceResourcePermission(id)],'OR')) {
|
||||
return `/application/${id}/WORK_FLOW/chat-log`
|
||||
} else return `/application`
|
||||
const get_route = () => {
|
||||
if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],
|
||||
[],
|
||||
'AND',
|
||||
),
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(id),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${id}/WORK_FLOW/overview`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'AND',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
|
||||
[PermissionConst.APPLICATION_ACCESS_READ.getWorkspacePermissionWorkspaceManageRole],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[],
|
||||
[PermissionConst.APPLICATION_ACCESS_READ.getApplicationWorkspaceResourcePermission(id)],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${id}/WORK_FLOW/access`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'AND',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
|
||||
[PermissionConst.APPLICATION_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[],
|
||||
[
|
||||
PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission(
|
||||
id,
|
||||
),
|
||||
],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${id}/WORK_FLOW/chat-user`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],
|
||||
[],
|
||||
'AND',
|
||||
),
|
||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getApplicationWorkspaceResourcePermission(id),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${id}/WORK_FLOW/chat-log`
|
||||
} else return `/application`
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定时保存
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-card style="--el-card-padding: 0">
|
||||
<el-row v-loading="loading">
|
||||
<el-col :span="10">
|
||||
|
|
@ -426,11 +427,8 @@
|
|||
ref="AddKnowledgeDialogRef"
|
||||
@addData="addKnowledge"
|
||||
:data="knowledgeList"
|
||||
@refresh="refresh"
|
||||
:loading="knowledgeLoading"
|
||||
/>
|
||||
|
||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon" />
|
||||
<ReasoningParamSettingDialog
|
||||
ref="ReasoningParamSettingDialogRef"
|
||||
@refresh="submitReasoningDialog"
|
||||
|
|
@ -444,7 +442,6 @@ import { groupBy } from 'lodash'
|
|||
import AIModeParamSettingDialog from './component/AIModeParamSettingDialog.vue'
|
||||
import ParamSettingDialog from './component/ParamSettingDialog.vue'
|
||||
import AddKnowledgeDialog from './component/AddKnowledgeDialog.vue'
|
||||
import EditAvatarDialog from '@/views/application-overview/component/EditAvatarDialog.vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { ApplicationFormType } from '@/api/type/application'
|
||||
import { relatedObject } from '@/utils/array'
|
||||
|
|
@ -455,6 +452,8 @@ import TTSModeParamSettingDialog from './component/TTSModeParamSettingDialog.vue
|
|||
import ReasoningParamSettingDialog from './component/ReasoningParamSettingDialog.vue'
|
||||
import permissionMap from '@/permission'
|
||||
import ApplicationAPI from '@/api/application/application'
|
||||
import { EditionConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
|
|
@ -489,10 +488,10 @@ const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
|
|||
|
||||
const applicationFormRef = ref<FormInstance>()
|
||||
const AddKnowledgeDialogRef = ref()
|
||||
const EditAvatarDialogRef = ref()
|
||||
|
||||
const loading = ref(false)
|
||||
const knowledgeLoading = ref(false)
|
||||
|
||||
const applicationForm = ref<ApplicationFormType>({
|
||||
name: '',
|
||||
desc: '',
|
||||
|
|
@ -526,6 +525,7 @@ const applicationForm = ref<ApplicationFormType>({
|
|||
tts_type: 'BROWSER',
|
||||
type: 'SIMPLE',
|
||||
})
|
||||
const themeDetail = ref({})
|
||||
|
||||
const rules = reactive<FormRules<ApplicationFormType>>({
|
||||
name: [
|
||||
|
|
@ -657,6 +657,13 @@ function getDetail() {
|
|||
knowledgeList.value = res.data.knowledge_list
|
||||
applicationForm.value.model_setting.no_references_prompt =
|
||||
res.data.model_setting.no_references_prompt || '{question}'
|
||||
|
||||
// 企业版和专业版
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
ApplicationAPI.getApplicationSetting(id).then((ok) => {
|
||||
applicationForm.value = { ...applicationForm.value, ...ok.data }
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -720,17 +727,6 @@ function sttModelEnableChange() {
|
|||
}
|
||||
}
|
||||
|
||||
function openEditAvatar() {
|
||||
EditAvatarDialogRef.value.open(applicationForm.value)
|
||||
}
|
||||
function refreshIcon() {
|
||||
getDetail()
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
// getDetail()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSelectModel()
|
||||
getDetail()
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ const open = (data: any, folder: string) => {
|
|||
}
|
||||
|
||||
const submitValid = (formEl: FormInstance | undefined) => {
|
||||
if (user.isEnterprise()) {
|
||||
if (user.isEE() || user.isPE()) {
|
||||
submitHandle(formEl)
|
||||
} else {
|
||||
common
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@
|
|||
@new-chat="newChat"
|
||||
@clickLog="clickListHandle"
|
||||
@delete-log="deleteLog"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -149,6 +150,7 @@ function newChat() {
|
|||
chatLogData.value.unshift(newObj)
|
||||
}
|
||||
currentChatId.value = 'new'
|
||||
show.value = false
|
||||
}
|
||||
|
||||
function getChatLog(id: string) {
|
||||
|
|
@ -208,6 +210,13 @@ const clickListHandle = (item: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
function refreshFieldTitle(chatId: string, abstract: string) {
|
||||
const find = chatLogData.value.find((item: any) => item.id == chatId)
|
||||
if (find) {
|
||||
find.abstract = abstract
|
||||
}
|
||||
}
|
||||
|
||||
function refresh(id: string) {
|
||||
getChatLog(applicationDetail.value.id)
|
||||
currentChatId.value = id
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
:is="currentTemplate"
|
||||
:application_profile="chatUser.application"
|
||||
:key="route.fullPath"
|
||||
v-loading="loading"
|
||||
/>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -35,14 +34,6 @@ const currentTemplate = computed(() => {
|
|||
return components[name].default
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const applicationAvailable = ref<boolean>(true)
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@media only screen and (max-width: 768px) {
|
||||
.el-dialog {
|
||||
width: 90% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -58,18 +58,18 @@
|
|||
>
|
||||
</AiChat>
|
||||
</div>
|
||||
|
||||
<ChatHistoryDrawer
|
||||
v-model:show="show"
|
||||
:application-detail="applicationDetail"
|
||||
:chat-log-data="chatLogData"
|
||||
:left-loading="left_loading"
|
||||
:currentChatId="currentChatId"
|
||||
@new-chat="newChat"
|
||||
@clickLog="clickListHandle"
|
||||
@delete-log="deleteLog"
|
||||
/>
|
||||
</div>
|
||||
<ChatHistoryDrawer
|
||||
v-model:show="show"
|
||||
:application-detail="applicationDetail"
|
||||
:chat-log-data="chatLogData"
|
||||
:left-loading="left_loading"
|
||||
:currentChatId="currentChatId"
|
||||
@new-chat="newChat"
|
||||
@clickLog="clickListHandle"
|
||||
@delete-log="deleteLog"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -156,6 +156,7 @@ function newChat() {
|
|||
chatLogData.value.unshift(newObj)
|
||||
}
|
||||
currentChatId.value = 'new'
|
||||
show.value = false
|
||||
}
|
||||
|
||||
function getChatLog(id: string) {
|
||||
|
|
@ -215,6 +216,13 @@ const clickListHandle = (item: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
function refreshFieldTitle(chatId: string, abstract: string) {
|
||||
const find = chatLogData.value.find((item: any) => item.id == chatId)
|
||||
if (find) {
|
||||
find.abstract = abstract
|
||||
}
|
||||
}
|
||||
|
||||
function refresh(id: string) {
|
||||
getChatLog(applicationDetail.value.id)
|
||||
currentChatId.value = id
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div
|
||||
class="chat-pc"
|
||||
:class="classObj"
|
||||
v-loading="loading"
|
||||
v-loading="loading || left_loading"
|
||||
:style="{
|
||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
|
||||
|
|
|
|||
Loading…
Reference in New Issue