Package-level declarations

Types

Link copied to clipboard
data class Message(val text: String, val authorIsUser: Boolean, var isPending: Boolean, var isLoaded: Boolean, val uuid: String)

Is used with GeminiChat and ChatMessage. Messages with isPending, should show a circular loading animation

Properties

Link copied to clipboard
private const val bulletChar: Char = '\u2022'
Link copied to clipboard
private val PaddingInsideCard: Dp

Functions

Link copied to clipboard
fun ChatInput(modifier: Modifier, pictureTaken: Picture?, disableSubmit: Boolean, onValidUserSubmit: (String) -> Unit, onShowBase64ImagePreview: (ImageRequest) -> Unit = {})
Link copied to clipboard
Link copied to clipboard
fun ChatMessage(msg: Message, modifier: Modifier = Modifier, isAnimationInProgress: (Boolean) -> Unit = {})

TODO, maybe this could be improved by having a GeminiMessage and a UserMessage composable and doing the same with the Message class

Link copied to clipboard
@Preview(uiMode = 32)
private fun ChatMessagePreview()
Link copied to clipboard
fun GeminiChat(modifier: Modifier, newMsg: Message, chatInputHeight: Dp, isPendingOrAnimationInProgress: (Boolean) -> Unit = {})

A Gemini chat box, where newMsgs are added to the list of messages. If a new message is not from the user and is not a loading message and not a pending, it will replace the previously loading message.

Link copied to clipboard
fun GeminiChatContainer(modifier: Modifier, pictureTaken: Picture?, newGeminiMessage: Message, onValidUserSubmit: (String) -> Unit)

Joins the GeminiChat and ChatInput for ease of use. isBlanks are ignored

Link copied to clipboard

Use a real device for this preview, so you can type. Or see GeminiChatPreview

Link copied to clipboard
@Preview(uiMode = 32)
private fun GeminiChatPreview()

Run in interactive mode. This has some logic to constrain new newMessages but it's all so simulate a real use. New messages are blocked by ChatInput by disabling the click of the trailing icon. Note: Compose preview with interaction mode doesn't allow typing in the ChatInput To do so, use GeminiChatContainerPreview

Link copied to clipboard

To generate messages with new UUIDs

Link copied to clipboard
Link copied to clipboard

Creates an AnnotatedString which is like a string with effects and decorations. This type is directly supported by Text. This only adds bold to characters surrounded by asterisk.

Link copied to clipboard

AnnotatedString could be used, but I want to keep it simple. And this will also have much greater performance since it's run once in Message In rare occasions Gemini seems like it can also through sub bullet points, that may be use tabs or something. So this solution isn't a catch all

Link copied to clipboard
private fun SmallImagePreview(image: ImageRequest?, onClick: () -> Unit)