11<template >
2- <div ref =" messageNode" :class =" ['flex flex-row py-4 pl-4 pr-11 group gap-2 w-full', 'justify-start']" >
2+ <div
3+ ref =" messageNode"
4+ :class =" ['flex flex-row py-4 pl-4 pr-11 group gap-2 w-full', 'justify-start']"
5+ >
36 <ModelIcon
47 :model-id =" message.model_id"
58 custom-class =" flex-shrink-0 w-5 h-5 block rounded-md bg-background"
@@ -66,13 +69,14 @@ import MessageInfo from './MessageInfo.vue'
6669import { useChatStore } from ' @/stores/chat'
6770import ModelIcon from ' @/components/icons/ModelIcon.vue'
6871import { Icon } from ' @iconify/vue'
69- import { toBlob } from ' html-to-image' ;
70-
72+ import { toBlob } from ' html-to-image'
73+ import { useDark } from ' @vueuse/core '
7174
7275const props = defineProps <{
7376 message: AssistantMessage
7477}>()
7578
79+ const isDark = useDark ()
7680const chatStore = useChatStore ()
7781const currentVariantIndex = ref (0 )
7882
@@ -81,8 +85,6 @@ const messageNode = useTemplateRef('messageNode')
8185// 获取当前会话ID
8286const currentThreadId = computed (() => chatStore .activeThreadId || ' ' )
8387
84-
85-
8688// 计算当前消息的所有变体(包括缓存中的)
8789const allVariants = computed (() => {
8890 const messageVariants = props .message .variants || []
@@ -164,7 +166,7 @@ const handleAction = (action: 'retry' | 'delete' | 'copy' | 'prev' | 'next' | 'c
164166 if (messageNode .value ) {
165167 toBlob (messageNode .value , {
166168 quality: 1 ,
167- backgroundColor: ' # FFFFFF' ,
169+ backgroundColor: isDark ? ' #000000 ' : ' # FFFFFF'
168170 }).then ((blob ) => {
169171 if (blob ) {
170172 const rd = new FileReader ()
0 commit comments