@@ -23,7 +23,6 @@ import CopyIcon from "../icons/copy.svg";
23
23
import LoadingIcon from "../icons/three-dots.svg" ;
24
24
import ChatGptIcon from "../icons/chatgpt.png" ;
25
25
import ShareIcon from "../icons/share.svg" ;
26
- import BotIcon from "../icons/bot.png" ;
27
26
28
27
import DownloadIcon from "../icons/download.svg" ;
29
28
import { useEffect , useMemo , useRef , useState } from "react" ;
@@ -33,13 +32,13 @@ import dynamic from "next/dynamic";
33
32
import NextImage from "next/image" ;
34
33
35
34
import { toBlob , toPng } from "html-to-image" ;
36
- import { DEFAULT_MASK_AVATAR } from "../store/mask" ;
37
35
38
36
import { prettyObject } from "../utils/format" ;
39
37
import { EXPORT_MESSAGE_CLASS_NAME } from "../constant" ;
40
38
import { getClientConfig } from "../config/client" ;
41
39
import { type ClientApi , getClientApi } from "../client/api" ;
42
40
import { getMessageTextContent } from "../utils" ;
41
+ import { MaskAvatar } from "./mask" ;
43
42
import clsx from "clsx" ;
44
43
45
44
const Markdown = dynamic ( async ( ) => ( await import ( "./markdown" ) ) . Markdown , {
@@ -407,22 +406,6 @@ export function PreviewActions(props: {
407
406
) ;
408
407
}
409
408
410
- function ExportAvatar ( props : { avatar : string } ) {
411
- if ( props . avatar === DEFAULT_MASK_AVATAR ) {
412
- return (
413
- < img
414
- src = { BotIcon . src }
415
- width = { 30 }
416
- height = { 30 }
417
- alt = "bot"
418
- className = "user-avatar"
419
- />
420
- ) ;
421
- }
422
-
423
- return < Avatar avatar = { props . avatar } /> ;
424
- }
425
-
426
409
export function ImagePreviewer ( props : {
427
410
messages : ChatMessage [ ] ;
428
411
topic : string ;
@@ -546,9 +529,12 @@ export function ImagePreviewer(props: {
546
529
github.com/ChatGPTNextWeb/ChatGPT-Next-Web
547
530
</ div >
548
531
< div className = { styles [ "icons" ] } >
549
- < ExportAvatar avatar = { config . avatar } />
532
+ < MaskAvatar avatar = { config . avatar } />
550
533
< span className = { styles [ "icon-space" ] } > & </ span >
551
- < ExportAvatar avatar = { mask . avatar } />
534
+ < MaskAvatar
535
+ avatar = { mask . avatar }
536
+ model = { session . mask . modelConfig . model }
537
+ />
552
538
</ div >
553
539
</ div >
554
540
< div >
@@ -576,9 +562,14 @@ export function ImagePreviewer(props: {
576
562
key = { i }
577
563
>
578
564
< div className = { styles [ "avatar" ] } >
579
- < ExportAvatar
580
- avatar = { m . role === "user" ? config . avatar : mask . avatar }
581
- />
565
+ { m . role === "user" ? (
566
+ < Avatar avatar = { config . avatar } > </ Avatar >
567
+ ) : (
568
+ < MaskAvatar
569
+ avatar = { session . mask . avatar }
570
+ model = { m . model || session . mask . modelConfig . model }
571
+ />
572
+ ) }
582
573
</ div >
583
574
584
575
< div className = { styles [ "body" ] } >
0 commit comments