メインコンテンツまでスキップ

Avatar

The MapGptAvatar is an animating avatar displayed on-screen. This guide covers how to use avatars and how to construct your own.

Using avatars

To update the avatar:

Dash.init(
dashConfig.toBuilder().mapGptConfig {
avatar = PrebuiltMapGptAvatars.smileyAvatar
}
)
Dash.applyUpdate {
mapGptConfig {
avatar = PrebuiltMapGptAvatars.mapboxyAvatar
}
}

Creating a custom avatar

With MapGPT, you can introduce your custom avatar for a personalized experience. The avatar leverages a sequence of animations developed with the Lottie library. These animations formats will be extended in the future, but our first version is using the Lottie JSON format.

Dash.applyUpdate {
mapGptConfig {
avatar = LottieMapGptAvatar(
name = "Custom Avatar",
listeningToUser = R.raw.ic_custom_listening_to_user,
userSpeaking = R.raw.ic_custom_user_speaking,
aiThinking = R.raw.ic_custom_thinking,
aiSpeaking = R.raw.ic_custom_speaking,
aiError = R.raw.ic_custom_error,
aiIdle = R.raw.ic_custom_idle,
aiSleeping = R.raw.ic_custom_sleeping,
noMicPermission = R.raw.ic_custom_no_mic_permission,
serviceDisconnected = R.raw.ic_custom_no_mic_permission,
)
}
}

Detaching Avatar from MapView

With MapGPT, you can detach the avatar from the map view to position it more widely on the screen and use it independently of the application.


private var detachableUI: MapGptDetachableUI? = null

override fun onCreate(savedInstanceState: Bundle?) {
detachableUI = Dash.controller.createMapGptUI {
lifecycleOwner = viewLifecycleOwner
avatarContainer = binding.frameMapGptAvatar // Container in your system app where you want to render the avatar
}

detachableUI?.attach()
}

override fun onDestroy() {
detachableUI?.detach()
}

Avatar state descriptions

  • Listening to User: The assistant is actively listening.
  • User Speaking: Indicates that the user is now speaking.
  • AI Thinking: Assistant is processing a response.
  • AI Speaking: Assistant is communicating a message.
  • AI Error: An error has been detected with the assistant.
  • AI Idle: Assistant is on standby for the next command.
  • AI Sleeping: Assistant hasn't been activated for an extended period.
  • No Mic Permission: The app lacks permission to access the microphone.
  • Service Disconnected: Assistant has lost connection and can't respond.
この{Type}は役に立ちましたか?