fix: update notification for response time issues not to show some su… (#588)
* fix: update notification for response time issues not to show some suggestions when using local port. * fix: update notification messages for completion response time issues. * fix: lint.r0.4
parent
aacfd35464
commit
0dc7e98232
|
|
@ -8,6 +8,7 @@ import com.intellij.openapi.application.invokeLater
|
||||||
import com.intellij.openapi.components.service
|
import com.intellij.openapi.components.service
|
||||||
import com.intellij.openapi.diagnostic.Logger
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
import com.intellij.openapi.ui.Messages
|
import com.intellij.openapi.ui.Messages
|
||||||
|
import com.tabbyml.intellijtabby.agent.Agent
|
||||||
import com.tabbyml.intellijtabby.agent.AgentService
|
import com.tabbyml.intellijtabby.agent.AgentService
|
||||||
import com.tabbyml.intellijtabby.settings.ApplicationSettingsState
|
import com.tabbyml.intellijtabby.settings.ApplicationSettingsState
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
@ -23,20 +24,16 @@ class CheckIssueDetail : AnAction() {
|
||||||
agentService.scope.launch {
|
agentService.scope.launch {
|
||||||
val detail = agentService.getCurrentIssueDetail() ?: return@launch
|
val detail = agentService.getCurrentIssueDetail() ?: return@launch
|
||||||
val serverHealthState = agentService.getServerHealthState()
|
val serverHealthState = agentService.getServerHealthState()
|
||||||
val settingsState = service<ApplicationSettingsState>().state.value
|
val agentConfig = agentService.getConfig()
|
||||||
logger.info("Show issue detail: $detail, $serverHealthState, $settingsState")
|
logger.info("Show issue detail: $detail, $serverHealthState, $agentConfig")
|
||||||
val title = when (detail["name"]) {
|
val title = when (detail["name"]) {
|
||||||
"slowCompletionResponseTime" -> "Completion Requests Appear to Take Too Much Time"
|
"slowCompletionResponseTime" -> "Completion Requests Appear to Take Too Much Time"
|
||||||
"highCompletionTimeoutRate" -> "Most Completion Requests Timed Out"
|
"highCompletionTimeoutRate" -> "Most Completion Requests Timed Out"
|
||||||
else -> return@launch
|
else -> return@launch
|
||||||
}
|
}
|
||||||
val message = buildDetailMessage(detail, serverHealthState, settingsState)
|
val message = buildDetailMessage(detail, serverHealthState, agentConfig)
|
||||||
invokeLater {
|
invokeLater {
|
||||||
val result =
|
Messages.showMessageDialog(message, title, Messages.getInformationIcon())
|
||||||
Messages.showOkCancelDialog(message, title, "Supported Models", "Dismiss", Messages.getInformationIcon())
|
|
||||||
if (result == Messages.OK) {
|
|
||||||
BrowserUtil.browse("https://tabby.tabbyml.com/docs/models/")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +41,7 @@ class CheckIssueDetail : AnAction() {
|
||||||
private fun buildDetailMessage(
|
private fun buildDetailMessage(
|
||||||
detail: Map<String, Any>,
|
detail: Map<String, Any>,
|
||||||
serverHealthState: Map<String, Any>?,
|
serverHealthState: Map<String, Any>?,
|
||||||
settingsState: ApplicationSettingsState.State
|
agentConfig: Agent.Config
|
||||||
): String {
|
): String {
|
||||||
val stats = detail["completionResponseStats"] as Map<*, *>?
|
val stats = detail["completionResponseStats"] as Map<*, *>?
|
||||||
val statsMessages = when (detail["name"]) {
|
val statsMessages = when (detail["name"]) {
|
||||||
|
|
@ -72,19 +69,19 @@ class CheckIssueDetail : AnAction() {
|
||||||
val helpMessageForRunningLargeModelOnCPU = if (device == "cpu" && model.endsWith("B")) {
|
val helpMessageForRunningLargeModelOnCPU = if (device == "cpu" && model.endsWith("B")) {
|
||||||
"""
|
"""
|
||||||
Your Tabby server is running model <i>$model</i> on CPU.
|
Your Tabby server is running model <i>$model</i> on CPU.
|
||||||
This model is too large to run on CPU, please try a smaller model or switch to GPU.
|
This model may be performing poorly due to its large parameter size, please consider trying smaller models or switch to GPU.
|
||||||
You can find supported model list in online documents.
|
You can find a list of supported models in the <a href='https://tabby.tabbyml.com/docs/models/'>model directory</a>.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
var commonHelpMessage = ""
|
var commonHelpMessage = ""
|
||||||
val host = URL(settingsState.serverEndpoint).host
|
val host = URL(agentConfig.server?.endpoint).host
|
||||||
if (helpMessageForRunningLargeModelOnCPU.isEmpty()) {
|
if (helpMessageForRunningLargeModelOnCPU.isEmpty()) {
|
||||||
commonHelpMessage += "<li>The running model <i>$model</i> is too large to run on your Tabby server.<br/>"
|
commonHelpMessage += "<li>The running model <i>$model</i> may be performing poorly due to its large parameter size.<br/>"
|
||||||
commonHelpMessage += "Please try a smaller model. You can find supported model list in online documents.</li>"
|
commonHelpMessage += "Please consider trying smaller models. You can find a list of supported models in the <a href='https://tabby.tabbyml.com/docs/models/'>model directory</a>.</li>"
|
||||||
}
|
}
|
||||||
if (!(host == "localhost" || host == "127.0.0.1")) {
|
if (!(host.startsWith("localhost") || host.startsWith("127.0.0.1"))) {
|
||||||
commonHelpMessage += "<li>A poor network connection. Please check your network and proxy settings.</li>"
|
commonHelpMessage += "<li>A poor network connection. Please check your network and proxy settings.</li>"
|
||||||
commonHelpMessage += "<li>Server overload. Please contact your Tabby server administrator for assistance.</li>"
|
commonHelpMessage += "<li>Server overload. Please contact your Tabby server administrator for assistance.</li>"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,11 @@ class AgentService : Disposable {
|
||||||
agent.clearConfig(key)
|
agent.clearConfig(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getConfig(): Agent.Config {
|
||||||
|
waitForInitialized()
|
||||||
|
return agent.getConfig()
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun provideCompletion(editor: Editor, offset: Int, manually: Boolean = false): Agent.CompletionResponse? {
|
suspend fun provideCompletion(editor: Editor, offset: Int, manually: Boolean = false): Agent.CompletionResponse? {
|
||||||
waitForInitialized()
|
waitForInitialized()
|
||||||
return ReadAction.compute<PsiFile, Throwable> {
|
return ReadAction.compute<PsiFile, Throwable> {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"repository": "https://github.com/TabbyML/tabby",
|
"repository": "https://github.com/TabbyML/tabby",
|
||||||
"bugs": "https://github.com/TabbyML/tabby/issues",
|
"bugs": "https://github.com/TabbyML/tabby/issues",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"version": "0.6.1",
|
"version": "1.0.0-dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ai",
|
"ai",
|
||||||
"autocomplete",
|
"autocomplete",
|
||||||
|
|
|
||||||
|
|
@ -138,21 +138,33 @@ function getHelpMessageForCompletionResponseTimeIssue() {
|
||||||
if (serverHealthState?.device === "cpu" && serverHealthState?.model?.match(/[0-9\.]+B$/)) {
|
if (serverHealthState?.device === "cpu" && serverHealthState?.model?.match(/[0-9\.]+B$/)) {
|
||||||
helpMessageForRunningLargeModelOnCPU +=
|
helpMessageForRunningLargeModelOnCPU +=
|
||||||
`Your Tabby server is running model ${serverHealthState?.model} on CPU. ` +
|
`Your Tabby server is running model ${serverHealthState?.model} on CPU. ` +
|
||||||
"This model is too large to run on CPU, please try a smaller model or switch to GPU. " +
|
"This model may be performing poorly due to its large parameter size, please consider trying smaller models or switch to GPU. " +
|
||||||
"You can find supported model list in online documents. \n";
|
"You can find a list of supported models in the model directory.\n";
|
||||||
|
}
|
||||||
|
let commonHelpMessage = "";
|
||||||
|
const host = new URL(agent().getConfig().server.endpoint).host;
|
||||||
|
if (helpMessageForRunningLargeModelOnCPU.length == 0) {
|
||||||
|
commonHelpMessage += ` - The running model ${
|
||||||
|
serverHealthState?.model ?? ""
|
||||||
|
} may be performing poorly due to its large parameter size. `;
|
||||||
|
commonHelpMessage +=
|
||||||
|
"Please consider trying smaller models. You can find a list of supported models in the model directory.\n";
|
||||||
|
}
|
||||||
|
if (!(host.startsWith("localhost") || host.startsWith("127.0.0.1"))) {
|
||||||
|
commonHelpMessage += " - A poor network connection. Please check your network and proxy settings.\n";
|
||||||
|
commonHelpMessage += " - Server overload. Please contact your Tabby server administrator for assistance.\n";
|
||||||
}
|
}
|
||||||
let message = "";
|
let message = "";
|
||||||
if (helpMessageForRunningLargeModelOnCPU.length > 0) {
|
if (helpMessageForRunningLargeModelOnCPU.length > 0) {
|
||||||
message += helpMessageForRunningLargeModelOnCPU + "\n";
|
message += helpMessageForRunningLargeModelOnCPU + "\n";
|
||||||
message += "Other possible causes of this issue are: \n";
|
if (commonHelpMessage.length > 0) {
|
||||||
} else {
|
message += "Other possible causes of this issue: \n";
|
||||||
message += "Possible causes of this issue are: \n";
|
message += commonHelpMessage;
|
||||||
}
|
}
|
||||||
message += " - A poor network connection. Please check your network and proxy settings.\n";
|
} else {
|
||||||
message += " - Server overload. Please contact your Tabby server administrator for assistance.\n";
|
// commonHelpMessage should not be empty here
|
||||||
if (helpMessageForRunningLargeModelOnCPU.length == 0) {
|
message += "Possible causes of this issue: \n";
|
||||||
message += ` - The running model ${serverHealthState?.model ?? ""} is too large to run on your Tabby server. `;
|
message += commonHelpMessage;
|
||||||
message += "Please try a smaller model. You can find supported model list in online documents.\n";
|
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
@ -173,11 +185,11 @@ function showInformationWhenSlowCompletionResponseTime(modal: boolean = false) {
|
||||||
modal: true,
|
modal: true,
|
||||||
detail: statsMessage + getHelpMessageForCompletionResponseTimeIssue(),
|
detail: statsMessage + getHelpMessageForCompletionResponseTimeIssue(),
|
||||||
},
|
},
|
||||||
"Supported Models",
|
"Model Directory",
|
||||||
)
|
)
|
||||||
.then((selection) => {
|
.then((selection) => {
|
||||||
switch (selection) {
|
switch (selection) {
|
||||||
case "Supported Models":
|
case "Model Directory":
|
||||||
env.openExternal(Uri.parse("https://tabby.tabbyml.com/docs/models/"));
|
env.openExternal(Uri.parse("https://tabby.tabbyml.com/docs/models/"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -212,11 +224,11 @@ function showInformationWhenHighCompletionTimeoutRate(modal: boolean = false) {
|
||||||
modal: true,
|
modal: true,
|
||||||
detail: statsMessage + getHelpMessageForCompletionResponseTimeIssue(),
|
detail: statsMessage + getHelpMessageForCompletionResponseTimeIssue(),
|
||||||
},
|
},
|
||||||
"Supported Models",
|
"Model Directory",
|
||||||
)
|
)
|
||||||
.then((selection) => {
|
.then((selection) => {
|
||||||
switch (selection) {
|
switch (selection) {
|
||||||
case "Supported Models":
|
case "Model Directory":
|
||||||
env.openExternal(Uri.parse("https://tabby.tabbyml.com/docs/models/"));
|
env.openExternal(Uri.parse("https://tabby.tabbyml.com/docs/models/"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue