Skip to content

Commit bbb63a5

Browse files
fix: chat avatar display issue fixed (#2832)
1 parent 4ae02c8 commit bbb63a5

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

ui/src/components/ai-chat/component/answer-content/index.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div class="item-content mb-16 lighter">
33
<template v-for="(answer_text, index) in answer_text_list" :key="index">
4-
<div class="avatar mr-8" v-if="application.show_avatar">
4+
<div class="avatar mr-8" v-if="showAvatar">
55
<img v-if="application.avatar" :src="application.avatar" height="28px" width="28px" />
66
<LogoIcon v-else height="28px" width="28px" />
77
</div>
88
<div
99
class="content"
1010
@mouseup="openControl"
1111
:style="{
12-
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
12+
'padding-right': showAvatar ? 'var(--padding-left)' : '0'
1313
}"
1414
>
1515
<el-card shadow="always" class="mb-8 border-r-8" style="--el-card-padding: 6px 16px">
@@ -51,8 +51,8 @@
5151
<div
5252
class="content"
5353
:style="{
54-
'padding-left': application.show_avatar ? 'var(--padding-left)' : '0',
55-
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
54+
'padding-left': showAvatar ? 'var(--padding-left)' : '0',
55+
'padding-right': showAvatar ? 'var(--padding-left)' : '0'
5656
}"
5757
>
5858
<OperationButton
@@ -75,6 +75,7 @@ import OperationButton from '@/components/ai-chat/component/operation-button/ind
7575
import { type chatType } from '@/api/type/application'
7676
import { computed } from 'vue'
7777
import bus from '@/bus'
78+
import useStore from '@/stores'
7879
const props = defineProps<{
7980
chatRecord: chatType
8081
application: any
@@ -84,8 +85,14 @@ const props = defineProps<{
8485
type: 'log' | 'ai-chat' | 'debug-ai-chat'
8586
}>()
8687
88+
const { user } = useStore()
89+
8790
const emit = defineEmits(['update:chatRecord'])
8891
92+
const showAvatar = computed(() => {
93+
return user.isEnterprise() ? props.application.show_avatar : true
94+
})
95+
8996
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
9097
if (type === 'old') {
9198
add_answer_text_list(props.chatRecord.answer_text_list)

ui/src/components/ai-chat/component/prologue-content/index.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<!-- 开场白组件 -->
33
<div class="item-content mb-16">
4-
<div class="avatar mr-8" v-if="prologue && application.show_avatar">
4+
<div class="avatar mr-8" v-if="prologue && showAvatar">
55
<img v-if="application.avatar" :src="application.avatar" height="28px" width="28px" />
66
<LogoIcon v-else height="28px" width="28px" />
77
</div>
88
<div
99
class="content"
1010
v-if="prologue"
1111
:style="{
12-
'padding-right': application.show_user_avatar ? 'var(--padding-left)' : '0'
12+
'padding-right': showUserAvatar ? 'var(--padding-left)' : '0'
1313
}"
1414
>
1515
<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'
2727
import { computed } from 'vue'
2828
import MdRenderer from '@/components/markdown/MdRenderer.vue'
2929
import { t } from '@/locales'
30+
import useStore from '@/stores'
3031
const props = defineProps<{
3132
application: any
3233
available: boolean
3334
type: 'log' | 'ai-chat' | 'debug-ai-chat'
3435
sendMessage: (question: string, other_params_data?: any, chat?: chatType) => void
3536
}>()
37+
38+
const { user } = useStore()
39+
40+
const showAvatar = computed(() => {
41+
return user.isEnterprise() ? props.application.show_avatar : true
42+
})
43+
const showUserAvatar = computed(() => {
44+
return user.isEnterprise() ? props.application.show_user_avatar : true
45+
})
46+
3647
const toQuickQuestion = (match: string, offset: number, input: string) => {
3748
return `<quick_question>${match.replace('- ', '')}</quick_question>`
3849
}

ui/src/components/ai-chat/component/question-content/index.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<span> {{ chatRecord.problem_text }}</span>
6464
</div>
6565
</div>
66-
<div class="avatar ml-8" v-if="application.show_user_avatar">
66+
<div class="avatar ml-8" v-if="showAvatar">
6767
<el-image
6868
v-if="application.user_avatar"
6969
:src="application.user_avatar"
@@ -81,12 +81,18 @@
8181
import { type chatType } from '@/api/type/application'
8282
import { getImgUrl, getAttrsArray, downloadByURL } from '@/utils/utils'
8383
import { onMounted, computed } from 'vue'
84-
84+
import useStore from '@/stores'
8585
const props = defineProps<{
8686
application: any
8787
chatRecord: chatType
8888
type: 'log' | 'ai-chat' | 'debug-ai-chat'
8989
}>()
90+
91+
const { user } = useStore()
92+
93+
const showAvatar = computed(() => {
94+
return user.isEnterprise() ? props.application.show_user_avatar : true
95+
})
9096
const document_list = computed(() => {
9197
if (props.chatRecord?.upload_meta) {
9298
return props.chatRecord.upload_meta?.document_list || []

ui/src/workflow/nodes/condition-node/index.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
v-resize="(wh: any) => resizeCondition(wh, item, index)"
2424
shadow="never"
2525
class="drag-card card-never mb-8"
26-
:class="{ 'no-drag': index === form_data.branch.length - 1 }"
26+
:class="{
27+
'no-drag': index === form_data.branch.length - 1 || form_data.branch.length === 2
28+
}"
2729
style="--el-card-padding: 12px"
2830
>
2931
<div class="handle flex-between lighter">
@@ -245,7 +247,9 @@ function onEnd(event?: any) {
245247
const { oldIndex, newIndex, clonedData } = event
246248
if (oldIndex === undefined || newIndex === undefined) return
247249
const list = cloneDeep(props.nodeModel.properties.node_data.branch)
248-
250+
if (oldIndex === list.length - 1 || newIndex === list.length - 1) {
251+
return
252+
}
249253
list[newIndex].type = list[oldIndex].type
250254
list[oldIndex].type = clonedData.type // 恢复原始 type
251255
set(props.nodeModel.properties.node_data, 'branch', list)

0 commit comments

Comments
 (0)