Skip to content

Commit 71b2f5a

Browse files
refactoring
1 parent e0b8bd9 commit 71b2f5a

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

Tutorial4-1ChatBot/src/main/java/com/smarttoolfactory/tutorial4_1chatbot/markdown/MarkdownComposer.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.smarttoolfactory.tutorial4_1chatbot.markdown
22

33
import androidx.compose.foundation.border
4-
import androidx.compose.foundation.layout.Box
54
import androidx.compose.runtime.Composable
65
import androidx.compose.runtime.getValue
76
import androidx.compose.runtime.mutableStateMapOf
@@ -70,7 +69,7 @@ internal fun MarkdownComposer(
7069
object : AstBlockNodeComposer {
7170

7271
override fun predicate(astBlockNodeType: AstBlockNodeType): Boolean {
73-
val isTable = astBlockNodeType == AstTableRoot
72+
val isTable = astBlockNodeType is AstTableRoot
7473
val isText = astBlockNodeType == AstParagraph
7574
return isTable || isText
7675
}
@@ -108,10 +107,14 @@ internal fun MarkdownComposer(
108107
CustomTable(tableRoot = astNode)
109108
} else if (astNode.type is AstParagraph) {
110109
MarkdownFadeInRichText(
111-
modifier = Modifier.border(
112-
2.dp,
113-
if (shouldAnimate) Color.Cyan else Color.Magenta
114-
),
110+
modifier = if (debug.not()) {
111+
Modifier
112+
} else {
113+
Modifier.border(
114+
2.dp,
115+
if (shouldAnimate) Color.Cyan else Color.Magenta
116+
)
117+
},
115118
astNode = astNode,
116119
segmentation = segmentation,
117120
debug = debug,
@@ -128,13 +131,10 @@ internal fun MarkdownComposer(
128131
)
129132
}
130133
} else {
131-
// ✅ untouched non-animated path
132134
if (astNode.type is AstTableRoot) {
133135
CustomTable(tableRoot = astNode)
134136
} else if (astNode.type is AstParagraph) {
135-
Box(Modifier.border(2.dp, Color(0xff546E7A))) {
136-
BasicMarkdown(astNode)
137-
}
137+
BasicMarkdown(astNode)
138138
}
139139
}
140140
}

Tutorial4-1ChatBot/src/main/java/com/smarttoolfactory/tutorial4_1chatbot/ui/component/message/MesageFeedbackRow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fun MessageFeedbackRow(
2323
message: Message
2424
) {
2525
Row(
26-
modifier = modifier.padding(top = 12.dp),
26+
modifier = modifier.padding(vertical = 16.dp),
2727
horizontalArrangement = Arrangement.spacedBy(8.dp)
2828
) {
2929
IconButton(

Tutorial4-1ChatBot/src/main/java/com/smarttoolfactory/tutorial4_1chatbot/ui/component/message/MessageRow.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ fun MessageRow(
7373
) {
7474
MarkdownComposer(
7575
markdown = message.text,
76-
debug = true,
76+
debug = false,
7777
messageKey = message.uiKey,
78-
// ✅ Typical: animate only while streaming.
7978
// Completed paragraphs will auto-disable via completedByNodeKey.
8079
animate = (message.messageStatus == MessageStatus.Streaming),
8180
)

0 commit comments

Comments
 (0)