mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: chat avatar display issue fixed (#2832)
This commit is contained in:
parent
4ae02c8d3e
commit
bbb63a5928
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="item-content mb-16 lighter">
|
||||
<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" />
|
||||
<LogoIcon v-else height="28px" width="28px" />
|
||||
</div>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
class="content"
|
||||
@mouseup="openControl"
|
||||
: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">
|
||||
|
|
@ -51,8 +51,8 @@
|
|||
<div
|
||||
class="content"
|
||||
:style="{
|
||||
'padding-left': application.show_avatar ? 'var(--padding-left)' : '0',
|
||||
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
|
||||
'padding-left': showAvatar ? 'var(--padding-left)' : '0',
|
||||
'padding-right': showAvatar ? 'var(--padding-left)' : '0'
|
||||
}"
|
||||
>
|
||||
<OperationButton
|
||||
|
|
@ -75,6 +75,7 @@ import OperationButton from '@/components/ai-chat/component/operation-button/ind
|
|||
import { type chatType } from '@/api/type/application'
|
||||
import { computed } from 'vue'
|
||||
import bus from '@/bus'
|
||||
import useStore from '@/stores'
|
||||
const props = defineProps<{
|
||||
chatRecord: chatType
|
||||
application: any
|
||||
|
|
@ -84,8 +85,14 @@ const props = defineProps<{
|
|||
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
||||
}>()
|
||||
|
||||
const { user } = useStore()
|
||||
|
||||
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) => {
|
||||
if (type === 'old') {
|
||||
add_answer_text_list(props.chatRecord.answer_text_list)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<!-- 开场白组件 -->
|
||||
<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" />
|
||||
<LogoIcon v-else height="28px" width="28px" />
|
||||
</div>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
class="content"
|
||||
v-if="prologue"
|
||||
: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">
|
||||
|
|
@ -27,12 +27,23 @@ import { type chatType } from '@/api/type/application'
|
|||
import { computed } from 'vue'
|
||||
import MdRenderer from '@/components/markdown/MdRenderer.vue'
|
||||
import { t } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
const props = defineProps<{
|
||||
application: any
|
||||
available: boolean
|
||||
type: 'log' | 'ai-chat' | 'debug-ai-chat'
|
||||
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) => {
|
||||
return `<quick_question>${match.replace('- ', '')}</quick_question>`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<span> {{ chatRecord.problem_text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="avatar ml-8" v-if="application.show_user_avatar">
|
||||
<div class="avatar ml-8" v-if="showAvatar">
|
||||
<el-image
|
||||
v-if="application.user_avatar"
|
||||
:src="application.user_avatar"
|
||||
|
|
@ -81,12 +81,18 @@
|
|||
import { type chatType } from '@/api/type/application'
|
||||
import { getImgUrl, getAttrsArray, downloadByURL } from '@/utils/utils'
|
||||
import { onMounted, computed } from 'vue'
|
||||
|
||||
import useStore from '@/stores'
|
||||
const props = defineProps<{
|
||||
application: any
|
||||
chatRecord: chatType
|
||||
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(() => {
|
||||
if (props.chatRecord?.upload_meta) {
|
||||
return props.chatRecord.upload_meta?.document_list || []
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@
|
|||
v-resize="(wh: any) => resizeCondition(wh, item, index)"
|
||||
shadow="never"
|
||||
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"
|
||||
>
|
||||
<div class="handle flex-between lighter">
|
||||
|
|
@ -245,7 +247,9 @@ function onEnd(event?: any) {
|
|||
const { oldIndex, newIndex, clonedData } = event
|
||||
if (oldIndex === undefined || newIndex === undefined) return
|
||||
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[oldIndex].type = clonedData.type // 恢复原始 type
|
||||
set(props.nodeModel.properties.node_data, 'branch', list)
|
||||
|
|
|
|||
Loading…
Reference in New Issue