1 file changed
+15
-3
@@ -71,19 +71,31 @@ internal fun StreamingFullBleedWithTypingEffect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Derive display text from the latest full content at each recomposition
|
// Derive display text from the latest full content at each recomposition
|
||||||
val words = streaming.content.split(" ")
|
val words = remember(streaming.content) { streaming.content.split(" ") }
|
||||||
val visibleCount =
|
val visibleCount =
|
||||||
if (visibleWordCount >= Int.MAX_VALUE / 2) {
|
if (visibleWordCount >= Int.MAX_VALUE / 2) {
|
||||||
words.size
|
words.size
|
||||||
} else {
|
} else {
|
||||||
visibleWordCount.coerceIn(0, words.size)
|
visibleWordCount.coerceIn(0, words.size)
|
||||||
}
|
}
|
||||||
|
val isStreaming = currentIsStreaming.value
|
||||||
val displayText =
|
val displayText =
|
||||||
|
remember(words, visibleCount, caretVisible, isStreaming) {
|
||||||
words.take(visibleCount.coerceAtLeast(1)).joinToString(" ") +
|
words.take(visibleCount.coerceAtLeast(1)).joinToString(" ") +
|
||||||
if (caretVisible && currentIsStreaming.value) "▍" else ""
|
if (caretVisible && isStreaming) "▍" else ""
|
||||||
|
}
|
||||||
|
|
||||||
|
val displayMessage =
|
||||||
|
remember(streaming, displayText) {
|
||||||
|
if (streaming.content == displayText) {
|
||||||
|
streaming
|
||||||
|
} else {
|
||||||
|
streaming.copy(content = displayText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FullBleedAgentMessage(
|
FullBleedAgentMessage(
|
||||||
message = streaming.copy(content = displayText),
|
message = displayMessage,
|
||||||
showReasoning = showReasoning,
|
showReasoning = showReasoning,
|
||||||
searchQuery = "",
|
searchQuery = "",
|
||||||
isCurrentMatch = false,
|
isCurrentMatch = false,
|
||||||
|
|||||||
Reference in new issue
Block a user