-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
548 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/devoxx/genie/service/settings/llm/LLMStateService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.devoxx.genie.service.settings.llm; | ||
|
||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.openapi.components.PersistentStateComponent; | ||
import com.intellij.openapi.components.Service; | ||
import com.intellij.openapi.components.State; | ||
import com.intellij.openapi.components.Storage; | ||
import com.intellij.util.xmlb.XmlSerializerUtil; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static com.devoxx.genie.model.Constant.*; | ||
|
||
@Getter | ||
@Setter | ||
@Service | ||
@State( | ||
name = "com.devoxx.genie.ui.SettingsState", | ||
storages = @Storage("DevoxxGenieSettingsPlugin.xml") | ||
) | ||
public final class LLMStateService implements PersistentStateComponent<LLMStateService> { | ||
|
||
public static LLMStateService getInstance() { | ||
return ApplicationManager.getApplication().getService(LLMStateService.class); | ||
} | ||
|
||
// Local LLM URL fields | ||
private String ollamaModelUrl = OLLAMA_MODEL_URL; | ||
private String lmstudioModelUrl = LMSTUDIO_MODEL_URL; | ||
private String gpt4allModelUrl = GPT4ALL_MODEL_URL; | ||
private String janModelUrl = JAN_MODEL_URL; | ||
|
||
// LLM API Keys | ||
private String openAIKey = ""; | ||
private String mistralKey = ""; | ||
private String anthropicKey = ""; | ||
private String groqKey = ""; | ||
private String deepInfraKey = ""; | ||
private String geminiKey = ""; | ||
|
||
// Search API Keys | ||
private Boolean hideSearchButtonsFlag = HIDE_SEARCH_BUTTONS; | ||
private String googleSearchKey = ""; | ||
private String googleCSIKey = ""; | ||
private String tavilySearchKey = ""; | ||
|
||
// Enable stream mode | ||
private Boolean streamMode = STREAM_MODE; | ||
|
||
@Override | ||
public LLMStateService getState() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public void loadState(@NotNull LLMStateService state) { | ||
XmlSerializerUtil.copyBean(state, this); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/main/java/com/devoxx/genie/service/settings/llmconfig/LLMConfigStateService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.devoxx.genie.service.settings.llmconfig; | ||
|
||
import com.devoxx.genie.ui.util.DoubleConverter; | ||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.openapi.components.PersistentStateComponent; | ||
import com.intellij.openapi.components.Service; | ||
import com.intellij.openapi.components.State; | ||
import com.intellij.openapi.components.Storage; | ||
import com.intellij.util.xmlb.XmlSerializerUtil; | ||
import com.intellij.util.xmlb.annotations.OptionTag; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static com.devoxx.genie.model.Constant.*; | ||
|
||
@Getter | ||
@Setter | ||
@Service | ||
@State( | ||
name = "com.devoxx.genie.ui.LLMConfigState", | ||
storages = @Storage("DevoxxGenieLLMConfigPlugin.xml") | ||
) | ||
public final class LLMConfigStateService implements PersistentStateComponent<LLMConfigStateService> { | ||
|
||
public static LLMConfigStateService getInstance() { | ||
return ApplicationManager.getApplication().getService(LLMConfigStateService.class); | ||
} | ||
|
||
// Prompt fields | ||
private String systemPrompt = SYSTEM_PROMPT; | ||
private String testPrompt = TEST_PROMPT; | ||
private String reviewPrompt = REVIEW_PROMPT; | ||
private String explainPrompt = EXPLAIN_PROMPT; | ||
private String customPrompt = CUSTOM_PROMPT; | ||
|
||
// LLM settings | ||
@OptionTag(converter = DoubleConverter.class) | ||
private Double temperature = TEMPERATURE; | ||
|
||
@OptionTag(converter = DoubleConverter.class) | ||
private Double topP = TOP_P; | ||
|
||
private Integer timeout = TIMEOUT; | ||
private Integer maxRetries = MAX_RETRIES; | ||
private Integer chatMemorySize = MAX_MEMORY; | ||
|
||
// Was unable to make it work with Integer for some unknown reason | ||
private String maxOutputTokens = MAX_OUTPUT_TOKENS.toString(); | ||
|
||
// Last selected LLM provider and model name | ||
private String lastSelectedProvider; | ||
private String lastSelectedModel; | ||
|
||
// Enable AST mode | ||
private Boolean astMode = AST_MODE; | ||
private Boolean astParentClass = AST_PARENT_CLASS; | ||
private Boolean astClassReference = AST_CLASS_REFERENCE; | ||
private Boolean astFieldReference = AST_FIELD_REFERENCE; | ||
|
||
@Override | ||
public LLMConfigStateService getState() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public void loadState(@NotNull LLMConfigStateService state) { | ||
XmlSerializerUtil.copyBean(state, this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
src/main/java/com/devoxx/genie/ui/settings/AbstractSettingsComponent.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.