Skip to content

Commit 7c4db11

Browse files
committed
fix: display credits label only for ProxyAI provider
1 parent 9ac26d9 commit 7c4db11

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/main/kotlin/ee/carlrobert/codegpt/toolwindow/agent/ui/AgentCreditsToolbarLabel.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class AgentCreditsToolbarLabel(
2222
private val project: Project
2323
) : JBLabel(), Disposable {
2424

25+
companion object {
26+
private const val LABEL_PREFIX = "ProxyAI credits"
27+
}
28+
2529
private val numberFormat = NumberFormat.getNumberInstance(Locale.US).apply {
2630
isGroupingUsed = true
2731
}
@@ -73,6 +77,8 @@ class AgentCreditsToolbarLabel(
7377
val provider = ModelSettings.getInstance()
7478
.getServiceForFeature(FeatureType.AGENT)
7579
if (provider != ServiceType.PROXYAI) {
80+
text = null
81+
toolTipText = null
7682
isVisible = false
7783
return@invokeLater
7884
}
@@ -91,14 +97,14 @@ class AgentCreditsToolbarLabel(
9197
val remaining = credits?.remaining ?: userRemaining
9298

9399
text = if (remaining != null) {
94-
"Credits: ${numberFormat.format(remaining)} left"
100+
"$LABEL_PREFIX: ${numberFormat.format(remaining)} left"
95101
} else {
96-
"Credits: --"
102+
"$LABEL_PREFIX: --"
97103
}
98104

99105
toolTipText = buildString {
100106
append("<html><body>")
101-
append("<b>Credits</b><br>")
107+
append("<b>$LABEL_PREFIX</b><br>")
102108
if (remaining != null) {
103109
append("Remaining: ${numberFormat.format(remaining)}<br>")
104110
}

0 commit comments

Comments
 (0)