Skip to content

Commit f8de422

Browse files
committed
Revert "cloud region customization"
This reverts commit 079637e.
1 parent 079637e commit f8de422

File tree

5 files changed

+3
-38
lines changed

5 files changed

+3
-38
lines changed

build.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ changelog {
5151
}
5252

5353
dependencies {
54-
implementation(files("/Users/melisandequentzel/Documents/Dillard/llm-client-fork/llm-client/build/libs/llm-client-0.8.16.jar"))
55-
56-
implementation("com.squareup.okhttp3:okhttp:4.12.0")
57-
implementation("com.squareup.okhttp3:okhttp-sse:4.9.3")
58-
59-
6054
implementation(project(":codegpt-telemetry"))
6155
implementation(project(":codegpt-treesitter"))
6256

src/main/java/ee/carlrobert/codegpt/completions/CompletionClientProvider.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,10 @@ public static CodeGPTClient getCodeGPTClient() {
3535
}
3636

3737
public static WatsonxClient getWatsonxClient() {
38-
String regionCode = switch(WatsonxSettings.getCurrentState().getRegion()) {
39-
case "Dallas" -> "us-south";
40-
case "Frankfurt" -> "eu-de";
41-
case "London" -> "eu-gb";
42-
case "Tokyo" -> "jp-tok";
43-
default -> "us-south";
44-
};
45-
String host = WatsonxSettings.getCurrentState().isOnPrem() ? WatsonxSettings.getCurrentState().getOnPremHost() : "https://" + regionCode + ".ml.cloud.ibm.com";
4638
return new WatsonxClient.Builder(getCredential(CredentialKey.WATSONX_API_KEY))
4739
.setApiVersion(WatsonxSettings.getCurrentState().getApiVersion())
4840
.setIsOnPrem(WatsonxSettings.getCurrentState().isOnPrem())
49-
.setHost(host)
41+
.setHost(WatsonxSettings.getCurrentState().getOnPremHost())
5042
.setUsername(WatsonxSettings.getCurrentState().getUsername())
5143
.setIsZenApiKey(WatsonxSettings.getCurrentState().isZenApiKey())
5244
.build(getDefaultClientBuilder());

src/main/java/ee/carlrobert/codegpt/settings/service/watsonx/WatsonxSettingsForm.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@
2626
import java.awt.*;
2727
import java.awt.event.ActionEvent;
2828
import java.awt.event.ActionListener;
29-
30-
import org.jetbrains.annotations.NotNull;
3129
import org.jetbrains.annotations.Nullable;
3230

3331
public class WatsonxSettingsForm {
3432

3533
private final JBCheckBox onPremCheckbox;
3634
private final JBPasswordField apiKeyField;
37-
private final ComboBox regionComboBox;
3835
private final JBPasswordField onPremApiKeyField;
3936
private final JBTextField onPremHostField;
4037
private final JBTextField usernameField;
@@ -46,7 +43,6 @@ public class WatsonxSettingsForm {
4643
private final String getStartedText = "Click here to get started with IBM watsonx.ai as a Service";
4744
private final String getStartedUrl = "https://dataplatform.cloud.ibm.com/registration/stepone?context=wx";
4845
private final JButton getStartedLink;
49-
5046
private final JBTextField apiVersionField;
5147
private final JBTextField projectIdField;
5248
private final JBTextField spaceIdField;
@@ -86,8 +82,6 @@ class OpenUrlAction implements ActionListener {
8682
getStartedLink.setToolTipText(getStartedUrl);
8783
getStartedLink.addActionListener(new OpenUrlAction());
8884

89-
regionComboBox = new ComboBox(new String[] {"Dallas", "Frankfurt", "London", "Tokyo"});
90-
regionComboBox.setSelectedItem(settings.getRegion());
9185
apiKeyField = new JBPasswordField();
9286
apiKeyField.setColumns(35);
9387
ApplicationManager.getApplication().executeOnPooledThread(() -> {
@@ -123,10 +117,6 @@ class OpenUrlAction implements ActionListener {
123117

124118
onCloudAuthenticationFieldPanel = new UI.PanelFactory().grid()
125119
.add(UI.PanelFactory.panel(getStartedLink))
126-
.add(UI.PanelFactory.panel(regionComboBox)
127-
.withLabel(CodeGPTBundle.get("settingsConfigurable.service.watsonx.cloudRegion.label"))
128-
.withComment(CodeGPTBundle.get("settingsConfigurable.service.watsonx.cloudRegion.comment"))
129-
.resizeX(false))
130120
.add(UI.PanelFactory.panel(apiKeyField)
131121
.withLabel(CodeGPTBundle.get("settingsConfigurable.service.watsonx.onCloudApiKey.label"))
132122
.withComment(CodeGPTBundle.get(
@@ -268,7 +258,6 @@ public WatsonxSettingsState getCurrentState() {
268258
state.setOnPremHost(onPremHostField.getText());
269259
state.setUsername(usernameField.getText());
270260
state.setZenApiKey(zenApiKeyCheckbox.isSelected());
271-
state.setRegion((String)regionComboBox.getSelectedItem());
272261
state.setApiVersion(apiVersionField.getText());
273262
state.setSpaceId(spaceIdField.getText());
274263
state.setProjectId(projectIdField.getText());
@@ -292,7 +281,6 @@ public void resetForm() {
292281
usernameField.setText(state.getUsername());
293282
zenApiKeyCheckbox.setSelected(state.isZenApiKey());
294283
apiKeyField.setText(CredentialsStore.getCredential(WATSONX_API_KEY));
295-
regionComboBox.setSelectedItem(state.getRegion());
296284
apiVersionField.setText(state.getApiVersion());
297285
spaceIdField.setText(state.getSpaceId());
298286
projectIdField.setText(state.getProjectId());

src/main/java/ee/carlrobert/codegpt/settings/service/watsonx/WatsonxSettingsState.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public class WatsonxSettingsState {
88
private String username;
99
private boolean isOnPrem = false;
1010
private boolean isZenApiKey = false;
11-
private String region = "us-south";
1211
private String apiVersion = "2024-03-14";
1312
// use this model as default
1413
private String model = "ibm/granite-3b-code-instruct";
@@ -58,12 +57,6 @@ public void setUsername(String username) {
5857
this.username = username;
5958
}
6059

61-
public String getRegion() {return region;}
62-
63-
public void setRegion(String region) {
64-
this.region = region;
65-
}
66-
6760
public String getApiVersion() {
6861
return apiVersion;
6962
}
@@ -177,12 +170,12 @@ public boolean equals(Object o) {
177170
return false;
178171
}
179172
ee.carlrobert.codegpt.settings.service.watsonx.WatsonxSettingsState that = (ee.carlrobert.codegpt.settings.service.watsonx.WatsonxSettingsState) o;
180-
return Objects.equals(apiVersion, that.apiVersion) && Objects.equals(region, that.region) && Objects.equals(spaceId, that.spaceId) && Objects.equals(projectId, that.projectId) && Objects.equals(model, that.model) && Objects.equals(temperature,that.temperature) && Objects.equals(topP,that.topP) && Objects.equals(topK,that.topK) && Objects.equals(randomSeed,that.randomSeed) && Objects.equals(repetitionPenalty,that.repetitionPenalty) && Objects.equals(maxNewTokens, that.maxNewTokens) && Objects.equals(minNewTokens,that.minNewTokens) && Objects.equals(isGreedyDecoding,that.isGreedyDecoding) && Objects.equals(isOnPrem,that.isOnPrem) && Objects.equals(isZenApiKey,that.isZenApiKey);
173+
return Objects.equals(apiVersion, that.apiVersion) && Objects.equals(spaceId, that.spaceId) && Objects.equals(projectId, that.projectId) && Objects.equals(model, that.model) && Objects.equals(temperature,that.temperature) && Objects.equals(topP,that.topP) && Objects.equals(topK,that.topK) && Objects.equals(randomSeed,that.randomSeed) && Objects.equals(repetitionPenalty,that.repetitionPenalty) && Objects.equals(maxNewTokens, that.maxNewTokens) && Objects.equals(minNewTokens,that.minNewTokens) && Objects.equals(isGreedyDecoding,that.isGreedyDecoding) && Objects.equals(isOnPrem,that.isOnPrem) && Objects.equals(isZenApiKey,that.isZenApiKey);
181174

182175
}
183176

184177
@Override
185178
public int hashCode() {
186-
return Objects.hash(apiVersion, region, model, apiVersion, projectId, spaceId,temperature,topP,topK,randomSeed,includeStopSequence,stopSequences,repetitionPenalty, maxNewTokens,minNewTokens,isGreedyDecoding,isOnPrem,isZenApiKey);
179+
return Objects.hash(apiVersion, model, apiVersion, projectId, spaceId,temperature,topP,topK,randomSeed,includeStopSequence,stopSequences,repetitionPenalty, maxNewTokens,minNewTokens,isGreedyDecoding,isOnPrem,isZenApiKey);
187180
}
188181
}

src/main/resources/messages/codegpt.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ settingsConfigurable.service.watsonx.minNewTokens.label=Min completion tokens:
164164
settingsConfigurable.service.watsonx.stopSequences.label=Stop sequences
165165
settingsConfigurable.service.watsonx.stopSequences.comment=Comma-separated list of stop sequences
166166
settingsConfigurable.service.watsonx.repetitionPenalty.comment=
167-
settingsConfigurable.service.watsonx.cloudRegion.label=IBM Cloud region:
168-
settingsConfigurable.service.watsonx.cloudRegion.comment=
169167
configurationConfigurable.section.commitMessage.title=Commit Message Template
170168
configurationConfigurable.section.commitMessage.systemPromptField.label=Prompt template:
171169
configurationConfigurable.section.inlineCompletion.title=Inline Completion

0 commit comments

Comments
 (0)