mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
fix(android): show unavailable model rows as attention
This commit is contained in:
@@ -324,7 +324,7 @@ internal fun readyModelProviderCount(
|
||||
|
||||
// Older gateways did not emit `available`; keep those rows on the legacy
|
||||
// readiness path while still honoring explicit false from upgraded gateways.
|
||||
private fun modelAvailabilityUsable(model: GatewayModelSummary): Boolean = model.available != false
|
||||
internal fun modelAvailabilityUsable(model: GatewayModelSummary): Boolean = model.available != false
|
||||
|
||||
internal fun expiringModelProviderCount(providers: List<GatewayModelProviderSummary>): Int =
|
||||
providers
|
||||
@@ -579,12 +579,13 @@ private fun ModelGroup(
|
||||
|
||||
@Composable
|
||||
private fun ModelRow(model: GatewayModelSummary) {
|
||||
val available = modelAvailabilityUsable(model)
|
||||
Row(modifier = Modifier.fillMaxWidth().heightIn(min = 48.dp).padding(horizontal = 10.dp, vertical = 5.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Text(text = model.name, style = ClawTheme.type.mono, color = ClawTheme.colors.text, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
modelCapabilityLabels(model).take(3).forEach { label ->
|
||||
ProviderMiniTag(text = label)
|
||||
}
|
||||
Box(modifier = Modifier.size(4.5.dp).clip(CircleShape).background(ClawTheme.colors.success))
|
||||
Box(modifier = Modifier.size(4.5.dp).clip(CircleShape).background(if (available) ClawTheme.colors.success else ClawTheme.colors.warning))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,13 @@ class ProviderModelStatusTest {
|
||||
assertEquals(0, readyModelProviderCount(providers, models))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun modelAvailabilityHonorsExplicitUnavailableRows() {
|
||||
assertTrue(modelAvailabilityUsable(model(provider = "openai", available = true)))
|
||||
assertTrue(modelAvailabilityUsable(model(provider = "openai", available = null)))
|
||||
assertFalse(modelAvailabilityUsable(model(provider = "openai", available = false)))
|
||||
}
|
||||
|
||||
private fun model(
|
||||
provider: String,
|
||||
available: Boolean?,
|
||||
|
||||
Reference in New Issue
Block a user