Commit 4766c052 authored by nick zheng's avatar nick zheng

fix: 应用没有添加图片ocr插件,不展示上传图片

parent 7b3a284e
export enum PluginType {
IMAGE_OCR = 'image_ocr',
HTML_READER = 'html_reader',
NOTIFICATION_REMINDER = 'notification_reminder',
WEB_SEARCH = 'web_search',
WEIBO_SEARCH_TOP = 'weibo_search_top',
TOUTIAO_SEARCH_TOP = 'toutiao_search_top',
DOUYIN_SEARCH_TOP = 'douyin_search_top',
}
...@@ -19,6 +19,7 @@ interface Props { ...@@ -19,6 +19,7 @@ interface Props {
agentId: string agentId: string
isAnswerResponseWait: boolean isAnswerResponseWait: boolean
isEnableDocumentParse: boolean isEnableDocumentParse: boolean
isEnableUploadImage: boolean
} }
const props = defineProps<Props>() const props = defineProps<Props>()
...@@ -282,6 +283,7 @@ function handleSelectUploadImage(cb: () => void) { ...@@ -282,6 +283,7 @@ function handleSelectUploadImage(cb: () => void) {
<n-popover style="width: 210px" trigger="hover"> <n-popover style="width: 210px" trigger="hover">
<template #trigger> <template #trigger>
<div <div
v-show="isEnableUploadImage"
class="border-inactive-border-color text-font-color hover:text-theme-color flex h-[54px] w-[54px] shrink-0 cursor-pointer items-center justify-center rounded-full border bg-white" class="border-inactive-border-color text-font-color hover:text-theme-color flex h-[54px] w-[54px] shrink-0 cursor-pointer items-center justify-center rounded-full border bg-white"
@click="handleSelectUploadImage(handleClick)" @click="handleSelectUploadImage(handleClick)"
> >
......
...@@ -20,6 +20,7 @@ import { PersonalAppConfigState } from '@/store/types/personal-app-config' ...@@ -20,6 +20,7 @@ import { PersonalAppConfigState } from '@/store/types/personal-app-config'
import { defaultPersonalAppConfigState } from '@/store/modules/personal-app-config' import { defaultPersonalAppConfigState } from '@/store/modules/personal-app-config'
import { useThrottleFn } from '@vueuse/core' import { useThrottleFn } from '@vueuse/core'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { PluginType } from '@/enums/plugin'
const { t } = useI18n() const { t } = useI18n()
...@@ -49,6 +50,10 @@ const isEnableDocumentParse = computed(() => { ...@@ -49,6 +50,10 @@ const isEnableDocumentParse = computed(() => {
return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y' return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y'
}) })
const isEnableUploadImage = computed(() => {
return agentApplicationConfig.value.unitIds.includes(PluginType.IMAGE_OCR)
})
onMounted(async () => { onMounted(async () => {
if (!currentRoute.params.agentId) { if (!currentRoute.params.agentId) {
window.$message.warning(t('multi_model_dialogue_module.not_find_agent')) window.$message.warning(t('multi_model_dialogue_module.not_find_agent'))
...@@ -332,6 +337,7 @@ function handleBlockMessageResponse() { ...@@ -332,6 +337,7 @@ function handleBlockMessageResponse() {
:agent-id="agentId" :agent-id="agentId"
:is-answer-response-wait="isAnswerResponseWait" :is-answer-response-wait="isAnswerResponseWait"
:is-enable-document-parse="isEnableDocumentParse" :is-enable-document-parse="isEnableDocumentParse"
:is-enable-upload-image="isEnableUploadImage"
@add-question-message-item="handleAddQuestionMessageItem" @add-question-message-item="handleAddQuestionMessageItem"
@add-answer-message-item="handleAddAnswerMessageItem" @add-answer-message-item="handleAddAnswerMessageItem"
@update-message-item="handleUpdateSpecifyMessageItem" @update-message-item="handleUpdateSpecifyMessageItem"
......
...@@ -14,6 +14,7 @@ import WebSocketCtr from '@/utils/web-socket-ctr' ...@@ -14,6 +14,7 @@ import WebSocketCtr from '@/utils/web-socket-ctr'
import { ChannelType } from '@/enums/channel' import { ChannelType } from '@/enums/channel'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useUploadImage } from '@/composables/useUploadImage' import { useUploadImage } from '@/composables/useUploadImage'
import { PluginType } from '@/enums/plugin'
interface Props { interface Props {
messageList: Map<string, ConversationMessageItem> messageList: Map<string, ConversationMessageItem>
...@@ -99,6 +100,10 @@ const isUploadFileDisabled = computed(() => { ...@@ -99,6 +100,10 @@ const isUploadFileDisabled = computed(() => {
return uploadFileList.value.length === 1 return uploadFileList.value.length === 1
}) })
const isEnableUploadImage = computed(() => {
return personalAppConfigStore.unitIds.includes(PluginType.IMAGE_OCR)
})
const uploadFileIcon = (type: string) => { const uploadFileIcon = (type: string) => {
return `https://gsst-poe-sit.gz.bcebos.com/icon/${type}.svg` return `https://gsst-poe-sit.gz.bcebos.com/icon/${type}.svg`
} }
...@@ -595,6 +600,7 @@ defineExpose({ ...@@ -595,6 +600,7 @@ defineExpose({
<n-popover style="width: 210px" trigger="hover"> <n-popover style="width: 210px" trigger="hover">
<template #trigger> <template #trigger>
<div <div
v-show="isEnableUploadImage"
class="h-7.5 w-7.5 hover:text-theme-color text-font-color mb-1 flex cursor-pointer items-center justify-center rounded-full bg-white" class="h-7.5 w-7.5 hover:text-theme-color text-font-color mb-1 flex cursor-pointer items-center justify-center rounded-full bg-white"
@click="handleSelectImage(handleClick)" @click="handleSelectImage(handleClick)"
> >
......
...@@ -21,6 +21,7 @@ interface Props { ...@@ -21,6 +21,7 @@ interface Props {
messageList: Map<string, ConversationMessageItem> messageList: Map<string, ConversationMessageItem>
continuousQuestionStatus: 'default' | 'close' continuousQuestionStatus: 'default' | 'close'
isEnableDocumentParse: boolean isEnableDocumentParse: boolean
isEnableUploadImage: boolean
isEnableVoice: boolean isEnableVoice: boolean
answerAudioAutoPlay: boolean answerAudioAutoPlay: boolean
answerAudioPlaying: boolean answerAudioPlaying: boolean
...@@ -585,6 +586,7 @@ defineExpose({ ...@@ -585,6 +586,7 @@ defineExpose({
<n-popover style="width: 210px" trigger="hover"> <n-popover style="width: 210px" trigger="hover">
<template #trigger> <template #trigger>
<div <div
v-show="isEnableDocumentParse"
class="h-7.5 w-7.5 hover:text-theme-color text-font-color mb-1 flex cursor-pointer items-center justify-center rounded-full bg-white" class="h-7.5 w-7.5 hover:text-theme-color text-font-color mb-1 flex cursor-pointer items-center justify-center rounded-full bg-white"
@click="handleSelectImage(handleClick)" @click="handleSelectImage(handleClick)"
> >
......
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
} from '@/apis/agent-application' } from '@/apis/agent-application'
import { useLayoutConfig } from '@/composables/useLayoutConfig' import { useLayoutConfig } from '@/composables/useLayoutConfig'
import { validBrowser } from '@/utils/browser-detection' import { validBrowser } from '@/utils/browser-detection'
import { PluginType } from '@/enums/plugin'
const { t } = useI18n() const { t } = useI18n()
...@@ -55,6 +56,10 @@ const isEnableDocumentParse = computed(() => { ...@@ -55,6 +56,10 @@ const isEnableDocumentParse = computed(() => {
return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y' return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y'
}) })
const isEnableUploadImage = computed(() => {
return agentApplicationConfig.value.unitIds.includes(PluginType.IMAGE_OCR)
})
const isEnableVoice = computed(() => { const isEnableVoice = computed(() => {
return !!agentApplicationConfig.value.voiceConfig.timbreId return !!agentApplicationConfig.value.voiceConfig.timbreId
}) })
...@@ -341,6 +346,7 @@ function handleAudioPause(isClearMessageList = false) { ...@@ -341,6 +346,7 @@ function handleAudioPause(isClearMessageList = false) {
:agent-id="agentApplicationConfig.baseInfo.agentId" :agent-id="agentApplicationConfig.baseInfo.agentId"
:continuous-question-status="continuousQuestionStatus" :continuous-question-status="continuousQuestionStatus"
:is-enable-document-parse="isEnableDocumentParse" :is-enable-document-parse="isEnableDocumentParse"
:is-enable-upload-image="isEnableUploadImage"
:is-enable-voice="isEnableVoice" :is-enable-voice="isEnableVoice"
:answer-audio-auto-play="answerAudioAutoPlay" :answer-audio-auto-play="answerAudioAutoPlay"
:answer-audio-playing="answerAudioPlaying" :answer-audio-playing="answerAudioPlaying"
......
...@@ -22,6 +22,7 @@ import { useLayoutConfig } from '@/composables/useLayoutConfig' ...@@ -22,6 +22,7 @@ import { useLayoutConfig } from '@/composables/useLayoutConfig'
import { fetchGetMemberInfoById } from '@/apis/user' import { fetchGetMemberInfoById } from '@/apis/user'
import { UserInfo } from '@/store/types/user' import { UserInfo } from '@/store/types/user'
import { validBrowser } from '@/utils/browser-detection' import { validBrowser } from '@/utils/browser-detection'
import { PluginType } from '@/enums/plugin'
const { t } = useI18n() const { t } = useI18n()
...@@ -58,6 +59,10 @@ const isEnableDocumentParse = computed(() => { ...@@ -58,6 +59,10 @@ const isEnableDocumentParse = computed(() => {
return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y' return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y'
}) })
const isEnableUploadImage = computed(() => {
return agentApplicationConfig.value.unitIds.includes(PluginType.IMAGE_OCR)
})
const isEnableVoice = computed(() => { const isEnableVoice = computed(() => {
return !!agentApplicationConfig.value.voiceConfig.timbreId return !!agentApplicationConfig.value.voiceConfig.timbreId
}) })
...@@ -364,6 +369,7 @@ function handleAudioPause(isClearMessageList = false) { ...@@ -364,6 +369,7 @@ function handleAudioPause(isClearMessageList = false) {
:agent-id="agentApplicationConfig.baseInfo.agentId" :agent-id="agentApplicationConfig.baseInfo.agentId"
:continuous-question-status="continuousQuestionStatus" :continuous-question-status="continuousQuestionStatus"
:is-enable-document-parse="isEnableDocumentParse" :is-enable-document-parse="isEnableDocumentParse"
:is-enable-upload-image="isEnableUploadImage"
:is-enable-voice="isEnableVoice" :is-enable-voice="isEnableVoice"
:answer-audio-auto-play="answerAudioAutoPlay" :answer-audio-auto-play="answerAudioAutoPlay"
:answer-audio-playing="answerAudioPlaying" :answer-audio-playing="answerAudioPlaying"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment