Skip to content

Commit

Permalink
Merge pull request #351 from devoxx/feature-chromadb
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
stephanj authored Dec 9, 2024
2 parents 37b2c60 + d3a27d7 commit 2696e9c
Show file tree
Hide file tree
Showing 41 changed files with 7 additions and 1,103 deletions.
7 changes: 0 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ plugins {
}

group = "com.devoxx.genie"
<<<<<<< HEAD
version = "0.4.0"
=======
version = "0.3.1"
>>>>>>> master

repositories {
mavenCentral()
Expand Down Expand Up @@ -56,12 +52,9 @@ dependencies {
implementation("dev.langchain4j:langchain4j-web-search-engine-google-custom:$lg4j_version")
implementation("dev.langchain4j:langchain4j-web-search-engine-tavily:$lg4j_version")
implementation("dev.langchain4j:langchain4j-azure-open-ai:$lg4j_version")
<<<<<<< HEAD
implementation("dev.langchain4j:langchain4j-chroma:$lg4j_version")

implementation("com.github.docker-java:docker-java:3.4.0")
=======
>>>>>>> master

implementation("com.knuddels:jtokkit:1.0.0")
implementation("org.commonmark:commonmark:0.22.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public interface DevoxxGenieSettingsService {

String getOpenRouterKey();

<<<<<<< HEAD
Boolean getEnableWebSearch();
=======
Boolean getHideSearchButtonsFlag();
>>>>>>> master

String getGoogleSearchKey();

Expand Down Expand Up @@ -132,11 +128,7 @@ public interface DevoxxGenieSettingsService {

void setOpenRouterKey(String key);

<<<<<<< HEAD
void setEnableWebSearch(Boolean flag);
=======
void setHideSearchButtonsFlag(Boolean flag);
>>>>>>> master

void setGoogleSearchKey(String key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
import com.devoxx.genie.chatmodel.ollama.OllamaChatModelFactory;
import com.devoxx.genie.chatmodel.openai.OpenAIChatModelFactory;
import com.devoxx.genie.chatmodel.openrouter.OpenRouterChatModelFactory;
<<<<<<< HEAD
=======
import com.devoxx.genie.error.ErrorHandler;
import com.intellij.openapi.diagnostic.Logger;
>>>>>>> master
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import com.devoxx.genie.model.ChatModel;
import com.devoxx.genie.model.LanguageModel;
import com.devoxx.genie.model.enumarations.ModelProvider;
<<<<<<< HEAD
=======
import com.devoxx.genie.service.DevoxxGenieSettingsService;
>>>>>>> master
import com.devoxx.genie.ui.settings.DevoxxGenieStateService;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.chat.StreamingChatLanguageModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
import com.devoxx.genie.model.LanguageModel;
import com.devoxx.genie.model.enumarations.ModelProvider;
import com.devoxx.genie.model.request.ChatMessageContext;
<<<<<<< HEAD
import com.devoxx.genie.service.ChatPromptExecutor;
import com.devoxx.genie.service.DevoxxGenieSettingsService;
=======
import com.devoxx.genie.service.*;
>>>>>>> master
import com.devoxx.genie.ui.EditorFileButtonManager;
import com.devoxx.genie.ui.component.PromptInputArea;
import com.devoxx.genie.ui.panel.ActionButtonsPanel;
Expand All @@ -19,13 +15,8 @@
import com.devoxx.genie.util.ChatMessageContextUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
<<<<<<< HEAD
import com.intellij.openapi.ui.ComboBox;
import org.jetbrains.annotations.NotNull;
=======
import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.ui.ComboBox;
>>>>>>> master
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/com/devoxx/genie/model/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ private Constant() {
/help: show commands
The Devoxx Genie is open source and available at https://github.com/devoxx/DevoxxGenieIDEAPlugin.
<<<<<<< HEAD
You can follow us on Bluesky @ https://bsky.app/profile/devoxxgenie.bsky.social.
=======
You can follow us on Twitter @DevoxxGenie.
>>>>>>> master
Do not include any more info which might be incorrect, like discord, documentation or other websites.
Only provide info that is correct and relevant to the code or plugin.
""";
Expand All @@ -31,16 +27,13 @@ private Constant() {
public static final String REVIEW_PROMPT = "Review the selected code, can it be improved or are there any bugs?";
public static final String EXPLAIN_PROMPT = "Break down the code in simple terms to help a junior developer grasp its functionality.";
public static final String TDG_PROMPT = "You are a professional Java developer. Give me a SINGLE FILE COMPLETE java implementation that will pass this test. Do not respond with a test. Give me only complete code and no snippets. Include imports and use the right package.";
<<<<<<< HEAD
public static final String FIND_PROMPT = "Perform semantic search on the project files using RAG and show matching files.";

public static final String TEST_COMMAND = "test";
public static final String FIND_COMMAND = "find";
public static final String REVIEW_COMMAND = "review";
public static final String EXPLAIN_COMMAND = "explain";
public static final String TDG_COMMAND = "tdg";
=======
>>>>>>> master

// The Local LLM Model URLs, these can be overridden in the settings page
public static final String OLLAMA_MODEL_URL = "http://localhost:11434/";
Expand Down Expand Up @@ -69,17 +62,12 @@ private Constant() {
public static final Integer MAX_MEMORY = 10;

// Hide Search Button
<<<<<<< HEAD
public static final Boolean ENABLE_WEB_SEARCH = false;
=======
public static final Boolean HIDE_SEARCH_BUTTONS = false;
>>>>>>> master
public static final Integer MAX_SEARCH_RESULTS = 3;

// Stream mode settings
public static final Boolean STREAM_MODE = false;

<<<<<<< HEAD
// Button labels
public static final String ADD_PROJECT_TO_CONTEXT = "Add project";
public static final String CALC_TOKENS_COST = "Calc Tokens";
Expand All @@ -96,13 +84,4 @@ private Constant() {

// Titles
public static final String FILTER_AND_DOUBLE_CLICK_TO_ADD_TO_PROMPT_CONTEXT = "Filter and Double-Click To Add To Prompt Context";

=======
// Button tooltip texts
public static final String ADD_FILE_S_TO_PROMPT_CONTEXT = "Add file(s) to prompt context";
public static final String SUBMIT_THE_PROMPT = "Submit the prompt";
public static final String SEARCH_THE_WEB_WITH_TAVILY_FOR_AN_ANSWER = "Search the web with Tavily for an answer";
public static final String SEARCH_GOOGLE_FOR_AN_ANSWER = "Search Google for an answer";
public static final String PROMPT_IS_RUNNING_PLEASE_BE_PATIENT = "Prompt is running, please be patient...";
>>>>>>> master
}
9 changes: 0 additions & 9 deletions src/main/java/com/devoxx/genie/model/ScanContentResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

<<<<<<< HEAD
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

=======
>>>>>>> master
@AllArgsConstructor
@NoArgsConstructor
@Setter
Expand All @@ -22,11 +19,8 @@ public class ScanContentResult {
private int fileCount;
private int skippedFileCount;
private int skippedDirectoryCount;
<<<<<<< HEAD
@Getter
private List<Path> files = new ArrayList<>(); // Add this field
=======
>>>>>>> master

public void incrementFileCount() {
fileCount++;
Expand All @@ -43,11 +37,8 @@ public void incrementSkippedDirectoryCount() {
public void addTokenCount(int tokenCount) {
this.tokenCount += tokenCount;
}
<<<<<<< HEAD

public void addFile(Path file) {
files.add(file);
}
=======
>>>>>>> master
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
import dev.langchain4j.model.output.TokenUsage;
import lombok.Builder;
import lombok.Data;
<<<<<<< HEAD
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.List;
=======

import java.time.LocalDateTime;
>>>>>>> master

@Data
@Builder
Expand All @@ -40,24 +35,17 @@ public class ChatMessageContext {
private TokenUsage tokenUsage;
private String commandName; // Custom command name for the prompt, for example /test, /review etc.
private double cost;
<<<<<<< HEAD
private boolean ragActivated;
private boolean gitDiffActivated;
private boolean webSearchActivated;
=======
>>>>>>> master

@Builder.Default
private boolean webSearchRequested = false;

<<<<<<< HEAD
@Getter
@Setter
private List<SemanticFile> semanticReferences;

=======
// Custom method
>>>>>>> master
public boolean hasFiles() {
return totalFileCount > 0;
}
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/com/devoxx/genie/service/ChatPromptExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import com.devoxx.genie.ui.component.PromptInputArea;
import com.devoxx.genie.ui.panel.PromptOutputPanel;
import com.devoxx.genie.ui.settings.DevoxxGenieStateService;
<<<<<<< HEAD
import com.devoxx.genie.ui.util.NotificationUtil;
=======
>>>>>>> master
import com.devoxx.genie.util.FileTypeUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
Expand All @@ -26,11 +23,8 @@
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

<<<<<<< HEAD
import static com.devoxx.genie.model.Constant.FIND_COMMAND;

=======
>>>>>>> master
public class ChatPromptExecutor {

private final StreamingPromptExecutor streamingPromptExecutor;
Expand All @@ -55,11 +49,7 @@ public void executePrompt(@NotNull ChatMessageContext chatMessageContext,
Runnable enableButtons) {

Project project = chatMessageContext.getProject();
<<<<<<< HEAD
if (Boolean.TRUE.equals(isRunningMap.getOrDefault(project, false))) {
=======
if (isRunningMap.getOrDefault(project, false)) {
>>>>>>> master
stopPromptExecution(project);
return;
}
Expand All @@ -78,11 +68,7 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
promptInputArea.requestInputFocus();
});
});
<<<<<<< HEAD
} else if (Boolean.TRUE.equals(DevoxxGenieStateService.getInstance().getStreamMode())) {
=======
} else if (DevoxxGenieStateService.getInstance().getStreamMode()) {
>>>>>>> master
streamingPromptExecutor.execute(chatMessageContext, promptOutputPanel, () -> {
isRunningMap.put(project, false);
enableButtons.run();
Expand Down Expand Up @@ -154,11 +140,7 @@ public Optional<String> updatePromptWithCommandIfPresent(@NotNull ChatMessageCon
* @param project the project
*/
public void stopPromptExecution(Project project) {
<<<<<<< HEAD
if (Boolean.TRUE.equals(isRunningMap.getOrDefault(project, false))) {
=======
if (isRunningMap.getOrDefault(project, false)) {
>>>>>>> master
isRunningMap.put(project, false);
streamingPromptExecutor.stopStreaming();
nonStreamingPromptExecutor.stopExecution();
Expand All @@ -177,7 +159,6 @@ private Optional<String> getCommandFromPrompt(@NotNull ChatMessageContext chatMe
if (prompt.startsWith("/")) {
DevoxxGenieSettingsService settings = DevoxxGenieStateService.getInstance();

<<<<<<< HEAD
if (prompt.toLowerCase().startsWith("/" + FIND_COMMAND + " ")) {
if (Boolean.FALSE.equals(DevoxxGenieStateService.getInstance().getRagEnabled())) {
NotificationUtil.sendNotification(chatMessageContext.getProject(),
Expand All @@ -188,8 +169,6 @@ private Optional<String> getCommandFromPrompt(@NotNull ChatMessageContext chatMe
return Optional.of(prompt.substring(6).trim());
}

=======
>>>>>>> master
// Check for custom prompts
for (CustomPrompt customPrompt : settings.getCustomPrompts()) {
if (prompt.equalsIgnoreCase("/" + customPrompt.getName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ private void addGeminiModels() {
.contextWindow(1_000_000)
.apiKeyUsed(true)
.build());
<<<<<<< HEAD

String geminiExp1206 = "gemini-exp-1206";
models.put(ModelProvider.Google.getName() + ":" + gemini10Pro,
Expand All @@ -411,8 +410,6 @@ private void addGeminiModels() {
.contextWindow(2_000_000)
.apiKeyUsed(true)
.build());
=======
>>>>>>> master
}

private void addGroqModels() {
Expand Down
Loading

0 comments on commit 2696e9c

Please sign in to comment.