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 {
agentId: string
isAnswerResponseWait: boolean
isEnableDocumentParse: boolean
isEnableUploadImage: boolean
}
const props = defineProps<Props>()
......@@ -282,6 +283,7 @@ function handleSelectUploadImage(cb: () => void) {
<n-popover style="width: 210px" trigger="hover">
<template #trigger>
<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"
@click="handleSelectUploadImage(handleClick)"
>
......
......@@ -20,6 +20,7 @@ import { PersonalAppConfigState } from '@/store/types/personal-app-config'
import { defaultPersonalAppConfigState } from '@/store/modules/personal-app-config'
import { useThrottleFn } from '@vueuse/core'
import { useUserStore } from '@/store/modules/user'
import { PluginType } from '@/enums/plugin'
const { t } = useI18n()
......@@ -49,6 +50,10 @@ const isEnableDocumentParse = computed(() => {
return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y'
})
const isEnableUploadImage = computed(() => {
return agentApplicationConfig.value.unitIds.includes(PluginType.IMAGE_OCR)
})
onMounted(async () => {
if (!currentRoute.params.agentId) {
window.$message.warning(t('multi_model_dialogue_module.not_find_agent'))
......@@ -332,6 +337,7 @@ function handleBlockMessageResponse() {
:agent-id="agentId"
:is-answer-response-wait="isAnswerResponseWait"
:is-enable-document-parse="isEnableDocumentParse"
:is-enable-upload-image="isEnableUploadImage"
@add-question-message-item="handleAddQuestionMessageItem"
@add-answer-message-item="handleAddAnswerMessageItem"
@update-message-item="handleUpdateSpecifyMessageItem"
......
......@@ -14,6 +14,7 @@ import WebSocketCtr from '@/utils/web-socket-ctr'
import { ChannelType } from '@/enums/channel'
import { useUserStore } from '@/store/modules/user'
import { useUploadImage } from '@/composables/useUploadImage'
import { PluginType } from '@/enums/plugin'
interface Props {
messageList: Map<string, ConversationMessageItem>
......@@ -99,6 +100,10 @@ const isUploadFileDisabled = computed(() => {
return uploadFileList.value.length === 1
})
const isEnableUploadImage = computed(() => {
return personalAppConfigStore.unitIds.includes(PluginType.IMAGE_OCR)
})
const uploadFileIcon = (type: string) => {
return `https://gsst-poe-sit.gz.bcebos.com/icon/${type}.svg`
}
......@@ -595,6 +600,7 @@ defineExpose({
<n-popover style="width: 210px" trigger="hover">
<template #trigger>
<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"
@click="handleSelectImage(handleClick)"
>
......
......@@ -21,6 +21,7 @@ interface Props {
messageList: Map<string, ConversationMessageItem>
continuousQuestionStatus: 'default' | 'close'
isEnableDocumentParse: boolean
isEnableUploadImage: boolean
isEnableVoice: boolean
answerAudioAutoPlay: boolean
answerAudioPlaying: boolean
......@@ -585,6 +586,7 @@ defineExpose({
<n-popover style="width: 210px" trigger="hover">
<template #trigger>
<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"
@click="handleSelectImage(handleClick)"
>
......
......@@ -20,6 +20,7 @@ import {
} from '@/apis/agent-application'
import { useLayoutConfig } from '@/composables/useLayoutConfig'
import { validBrowser } from '@/utils/browser-detection'
import { PluginType } from '@/enums/plugin'
const { t } = useI18n()
......@@ -55,6 +56,10 @@ const isEnableDocumentParse = computed(() => {
return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y'
})
const isEnableUploadImage = computed(() => {
return agentApplicationConfig.value.unitIds.includes(PluginType.IMAGE_OCR)
})
const isEnableVoice = computed(() => {
return !!agentApplicationConfig.value.voiceConfig.timbreId
})
......@@ -341,6 +346,7 @@ function handleAudioPause(isClearMessageList = false) {
:agent-id="agentApplicationConfig.baseInfo.agentId"
:continuous-question-status="continuousQuestionStatus"
:is-enable-document-parse="isEnableDocumentParse"
:is-enable-upload-image="isEnableUploadImage"
:is-enable-voice="isEnableVoice"
:answer-audio-auto-play="answerAudioAutoPlay"
:answer-audio-playing="answerAudioPlaying"
......
......@@ -22,6 +22,7 @@ import { useLayoutConfig } from '@/composables/useLayoutConfig'
import { fetchGetMemberInfoById } from '@/apis/user'
import { UserInfo } from '@/store/types/user'
import { validBrowser } from '@/utils/browser-detection'
import { PluginType } from '@/enums/plugin'
const { t } = useI18n()
......@@ -58,6 +59,10 @@ const isEnableDocumentParse = computed(() => {
return agentApplicationConfig.value.knowledgeConfig.isDocumentParsing === 'Y'
})
const isEnableUploadImage = computed(() => {
return agentApplicationConfig.value.unitIds.includes(PluginType.IMAGE_OCR)
})
const isEnableVoice = computed(() => {
return !!agentApplicationConfig.value.voiceConfig.timbreId
})
......@@ -364,6 +369,7 @@ function handleAudioPause(isClearMessageList = false) {
:agent-id="agentApplicationConfig.baseInfo.agentId"
:continuous-question-status="continuousQuestionStatus"
:is-enable-document-parse="isEnableDocumentParse"
:is-enable-upload-image="isEnableUploadImage"
:is-enable-voice="isEnableVoice"
:answer-audio-auto-play="answerAudioAutoPlay"
: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