/** * Copyright 2025 Beijing Volcano Engine Technology Co., Ltd. All Rights Reserved. * SPDX-license-identifier: BSD-3-Clause */ import { useSelector } from 'react-redux'; import { RootState } from '@/store'; import UserTag from '../UserTag'; import { useDeviceState, useScene } from '@/lib/useCommon'; import style from './index.module.less'; interface IAiAvatarCardProps { showStatus: boolean; showUserTag: boolean; className?: string; } const THRESHOLD_VOLUME = 18; function AiAvatarCard(props: IAiAvatarCardProps) { const { showStatus, showUserTag, className } = props; const room = useSelector((state: RootState) => state.room); const { icon } = useScene(); const { scene, isAITalking, isFullScreen } = room; const volume = room.localUser.audioPropertiesInfo?.linearVolume || 0; const { isAudioPublished } = useDeviceState(); const isLoading = volume >= THRESHOLD_VOLUME && isAudioPublished; return (
Avatar {showStatus ? ( isAITalking ? (
) : isLoading ? (
正在听...
) : null ) : null}
{showUserTag ? : null}
); } export default AiAvatarCard;