fix: chat avatar display issue fixed (#2832)
This commit is contained in:
parent
4ae02c8d3e
commit
bbb63a5928
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="item-content mb-16 lighter">
|
<div class="item-content mb-16 lighter">
|
||||||
<template v-for="(answer_text, index) in answer_text_list" :key="index">
|
<template v-for="(answer_text, index) in answer_text_list" :key="index">
|
||||||
<div class="avatar mr-8" v-if="application.show_avatar">
|
<div class="avatar mr-8" v-if="showAvatar">
|
||||||
<img v-if="application.avatar" :src="application.avatar" height="28px" width="28px" />
|
<img v-if="application.avatar" :src="application.avatar" height="28px" width="28px" />
|
||||||
<LogoIcon v-else height="28px" width="28px" />
|
<LogoIcon v-else height="28px" width="28px" />
|
||||||
</div>
|
</div>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
class="content"
|
class="content"
|
||||||
@mouseup="openControl"
|
@mouseup="openControl"
|
||||||
:style="{
|
:style="{
|
||||||
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
|
'padding-right': showAvatar ? 'var(--padding-left)' : '0'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<el-card shadow="always" class="mb-8 border-r-8" style="--el-card-padding: 6px 16px">
|
<el-card shadow="always" class="mb-8 border-r-8" style="--el-card-padding: 6px 16px">
|
||||||
@ -51,8 +51,8 @@
|
|||||||
<div
|
<div
|
||||||
class="content"
|
class="content"
|
||||||
:style="{
|
:style="{
|
||||||
'padding-left': application.show_avatar ? 'var(--padding-left)' : '0',
|
'padding-left': showAvatar ? 'var(--padding-left)' : '0',
|
||||||
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
|
'padding-right': showAvatar ? 'var(--padding-left)' : '0'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<OperationButton
|
<OperationButton
|
||||||
@ -75,6 +75,7 @@ import OperationButton from '@/components/ai-chat/component/operation-button/ind
|
|||||||
import { type chatType } from '@/api/type/application'
|
import { type chatType } from '@/api/type/application'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import bus from '@/bus'
|
import bus from '@/bus'
|
||||||
|
import useStore from '@/stores'
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
chatRecord: chatType
|
chatRecord: chatType
|
||||||
application: any
|
application: any
|
||||||
@ -84,8 +85,14 @@ const props = defineProps<{
|
|||||||
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { user } = useStore()
|
||||||
|
|
||||||
const emit = defineEmits(['update:chatRecord'])
|
const emit = defineEmits(['update:chatRecord'])
|
||||||
|
|
||||||
|
const showAvatar = computed(() => {
|
||||||
|
return user.isEnterprise() ? props.application.show_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') {
|
||||||
add_answer_text_list(props.chatRecord.answer_text_list)
|
add_answer_text_list(props.chatRecord.answer_text_list)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 开场白组件 -->
|
<!-- 开场白组件 -->
|
||||||
<div class="item-content mb-16">
|
<div class="item-content mb-16">
|
||||||
<div class="avatar mr-8" v-if="prologue && application.show_avatar">
|
<div class="avatar mr-8" v-if="prologue && showAvatar">
|
||||||
<img v-if="application.avatar" :src="application.avatar" height="28px" width="28px" />
|
<img v-if="application.avatar" :src="application.avatar" height="28px" width="28px" />
|
||||||
<LogoIcon v-else height="28px" width="28px" />
|
<LogoIcon v-else height="28px" width="28px" />
|
||||||
</div>
|
</div>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
class="content"
|
class="content"
|
||||||
v-if="prologue"
|
v-if="prologue"
|
||||||
:style="{
|
:style="{
|
||||||
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
|
'padding-right': showUserAvatar ? 'var(--padding-left)' : '0'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<el-card shadow="always" class="border-r-8" style="--el-card-padding: 10px 16px 12px">
|
<el-card shadow="always" class="border-r-8" style="--el-card-padding: 10px 16px 12px">
|
||||||
@ -27,12 +27,23 @@ import { type chatType } from '@/api/type/application'
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import MdRenderer from '@/components/markdown/MdRenderer.vue'
|
import MdRenderer from '@/components/markdown/MdRenderer.vue'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
|
import useStore from '@/stores'
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
application: any
|
application: any
|
||||||
available: boolean
|
available: boolean
|
||||||
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
||||||
sendMessage: (question: string, other_params_data?: any, chat?: chatType) => void
|
sendMessage: (question: string, other_params_data?: any, chat?: chatType) => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { user } = useStore()
|
||||||
|
|
||||||
|
const showAvatar = computed(() => {
|
||||||
|
return user.isEnterprise() ? props.application.show_avatar : true
|
||||||
|
})
|
||||||
|
const showUserAvatar = computed(() => {
|
||||||
|
return user.isEnterprise() ? props.application.show_user_avatar : true
|
||||||
|
})
|
||||||
|
|
||||||
const toQuickQuestion = (match: string, offset: number, input: string) => {
|
const toQuickQuestion = (match: string, offset: number, input: string) => {
|
||||||
return `<quick_question>${match.replace('- ', '')}</quick_question>`
|
return `<quick_question>${match.replace('- ', '')}</quick_question>`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@
|
|||||||
<span> {{ chatRecord.problem_text }}</span>
|
<span> {{ chatRecord.problem_text }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="avatar ml-8" v-if="application.show_user_avatar">
|
<div class="avatar ml-8" v-if="showAvatar">
|
||||||
<el-image
|
<el-image
|
||||||
v-if="application.user_avatar"
|
v-if="application.user_avatar"
|
||||||
:src="application.user_avatar"
|
:src="application.user_avatar"
|
||||||
@ -81,12 +81,18 @@
|
|||||||
import { type chatType } from '@/api/type/application'
|
import { type chatType } from '@/api/type/application'
|
||||||
import { getImgUrl, getAttrsArray, downloadByURL } from '@/utils/utils'
|
import { getImgUrl, getAttrsArray, downloadByURL } from '@/utils/utils'
|
||||||
import { onMounted, computed } from 'vue'
|
import { onMounted, computed } from 'vue'
|
||||||
|
import useStore from '@/stores'
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
application: any
|
application: any
|
||||||
chatRecord: chatType
|
chatRecord: chatType
|
||||||
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { user } = useStore()
|
||||||
|
|
||||||
|
const showAvatar = computed(() => {
|
||||||
|
return user.isEnterprise() ? props.application.show_user_avatar : true
|
||||||
|
})
|
||||||
const document_list = computed(() => {
|
const document_list = computed(() => {
|
||||||
if (props.chatRecord?.upload_meta) {
|
if (props.chatRecord?.upload_meta) {
|
||||||
return props.chatRecord.upload_meta?.document_list || []
|
return props.chatRecord.upload_meta?.document_list || []
|
||||||
|
|||||||
@ -23,7 +23,9 @@
|
|||||||
v-resize="(wh: any) => resizeCondition(wh, item, index)"
|
v-resize="(wh: any) => resizeCondition(wh, item, index)"
|
||||||
shadow="never"
|
shadow="never"
|
||||||
class="drag-card card-never mb-8"
|
class="drag-card card-never mb-8"
|
||||||
:class="{ 'no-drag': index === form_data.branch.length - 1 }"
|
:class="{
|
||||||
|
'no-drag': index === form_data.branch.length - 1 || form_data.branch.length === 2
|
||||||
|
}"
|
||||||
style="--el-card-padding: 12px"
|
style="--el-card-padding: 12px"
|
||||||
>
|
>
|
||||||
<div class="handle flex-between lighter">
|
<div class="handle flex-between lighter">
|
||||||
@ -245,7 +247,9 @@ function onEnd(event?: any) {
|
|||||||
const { oldIndex, newIndex, clonedData } = event
|
const { oldIndex, newIndex, clonedData } = event
|
||||||
if (oldIndex === undefined || newIndex === undefined) return
|
if (oldIndex === undefined || newIndex === undefined) return
|
||||||
const list = cloneDeep(props.nodeModel.properties.node_data.branch)
|
const list = cloneDeep(props.nodeModel.properties.node_data.branch)
|
||||||
|
if (oldIndex === list.length - 1 || newIndex === list.length - 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
list[newIndex].type = list[oldIndex].type
|
list[newIndex].type = list[oldIndex].type
|
||||||
list[oldIndex].type = clonedData.type // 恢复原始 type
|
list[oldIndex].type = clonedData.type // 恢复原始 type
|
||||||
set(props.nodeModel.properties.node_data, 'branch', list)
|
set(props.nodeModel.properties.node_data, 'branch', list)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user