mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-21 02:11:29 +00:00
fix: temp workaround for invalid openai model state (fixes #842)
This commit is contained in:
parent
0c4340bbd6
commit
bdf5d2bc66
1 changed files with 14 additions and 4 deletions
|
|
@ -18,12 +18,12 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
|||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
import com.intellij.util.IconUtil;
|
||||
import ee.carlrobert.codegpt.CodeGPTKeys;
|
||||
import ee.carlrobert.codegpt.Icons;
|
||||
import ee.carlrobert.codegpt.completions.llama.LlamaModel;
|
||||
|
|
@ -51,6 +51,8 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class ModelComboBoxAction extends ComboBoxAction {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(ModelComboBoxAction.class);
|
||||
|
||||
private final Consumer<ServiceType> onModelChange;
|
||||
private final Project project;
|
||||
private final List<ServiceType> availableProviders;
|
||||
|
|
@ -210,9 +212,17 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
break;
|
||||
case OPENAI:
|
||||
templatePresentation.setIcon(Icons.OpenAI);
|
||||
templatePresentation.setText(
|
||||
OpenAIChatCompletionModel.findByCode(OpenAISettings.getCurrentState().getModel())
|
||||
.getDescription());
|
||||
|
||||
var selectedModel = OpenAISettings.getCurrentState().getModel();
|
||||
try {
|
||||
templatePresentation.setText(
|
||||
OpenAIChatCompletionModel.findByCode(selectedModel).getDescription());
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could find OpenAI model for code {}", e, selectedModel);
|
||||
// TODO: Find out why another provider's model was stored in the first place
|
||||
templatePresentation.setText(OpenAIChatCompletionModel.GPT_4_O.getDescription());
|
||||
}
|
||||
|
||||
break;
|
||||
case CUSTOM_OPENAI:
|
||||
templatePresentation.setIcon(Icons.OpenAI);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue