fix: style
This commit is contained in:
parent
0316afa299
commit
857f988992
@ -100,10 +100,10 @@ const emit = defineEmits([
|
|||||||
])
|
])
|
||||||
|
|
||||||
const showAvatar = computed(() => {
|
const showAvatar = computed(() => {
|
||||||
return user.isEnterprise() ? props.application.show_avatar : true
|
return (user.isEE() || user.isPE())? props.application.show_avatar : true
|
||||||
})
|
})
|
||||||
const showUserAvatar = computed(() => {
|
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) => {
|
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
|
||||||
if (type === 'old') {
|
if (type === 'old') {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="ai-chat__operate p-16">
|
<div class="ai-chat__operate p-16">
|
||||||
<slot name="operateBefore" />
|
|
||||||
<div class="operate-textarea">
|
<div class="operate-textarea">
|
||||||
<el-scrollbar max-height="136">
|
<el-scrollbar max-height="136">
|
||||||
<div
|
<div
|
||||||
@ -170,13 +169,7 @@
|
|||||||
v-model="inputValue"
|
v-model="inputValue"
|
||||||
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 10 }"
|
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 10 }"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:placeholder="
|
:placeholder="inputPlaceholder"
|
||||||
recorderStatus === 'START'
|
|
||||||
? `${$t('chat.inputPlaceholder.speaking')}...`
|
|
||||||
: recorderStatus === 'TRANSCRIBING'
|
|
||||||
? `${$t('chat.inputPlaceholder.recorderLoading')}...`
|
|
||||||
: $t('chat.inputPlaceholder.default')
|
|
||||||
"
|
|
||||||
:maxlength="100000"
|
:maxlength="100000"
|
||||||
@keydown.enter="sendChatHandle($event)"
|
@keydown.enter="sendChatHandle($event)"
|
||||||
@paste="handlePaste"
|
@paste="handlePaste"
|
||||||
@ -294,6 +287,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, nextTick, watch, type Ref } from 'vue'
|
import { ref, computed, onMounted, nextTick, watch, type Ref } from 'vue'
|
||||||
|
import { t } from '@/locales'
|
||||||
import Recorder from 'recorder-core'
|
import Recorder from 'recorder-core'
|
||||||
import TouchChat from './TouchChat.vue'
|
import TouchChat from './TouchChat.vue'
|
||||||
import applicationApi from '@/api/application/application'
|
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'
|
||||||
import 'recorder-core/src/engine/mp3-engine'
|
import 'recorder-core/src/engine/mp3-engine'
|
||||||
import { MsgWarning } from '@/utils/message'
|
import { MsgWarning } from '@/utils/message'
|
||||||
import { t } from '@/locales'
|
import { debounce } from 'lodash'
|
||||||
import chatAPI from '@/api/chat/chat'
|
import chatAPI from '@/api/chat/chat'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
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 upload = ref()
|
||||||
|
|
||||||
const imageExtensions = ['JPG', 'JPEG', 'PNG', 'GIF', 'BMP']
|
const imageExtensions = ['JPG', 'JPEG', 'PNG', 'GIF', 'BMP']
|
||||||
@ -800,7 +802,6 @@ function mouseenter(row: any) {
|
|||||||
function mouseleave() {
|
function mouseleave() {
|
||||||
showDelete.value = ''
|
showDelete.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
bus.on('chat-input', (message: string) => {
|
bus.on('chat-input', (message: string) => {
|
||||||
inputValue.value = message
|
inputValue.value = message
|
||||||
|
|||||||
@ -39,9 +39,7 @@
|
|||||||
</el-text>
|
</el-text>
|
||||||
</el-card>
|
</el-card>
|
||||||
<div class="flex align-center border-t" style="padding: 12px 0 8px">
|
<div class="flex align-center border-t" style="padding: 12px 0 8px">
|
||||||
<el-avatar class="mr-8 avatar-blue" shape="square" :size="18">
|
<KnowledgeIcon :type="data?.knowledge_type" :size="18" class="mr-8" />
|
||||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
|
|
||||||
</el-avatar>
|
|
||||||
<span class="ellipsis-1 break-all" :title="data?.knowledge_name">
|
<span class="ellipsis-1 break-all" :title="data?.knowledge_name">
|
||||||
{{ data?.knowledge_name || '-' }}
|
{{ data?.knowledge_name || '-' }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@ -38,10 +38,10 @@ const props = defineProps<{
|
|||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
|
|
||||||
const showAvatar = computed(() => {
|
const showAvatar = computed(() => {
|
||||||
return user.isEnterprise() ? props.application.show_avatar : true
|
return (user.isEE() || user.isPE()) ? props.application.show_avatar : true
|
||||||
})
|
})
|
||||||
const showUserAvatar = computed(() => {
|
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) => {
|
const toQuickQuestion = (match: string, offset: number, input: string) => {
|
||||||
|
|||||||
@ -109,7 +109,7 @@ const props = defineProps<{
|
|||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
|
|
||||||
const showAvatar = computed(() => {
|
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(() => {
|
const document_list = computed(() => {
|
||||||
|
|||||||
@ -25,7 +25,7 @@ const useApplicationStore = defineStore('application', {
|
|||||||
async asyncGetAccessToken(id: string, loading?: Ref<boolean>) {
|
async asyncGetAccessToken(id: string, loading?: Ref<boolean>) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const user = useUserStore()
|
const user = useUserStore()
|
||||||
if (user.isEnterprise()) {
|
if (user.isEE() || user.isPE()) {
|
||||||
applicationXpackApi
|
applicationXpackApi
|
||||||
.getAccessToken(id, loading)
|
.getAccessToken(id, loading)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|||||||
@ -215,6 +215,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
.el-dialog {
|
||||||
|
width: 90% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// el-form
|
// el-form
|
||||||
|
|
||||||
.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)"
|
:api-input-params="mapToUrlParams(apiInputParams)"
|
||||||
/>
|
/>
|
||||||
<APIKeyDialog ref="APIKeyDialogRef"/>
|
<APIKeyDialog ref="APIKeyDialogRef"/>
|
||||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon"/>
|
|
||||||
|
|
||||||
<!-- 社区版访问限制 -->
|
<!-- 社区版访问限制 -->
|
||||||
<component :is="currentLimitDialog" ref="LimitDialogRef" @refresh="refresh"/>
|
<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 XPackLimitDrawer from './xpack-component/XPackLimitDrawer.vue'
|
||||||
import DisplaySettingDialog from './component/DisplaySettingDialog.vue'
|
import DisplaySettingDialog from './component/DisplaySettingDialog.vue'
|
||||||
import XPackDisplaySettingDialog from './xpack-component/XPackDisplaySettingDialog.vue'
|
import XPackDisplaySettingDialog from './xpack-component/XPackDisplaySettingDialog.vue'
|
||||||
import EditAvatarDialog from './component/EditAvatarDialog.vue'
|
|
||||||
import StatisticsCharts from './component/StatisticsCharts.vue'
|
import StatisticsCharts from './component/StatisticsCharts.vue'
|
||||||
import applicationApi from '@/api/application/application'
|
import applicationApi from '@/api/application/application'
|
||||||
import {nowDate, beforeDay} from '@/utils/time'
|
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 baseUrl = window.location.origin + '/api/application/'
|
||||||
|
|
||||||
const EditAvatarDialogRef = ref()
|
|
||||||
const APIKeyDialogRef = ref()
|
const APIKeyDialogRef = ref()
|
||||||
const EmbedDialogRef = ref()
|
const EmbedDialogRef = ref()
|
||||||
|
|
||||||
@ -345,10 +342,6 @@ function openLimitDialog() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function openEditAvatar() {
|
|
||||||
EditAvatarDialogRef.value.open(detail.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeDayHandle(val: number | string) {
|
function changeDayHandle(val: number | string) {
|
||||||
if (val !== 'other') {
|
if (val !== 'other') {
|
||||||
daterange.value.start_time = beforeDay(val)
|
daterange.value.start_time = beforeDay(val)
|
||||||
|
|||||||
@ -34,11 +34,12 @@
|
|||||||
v-if="form.authentication"
|
v-if="form.authentication"
|
||||||
v-model="form.authentication_value.type"
|
v-model="form.authentication_value.type"
|
||||||
class="card__radio"
|
class="card__radio"
|
||||||
|
@change="(val: string) => val === 'password' && refreshAuthentication()"
|
||||||
>
|
>
|
||||||
<el-card
|
<el-card
|
||||||
shadow="never"
|
shadow="never"
|
||||||
class="mb-16"
|
class="mb-16"
|
||||||
:class="form.authentication_value.type === 'password' ? 'active' : ''"
|
:class="form.authentication_value?.type === 'password' ? 'active' : ''"
|
||||||
>
|
>
|
||||||
<el-radio value="password" size="large">
|
<el-radio value="password" size="large">
|
||||||
<p class="mb-4 lighter">
|
<p class="mb-4 lighter">
|
||||||
@ -160,7 +161,9 @@ const form = ref<any>({
|
|||||||
access_num: 0,
|
access_num: 0,
|
||||||
white_active: true,
|
white_active: true,
|
||||||
white_list: '',
|
white_list: '',
|
||||||
authentication_value: {},
|
authentication_value: {
|
||||||
|
type: 'password',
|
||||||
|
},
|
||||||
authentication: false,
|
authentication: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -190,7 +193,12 @@ const open = (data: any) => {
|
|||||||
form.value.access_num = data.access_num
|
form.value.access_num = data.access_num
|
||||||
form.value.white_active = data.white_active
|
form.value.white_active = data.white_active
|
||||||
form.value.white_list = data.white_list?.length ? data.white_list?.join('\n') : ''
|
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
|
form.value.authentication = data.authentication
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
applicationApi.getChatUserAuthType().then((ok) => {
|
applicationApi.getChatUserAuthType().then((ok) => {
|
||||||
|
|||||||
@ -141,8 +141,8 @@ import type { Action } from 'element-plus'
|
|||||||
import Workflow from '@/workflow/index.vue'
|
import Workflow from '@/workflow/index.vue'
|
||||||
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
|
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
|
||||||
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
|
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
|
||||||
import applicationApi from '@/api/application/application'
|
import ApplicationAPI from '@/api/application/application'
|
||||||
import {isAppIcon, resetUrl} from '@/utils/common'
|
import { isAppIcon,resetUrl } from '@/utils/common'
|
||||||
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
|
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
import { mapToUrlParams } from '@/utils/application'
|
import { mapToUrlParams } from '@/utils/application'
|
||||||
@ -274,38 +274,57 @@ function clickoutside() {
|
|||||||
showPopover.value = false
|
showPopover.value = false
|
||||||
}
|
}
|
||||||
const publish = () => {
|
const publish = () => {
|
||||||
const workflow = getGraphData()
|
workflowRef.value
|
||||||
const workflowInstance = new WorkFlowInstance(workflow)
|
?.validate()
|
||||||
try {
|
.then(() => {
|
||||||
workflowInstance.is_valid()
|
const workflow = getGraphData()
|
||||||
} catch (e: any) {
|
const workflowInstance = new WorkFlowInstance(workflow)
|
||||||
MsgError(e.toString())
|
try {
|
||||||
return
|
workflowInstance.is_valid()
|
||||||
}
|
} catch (e: any) {
|
||||||
applicationApi
|
MsgError(e.toString())
|
||||||
.putApplication(id, { work_flow: workflow }, loading)
|
return
|
||||||
.then((ok) => {
|
}
|
||||||
return applicationApi.publish(id, {}, loading)
|
ApplicationAPI.putApplication(id, { work_flow: workflow }, loading)
|
||||||
})
|
.then((ok) => {
|
||||||
.then((ok: any) => {
|
return ApplicationAPI.publish(id, {}, loading)
|
||||||
detail.value.name = ok.data.name
|
})
|
||||||
MsgSuccess(t('views.application.tip.publishSuccess'))
|
.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) => {
|
.catch((res: any) => {
|
||||||
const node = res.node
|
const node = res.node
|
||||||
const err_message = res.errMessage
|
const err_message = res.errMessage
|
||||||
if (typeof err_message == 'string') {
|
if (typeof err_message == 'string') {
|
||||||
MsgError(
|
MsgError(
|
||||||
res.node.properties?.stepName +
|
res.node.properties?.stepName + ` ${t('views.applicationWorkflow.node')},` + err_message,
|
||||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
|
||||||
err_message.toLowerCase(),
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
const keys = Object.keys(err_message)
|
const keys = Object.keys(err_message)
|
||||||
MsgError(
|
MsgError(
|
||||||
node.properties?.stepName +
|
node.properties?.stepName +
|
||||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
` ${t('views.applicationWorkflow.node')},` +
|
||||||
err_message[keys[0]]?.[0]?.message.toLowerCase(),
|
err_message[keys[0]]?.[0]?.message,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -391,6 +410,12 @@ function getDetail() {
|
|||||||
workflowRef.value?.render(detail.value.work_flow)
|
workflowRef.value?.render(detail.value.work_flow)
|
||||||
cloneWorkFlow.value = getGraphData()
|
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()
|
cloneWorkFlow.value = getGraphData()
|
||||||
MsgSuccess(t('common.saveSuccess'))
|
MsgSuccess(t('common.saveSuccess'))
|
||||||
if (back) {
|
if (back) {
|
||||||
go()
|
go()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -415,32 +440,103 @@ function saveApplication(bool?: boolean, back?: boolean) {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const go=()=>{
|
const go = () => {
|
||||||
return router.push({ path: get_route() })
|
return router.push({ path: get_route() })
|
||||||
}
|
}
|
||||||
|
|
||||||
const get_route=()=>{
|
const get_route = () => {
|
||||||
if( hasPermission( [new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[],'AND'),
|
if (
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
hasPermission(
|
||||||
PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole,
|
[
|
||||||
PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(id)],'OR')){
|
new ComplexPermission(
|
||||||
return `/application/${id}/WORK_FLOW/overview`
|
[RoleConst.USER],
|
||||||
} else if (hasPermission([new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'AND'),
|
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],
|
||||||
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')) {
|
'AND',
|
||||||
return `/application/${id}/WORK_FLOW/access`
|
),
|
||||||
} else if (hasPermission([new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'AND'),
|
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||||
new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],[PermissionConst.APPLICATION_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),
|
PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||||
new ComplexPermission([],[PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission(id)],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),],'OR')) {
|
PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(id),
|
||||||
return `/application/${id}/WORK_FLOW/chat-user`
|
],
|
||||||
} else if (hasPermission([new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(id)],[],'AND'),
|
'OR',
|
||||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getWorkspacePermissionWorkspaceManageRole,
|
)
|
||||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getApplicationWorkspaceResourcePermission(id)],'OR')) {
|
) {
|
||||||
return `/application/${id}/WORK_FLOW/chat-log`
|
return `/application/${id}/WORK_FLOW/overview`
|
||||||
} else return `/application`
|
} 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>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-card style="--el-card-padding: 0">
|
<el-card style="--el-card-padding: 0">
|
||||||
<el-row v-loading="loading">
|
<el-row v-loading="loading">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
@ -426,11 +427,8 @@
|
|||||||
ref="AddKnowledgeDialogRef"
|
ref="AddKnowledgeDialogRef"
|
||||||
@addData="addKnowledge"
|
@addData="addKnowledge"
|
||||||
:data="knowledgeList"
|
:data="knowledgeList"
|
||||||
@refresh="refresh"
|
|
||||||
:loading="knowledgeLoading"
|
:loading="knowledgeLoading"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon" />
|
|
||||||
<ReasoningParamSettingDialog
|
<ReasoningParamSettingDialog
|
||||||
ref="ReasoningParamSettingDialogRef"
|
ref="ReasoningParamSettingDialogRef"
|
||||||
@refresh="submitReasoningDialog"
|
@refresh="submitReasoningDialog"
|
||||||
@ -444,7 +442,6 @@ import { groupBy } from 'lodash'
|
|||||||
import AIModeParamSettingDialog from './component/AIModeParamSettingDialog.vue'
|
import AIModeParamSettingDialog from './component/AIModeParamSettingDialog.vue'
|
||||||
import ParamSettingDialog from './component/ParamSettingDialog.vue'
|
import ParamSettingDialog from './component/ParamSettingDialog.vue'
|
||||||
import AddKnowledgeDialog from './component/AddKnowledgeDialog.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 { FormInstance, FormRules } from 'element-plus'
|
||||||
import type { ApplicationFormType } from '@/api/type/application'
|
import type { ApplicationFormType } from '@/api/type/application'
|
||||||
import { relatedObject } from '@/utils/array'
|
import { relatedObject } from '@/utils/array'
|
||||||
@ -455,6 +452,8 @@ import TTSModeParamSettingDialog from './component/TTSModeParamSettingDialog.vue
|
|||||||
import ReasoningParamSettingDialog from './component/ReasoningParamSettingDialog.vue'
|
import ReasoningParamSettingDialog from './component/ReasoningParamSettingDialog.vue'
|
||||||
import permissionMap from '@/permission'
|
import permissionMap from '@/permission'
|
||||||
import ApplicationAPI from '@/api/application/application'
|
import ApplicationAPI from '@/api/application/application'
|
||||||
|
import { EditionConst } from '@/utils/permission/data'
|
||||||
|
import { hasPermission } from '@/utils/permission/index'
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const apiType = computed<'workspace'>(() => {
|
const apiType = computed<'workspace'>(() => {
|
||||||
@ -489,10 +488,10 @@ const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
|
|||||||
|
|
||||||
const applicationFormRef = ref<FormInstance>()
|
const applicationFormRef = ref<FormInstance>()
|
||||||
const AddKnowledgeDialogRef = ref()
|
const AddKnowledgeDialogRef = ref()
|
||||||
const EditAvatarDialogRef = ref()
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const knowledgeLoading = ref(false)
|
const knowledgeLoading = ref(false)
|
||||||
|
|
||||||
const applicationForm = ref<ApplicationFormType>({
|
const applicationForm = ref<ApplicationFormType>({
|
||||||
name: '',
|
name: '',
|
||||||
desc: '',
|
desc: '',
|
||||||
@ -526,6 +525,7 @@ const applicationForm = ref<ApplicationFormType>({
|
|||||||
tts_type: 'BROWSER',
|
tts_type: 'BROWSER',
|
||||||
type: 'SIMPLE',
|
type: 'SIMPLE',
|
||||||
})
|
})
|
||||||
|
const themeDetail = ref({})
|
||||||
|
|
||||||
const rules = reactive<FormRules<ApplicationFormType>>({
|
const rules = reactive<FormRules<ApplicationFormType>>({
|
||||||
name: [
|
name: [
|
||||||
@ -657,6 +657,13 @@ function getDetail() {
|
|||||||
knowledgeList.value = res.data.knowledge_list
|
knowledgeList.value = res.data.knowledge_list
|
||||||
applicationForm.value.model_setting.no_references_prompt =
|
applicationForm.value.model_setting.no_references_prompt =
|
||||||
res.data.model_setting.no_references_prompt || '{question}'
|
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(() => {
|
onMounted(() => {
|
||||||
getSelectModel()
|
getSelectModel()
|
||||||
getDetail()
|
getDetail()
|
||||||
|
|||||||
@ -145,7 +145,7 @@ const open = (data: any, folder: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const submitValid = (formEl: FormInstance | undefined) => {
|
const submitValid = (formEl: FormInstance | undefined) => {
|
||||||
if (user.isEnterprise()) {
|
if (user.isEE() || user.isPE()) {
|
||||||
submitHandle(formEl)
|
submitHandle(formEl)
|
||||||
} else {
|
} else {
|
||||||
common
|
common
|
||||||
|
|||||||
@ -66,6 +66,7 @@
|
|||||||
@new-chat="newChat"
|
@new-chat="newChat"
|
||||||
@clickLog="clickListHandle"
|
@clickLog="clickListHandle"
|
||||||
@delete-log="deleteLog"
|
@delete-log="deleteLog"
|
||||||
|
@refreshFieldTitle="refreshFieldTitle"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -149,6 +150,7 @@ function newChat() {
|
|||||||
chatLogData.value.unshift(newObj)
|
chatLogData.value.unshift(newObj)
|
||||||
}
|
}
|
||||||
currentChatId.value = 'new'
|
currentChatId.value = 'new'
|
||||||
|
show.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChatLog(id: string) {
|
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) {
|
function refresh(id: string) {
|
||||||
getChatLog(applicationDetail.value.id)
|
getChatLog(applicationDetail.value.id)
|
||||||
currentChatId.value = id
|
currentChatId.value = id
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
:is="currentTemplate"
|
:is="currentTemplate"
|
||||||
:application_profile="chatUser.application"
|
:application_profile="chatUser.application"
|
||||||
:key="route.fullPath"
|
:key="route.fullPath"
|
||||||
v-loading="loading"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -35,14 +34,6 @@ const currentTemplate = computed(() => {
|
|||||||
return components[name].default
|
return components[name].default
|
||||||
})
|
})
|
||||||
|
|
||||||
const loading = ref(false)
|
|
||||||
|
|
||||||
const applicationAvailable = ref<boolean>(true)
|
const applicationAvailable = ref<boolean>(true)
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
|
||||||
@media only screen and (max-width: 768px) {
|
|
||||||
.el-dialog {
|
|
||||||
width: 90% !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@ -58,18 +58,18 @@
|
|||||||
>
|
>
|
||||||
</AiChat>
|
</AiChat>
|
||||||
</div>
|
</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>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -156,6 +156,7 @@ function newChat() {
|
|||||||
chatLogData.value.unshift(newObj)
|
chatLogData.value.unshift(newObj)
|
||||||
}
|
}
|
||||||
currentChatId.value = 'new'
|
currentChatId.value = 'new'
|
||||||
|
show.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChatLog(id: string) {
|
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) {
|
function refresh(id: string) {
|
||||||
getChatLog(applicationDetail.value.id)
|
getChatLog(applicationDetail.value.id)
|
||||||
currentChatId.value = id
|
currentChatId.value = id
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
class="chat-pc"
|
class="chat-pc"
|
||||||
:class="classObj"
|
:class="classObj"
|
||||||
v-loading="loading"
|
v-loading="loading || left_loading"
|
||||||
:style="{
|
:style="{
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
|
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user