Skip to content

Commit e3f8932

Browse files
committed
fix(LLMModelManager): standardize GitHub branding and simplify model handling
- Fix inconsistent "Github" vs "GitHub" branding throughout codebase - Remove redundant getModelIdFromProvider method - Simplify model selection logic by using modelId directly - Update getProviderNameFromModelId to return modelId for GitHub models
1 parent efe7709 commit e3f8932

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInputSection.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ class AutoDevInputSection(
131131
modelSelector = JComboBox(modelItems.toTypedArray())
132132

133133
val currentModel = AutoDevSettingsState.getInstance().defaultModelId.ifEmpty { "Default" }
134-
val currentModelId = LLMModelManager.getInstance().getModelIdFromProvider(currentModel)
135134
for (i in 0 until modelSelector.itemCount) {
136135
val item = modelSelector.getItemAt(i)
137-
if (item.modelId == currentModelId) {
136+
if (item.modelId == currentModel) {
138137
modelSelector.selectedIndex = i
139138
break
140139
}

core/src/main/kotlin/cc/unitmesh/devti/settings/model/LLMModelManager.kt

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class LLMModelManager(
3636
* Check if a model is custom (not GitHub Copilot)
3737
*/
3838
fun isCustomLLM(modelName: String): Boolean {
39-
// GitHub models start with "Github: "
40-
if (modelName.startsWith("Github: ")) {
39+
if (modelName.startsWith("GitHub: ")) {
4140
return false
4241
}
42+
4343
val userModels = LlmConfig.load()
4444
return userModels.any { it.name == modelName }
4545
}
@@ -55,7 +55,7 @@ class LLMModelManager(
5555
val githubModels = manager.getSupportedModels(forceRefresh = false)
5656
githubModels?.forEach { model ->
5757
models.add(ModelItem(
58-
displayName = "Github: ${model.id}",
58+
displayName = "GitHub: ${model.id}",
5959
modelId = model.id,
6060
isCustom = false
6161
))
@@ -74,24 +74,6 @@ class LLMModelManager(
7474
return models
7575
}
7676

77-
/**
78-
* Get model ID from provider name
79-
* Used by AutoDevInputSection to find current selected model
80-
*/
81-
fun getModelIdFromProvider(providerName: String): String {
82-
if (providerName.isEmpty() || providerName == "Default") {
83-
return "Default"
84-
}
85-
86-
// For GitHub models, extract model ID from "Github: model-id" format
87-
if (providerName.startsWith("Github: ")) {
88-
return providerName.removePrefix("Github: ")
89-
}
90-
91-
// For custom models, the provider name is the model name
92-
return providerName
93-
}
94-
9577
/**
9678
* Get provider name from model ID
9779
* Used by AutoDevInputSection when model selection changes
@@ -107,7 +89,7 @@ class LLMModelManager(
10789
val githubModels = manager.getSupportedModels(forceRefresh = false)
10890
val isGithubModel = githubModels?.any { it.id == modelId } == true
10991
if (isGithubModel) {
110-
return "Github: $modelId"
92+
return modelId
11193
}
11294
}
11395

0 commit comments

Comments
 (0)