@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
29import androidx.compose.runtime.getValue
29import androidx.compose.runtime.getValue
30import androidx.compose.runtime.mutableStateOf
30import androidx.compose.runtime.mutableStateOf
31import androidx.compose.runtime.remember
31import androidx.compose.runtime.remember
32+import androidx.compose.runtime.saveable.rememberSaveable
32import androidx.compose.runtime.setValue
33import androidx.compose.runtime.setValue
33import androidx.compose.ui.Alignment
34import androidx.compose.ui.Alignment
34import androidx.compose.ui.Modifier
35import androidx.compose.ui.Modifier
@@ -94,7 +95,7 @@ fun PartView(part: Part, modifier: Modifier = Modifier, isRunning: Boolean = fal
94private fun ReasoningBlock(text: String, streaming: Boolean, modifier: Modifier) {
95private fun ReasoningBlock(text: String, streaming: Boolean, modifier: Modifier) {
95 if (text.isBlank()) return
96 if (text.isBlank()) return
96 val context = LocalContext.current
97 val context = LocalContext.current
97− var expanded by remember { mutableStateOf(false) }
98+ var expanded by rememberSaveable { mutableStateOf(false) }
98 val expandedState = stringResource(R.string.state_expanded)
99 val expandedState = stringResource(R.string.state_expanded)
99 val collapsedState = stringResource(R.string.state_collapsed)
100 val collapsedState = stringResource(R.string.state_collapsed)
100 Column(modifier = modifier.fillMaxWidth()) {
101 Column(modifier = modifier.fillMaxWidth()) {
@@ -177,7 +178,7 @@ private fun ToolCallView(part: ToolPart, modifier: Modifier) {
178 if (detail != null) {
179 if (detail != null) {
179 val collapsed = remember(detail) { detail.take(COLLAPSED_LIMIT) }
180 val collapsed = remember(detail) { detail.take(COLLAPSED_LIMIT) }
180− var expanded by remember(detail) { mutableStateOf(false) }
181+ var expanded by rememberSaveable(detail) { mutableStateOf(false) }
181 val expandedState = stringResource(R.string.state_expanded)
182 val expandedState = stringResource(R.string.state_expanded)
182 val collapsedState = stringResource(R.string.state_collapsed)
183 val collapsedState = stringResource(R.string.state_collapsed)
183 val display = if (expanded || detail.length <= COLLAPSED_LIMIT) detail else collapsed
184 val display = if (expanded || detail.length <= COLLAPSED_LIMIT) detail else collapsed