Skip to content

Commit

Permalink
feat: add gpt-4o model (closes carlrobertoh#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlrobertoh committed May 13, 2024
1 parent ab7d066 commit de3db77
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Three new providers - **Ollama**, **Google** and **CodeGPT** 🚀🚀🚀
- OpenAI GPT-4o model (#547)
- New provider configuration user interface (#538)
- Support Phi-3 Mini, CodeGemma and CodeQwen1.5 models (#516, #524, #525, #527)
- Llama 3 download sizes (#498)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jsoup = "1.17.2"
jtokkit = "1.0.0"
junit = "5.10.2"
kotlin = "1.9.24"
llm-client = "0.8.4"
llm-client = "0.8.5"
okio = "3.9.0"
tree-sitter = "0.22.5"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private AnAction[] getCodeGPTModelActions(Presentation presentation) {
actionGroup.addAll(getCodeGPTModelActions(presentation));
actionGroup.addSeparator("OpenAI");
List.of(
OpenAIChatCompletionModel.GPT_4_O,
OpenAIChatCompletionModel.GPT_4_VISION_PREVIEW,
OpenAIChatCompletionModel.GPT_4_0125_128k,
OpenAIChatCompletionModel.GPT_3_5_0125_16k)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static ee.carlrobert.codegpt.settings.service.ServiceType.ANTHROPIC;
import static ee.carlrobert.codegpt.settings.service.ServiceType.OLLAMA;
import static ee.carlrobert.codegpt.settings.service.ServiceType.OPENAI;
import static ee.carlrobert.llm.client.openai.completion.OpenAIChatCompletionModel.GPT_4_O;
import static ee.carlrobert.llm.client.openai.completion.OpenAIChatCompletionModel.GPT_4_VISION_PREVIEW;

import com.intellij.icons.AllIcons;
Expand Down Expand Up @@ -191,17 +192,24 @@ public void actionPerformed(@NotNull AnActionEvent e) {
handleSubmit();
}
}));
var selectedService = GeneralSettings.getSelectedService();
if (selectedService == ANTHROPIC
|| selectedService == OLLAMA
|| (selectedService == OPENAI
&& GPT_4_VISION_PREVIEW.getCode().equals(OpenAISettings.getCurrentState().getModel()))) {
if (isImageActionSupported()) {
iconsPanel.add(new IconActionButton(new AttachImageAction()));
}
iconsPanel.add(stopButton);
add(iconsPanel, BorderLayout.EAST);
}

private boolean isImageActionSupported() {
var selectedService = GeneralSettings.getSelectedService();
if (selectedService == ANTHROPIC || selectedService == OLLAMA) {
return true;
}

var model = OpenAISettings.getCurrentState().getModel();
return selectedService == OPENAI && (
GPT_4_VISION_PREVIEW.getCode().equals(model) || GPT_4_O.getCode().equals(model));
}

private void updateFont() {
if (Registry.is("ide.find.use.editor.font", false)) {
textArea.setFont(EditorUtil.getEditorFont());
Expand Down

0 comments on commit de3db77

Please sign in to comment.