mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-17 03:57:27 +00:00
fix: display credits label only for ProxyAI provider
This commit is contained in:
parent
9ac26d9bb2
commit
7643e91c17
3 changed files with 23 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ import com.intellij.ui.components.JBLabel
|
|||
import com.intellij.util.messages.MessageBusConnection
|
||||
import com.intellij.util.ui.JBFont
|
||||
import com.intellij.util.ui.JBUI
|
||||
import ee.carlrobert.codegpt.CodeGPTBundle
|
||||
import ee.carlrobert.codegpt.CodeGPTKeys
|
||||
import ee.carlrobert.codegpt.settings.models.ModelSettings
|
||||
import ee.carlrobert.codegpt.settings.service.*
|
||||
|
|
@ -73,6 +74,8 @@ class AgentCreditsToolbarLabel(
|
|||
val provider = ModelSettings.getInstance()
|
||||
.getServiceForFeature(FeatureType.AGENT)
|
||||
if (provider != ServiceType.PROXYAI) {
|
||||
text = null
|
||||
toolTipText = null
|
||||
isVisible = false
|
||||
return@invokeLater
|
||||
}
|
||||
|
|
@ -89,21 +92,25 @@ class AgentCreditsToolbarLabel(
|
|||
(userTotal - userDetails.creditsUsed).coerceAtLeast(0)
|
||||
} else null
|
||||
val remaining = credits?.remaining ?: userRemaining
|
||||
val labelPrefix = CodeGPTBundle.get("agent.credits.label")
|
||||
val remainingText = remaining?.let {
|
||||
CodeGPTBundle.get("agent.credits.remainingValue", numberFormat.format(it))
|
||||
} ?: "--"
|
||||
|
||||
text = if (remaining != null) {
|
||||
"Credits: ${numberFormat.format(remaining)} left"
|
||||
} else {
|
||||
"Credits: --"
|
||||
}
|
||||
text = "$labelPrefix: $remainingText"
|
||||
|
||||
toolTipText = buildString {
|
||||
append("<html><body>")
|
||||
append("<b>Credits</b><br>")
|
||||
append("<b>$labelPrefix</b><br>")
|
||||
if (remaining != null) {
|
||||
append("Remaining: ${numberFormat.format(remaining)}<br>")
|
||||
append(
|
||||
CodeGPTBundle.get("agent.credits.tooltip.remaining", numberFormat.format(remaining))
|
||||
)
|
||||
append("<br>")
|
||||
}
|
||||
if (userTotal != null) {
|
||||
append("Total: ${numberFormat.format(userTotal)}<br>")
|
||||
append(CodeGPTBundle.get("agent.credits.tooltip.total", numberFormat.format(userTotal)))
|
||||
append("<br>")
|
||||
}
|
||||
append("</body></html>")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -476,3 +476,7 @@ userInput.addContextTooltip=Add Context
|
|||
# Thought process panel
|
||||
thoughtProcess.thinking=Thinking...
|
||||
thoughtProcess.title=Thought Process
|
||||
agent.credits.label=ProxyAI credits
|
||||
agent.credits.remainingValue={0} left
|
||||
agent.credits.tooltip.remaining=Remaining: {0}
|
||||
agent.credits.tooltip.total=Total: {0}
|
||||
|
|
|
|||
|
|
@ -427,3 +427,7 @@ conversation.status.sortedBy=\u6392\u5E8F\u65B9\u5F0F: {0}
|
|||
conversation.deleteConfirmation.message=\u60A8\u786E\u5B9A\u8981\u5220\u9664\u6B64\u5BF9\u8BDD\u5417?
|
||||
conversation.deleteConfirmation.title=\u5220\u9664\u5BF9\u8BDD
|
||||
chat.message.welcome=\u55E8 <strong>{0}</strong>, \u6211\u662F ProxyAI\uFF01\u4F60\u53EF\u4EE5\u95EE\u6211\u4EFB\u4F55\u95EE\u9898\uFF0C\u4F46\u5927\u591A\u6570\u4EBA\u4F1A\u8BF7\u6C42\u6211\u63D0\u4F9B\u4EE3\u7801\u65B9\u9762\u7684\u5E2E\u52A9\u3002\u4EE5\u4E0B\u662F\u4E00\u4E9B\u4F60\u53EF\u4EE5\u5411\u6211\u54A8\u8BE2\u7684\u95EE\u9898\uFF1A
|
||||
agent.credits.label=ProxyAI \u79EF\u5206
|
||||
agent.credits.remainingValue=\u5269\u4F59 {0}
|
||||
agent.credits.tooltip.remaining=\u5269\u4F59: {0}
|
||||
agent.credits.tooltip.total=\u603B\u8BA1: {0}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue