diff --git a/app/src/main/java/com/yugahashimoto/andcode/feature/chat/ChatHomeScreen.kt b/app/src/main/java/com/yugahashimoto/andcode/feature/chat/ChatHomeScreen.kt index e3b7a1749..1d30bfc12 100644 --- a/app/src/main/java/com/yugahashimoto/andcode/feature/chat/ChatHomeScreen.kt +++ b/app/src/main/java/com/yugahashimoto/andcode/feature/chat/ChatHomeScreen.kt @@ -672,6 +672,7 @@ fun ChatHomeScreen( .firstOrNull { it.id == selectedProviderId } ?.models?.get(selectedModelId) ?.limit?.context ?: 0L, + tokensPerSecond = state.connectionQuality?.tokensPerSecond ?: 0.0, showSlashCommands = showSlashCommands, slashCommands = state.slashCommands, slashSkills = state.slashSkills, @@ -1257,6 +1258,7 @@ private fun ChatComposer( enterToSend: Boolean, contextTokensUsed: Long, contextLimit: Long, + tokensPerSecond: Double, showSlashCommands: Boolean, slashCommands: List, slashSkills: List, @@ -1630,6 +1632,9 @@ private fun ChatComposer( contextLimit = contextLimit, ) } + if (isRunning && tokensPerSecond >= 0.05) { + CompactTokenSpeed(tokensPerSecond) + } } } } @@ -2167,6 +2172,20 @@ private fun formatTokenCount(tokens: Long): String = else -> tokens.toString() } +@Composable +private fun CompactTokenSpeed(tokensPerSecond: Double) { + Text( + text = stringResource(R.string.chat_token_speed, formatTokenRate(tokensPerSecond)), + style = MaterialTheme.typography.labelSmall, + fontSize = 9.sp, + color = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = Modifier.padding(horizontal = 2.dp), + ) +} + +private fun formatTokenRate(tokensPerSecond: Double): String = + if (tokensPerSecond >= 10.0) "%.0f".format(tokensPerSecond) else "%.1f".format(tokensPerSecond) + @Preview(showBackground = true) @Composable private fun ChatHomeScreenEmptyPreview() { diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index deea8261c..b4a06946e 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -486,6 +486,7 @@ تخطيط قبول تلقائي تلقائي + %1$s tok/s عمليات GitHub Git غير متصل الاتصال بـ GitHub diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 99b2905d8..c9002a930 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -480,6 +480,7 @@ Planificar Aceptación automática Auto + %1$s tok/s Operaciones Git de GitHub No conectado Conectar GitHub diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1315e153b..7794e2f48 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -480,6 +480,7 @@ Planifier Acceptation automatique Auto + %1$s tok/s Opérations Git GitHub Non connecté Connecter GitHub diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index aa88fd77c..fc319ecdb 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -478,6 +478,7 @@ 計画 自動承認 自動 + %1$s tok/s GitHub Git 操作 未接続 GitHubに接続 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d7f25c6ac..567c4d4e5 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -480,6 +480,7 @@ Planejar Aceitação automática Auto + %1$s tok/s Operações Git do GitHub Não conectado Conectar GitHub diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 8e8b30d89..c54572b78 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -482,6 +482,7 @@ План Автоприём Авто + %1$s tok/s Операции GitHub Git Не подключено Подключить GitHub diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 99c9533b2..47bc074cb 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -476,6 +476,7 @@ 计划 自动接受 自动 + %1$s tok/s GitHub Git 操作 未连接 连接 GitHub diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 55e36391c..3ca369747 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -466,6 +466,7 @@ Plan Auto accept Auto + %1$s tok/s GitHub Git operations Not connected Connect GitHub