mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-20 01:02:02 +00:00
fix: google model selection (fixes #1111)
This commit is contained in:
parent
9b7c7a448a
commit
38b9705e74
1 changed files with 33 additions and 8 deletions
|
|
@ -30,6 +30,7 @@ import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
|||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
import ee.carlrobert.codegpt.Icons;
|
||||
import ee.carlrobert.codegpt.completions.llama.LlamaModel;
|
||||
import ee.carlrobert.codegpt.settings.models.ModelDetailsState;
|
||||
import ee.carlrobert.codegpt.settings.models.ModelRegistry;
|
||||
import ee.carlrobert.codegpt.settings.models.ModelSelection;
|
||||
import ee.carlrobert.codegpt.settings.models.ModelSettings;
|
||||
|
|
@ -51,7 +52,6 @@ import ee.carlrobert.llm.client.openai.completion.OpenAIChatCompletionModel;
|
|||
import java.awt.Color;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
|
|
@ -72,7 +72,8 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
Project project,
|
||||
Consumer<ServiceType> onModelChange,
|
||||
ServiceType selectedService) {
|
||||
this(project, onModelChange, selectedService, Arrays.asList(ServiceType.values()), true, FeatureType.CHAT);
|
||||
this(project, onModelChange, selectedService, Arrays.asList(ServiceType.values()), true,
|
||||
FeatureType.CHAT);
|
||||
}
|
||||
|
||||
public ModelComboBoxAction(
|
||||
|
|
@ -81,7 +82,8 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
ServiceType selectedProvider,
|
||||
List<ServiceType> availableProviders,
|
||||
boolean showConfigureModels) {
|
||||
this(project, onModelChange, selectedProvider, availableProviders, showConfigureModels, FeatureType.CHAT);
|
||||
this(project, onModelChange, selectedProvider, availableProviders, showConfigureModels,
|
||||
FeatureType.CHAT);
|
||||
}
|
||||
|
||||
public ModelComboBoxAction(
|
||||
|
|
@ -349,10 +351,19 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
}
|
||||
|
||||
private String getGooglePresentationText() {
|
||||
var model = ApplicationManager.getApplication().getService(GoogleSettings.class)
|
||||
var chatModel = ApplicationManager.getApplication()
|
||||
.getService(ModelSettings.class)
|
||||
.getState()
|
||||
.getModel();
|
||||
return ModelRegistry.getInstance().getModelDisplayName(GOOGLE, model);
|
||||
.getModelSelection(featureType);
|
||||
return ModelRegistry.getInstance().getModelDisplayName(GOOGLE, getGoogleModelCode(chatModel));
|
||||
}
|
||||
|
||||
private String getGoogleModelCode(@Nullable ModelDetailsState chatModel) {
|
||||
if (chatModel == null || chatModel.getModel() == null || chatModel.getModel().isBlank()) {
|
||||
return ModelRegistry.GEMINI_PRO_2_5;
|
||||
}
|
||||
|
||||
return chatModel.getModel();
|
||||
}
|
||||
|
||||
private String getLlamaCppPresentationText() {
|
||||
|
|
@ -473,8 +484,22 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
modelName,
|
||||
Icons.Google,
|
||||
comboBoxPresentation,
|
||||
() -> ApplicationManager.getApplication().getService(ModelSettings.class)
|
||||
.setModel(featureType, model.getCode(), GOOGLE));
|
||||
() -> {
|
||||
// Persist selection in the unified ModelSettings used across features
|
||||
ApplicationManager.getApplication()
|
||||
.getService(ModelSettings.class)
|
||||
.setModel(featureType, model.getCode(), GOOGLE);
|
||||
|
||||
// Also mirror the selection into GoogleSettings for any legacy UI reads
|
||||
try {
|
||||
ApplicationManager.getApplication()
|
||||
.getService(GoogleSettings.class)
|
||||
.getState()
|
||||
.setModel(model.getCode());
|
||||
} catch (Exception ignored) {
|
||||
// Best-effort sync; lack of GoogleSettings should not block selection
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private AnAction createAnthropicModelAction(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue