Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
74af5fd
Wip
stephanj Mar 21, 2025
1f7d1dc
Working MCP config and setup
stephanj Mar 21, 2025
a2e283d
MCP Path fix
stephanj Mar 21, 2025
52e62be
Enable/disable MCP server
stephanj Mar 21, 2025
df96324
View tools per MCP server
stephanj Mar 21, 2025
10ceef9
Moved prompt classes to central package
stephanj Mar 21, 2025
6f63b33
Introduced prompt strategy pattern
stephanj Mar 21, 2025
6cae1e7
Fix #554 and #560
stephanj Mar 21, 2025
18fd056
Prompt error handling refactoring
stephanj Mar 21, 2025
e8a6240
Streamlined prompt thread management
stephanj Mar 21, 2025
6f55bb4
Fix memory cleanup
stephanj Mar 21, 2025
b81c699
Memory cleanup for deletion or cancellation tasks
stephanj Mar 21, 2025
1ab7a68
Introduced AbstractPromptExecutionStrategy + Ignore editor info when …
stephanj Mar 21, 2025
58ad463
Fix calc tokens per directory
stephanj Mar 21, 2025
b9ad965
Fix for 'add project' logic
stephanj Mar 21, 2025
30589c5
Use @Sl4j instead of LOGGER
stephanj Mar 21, 2025
ec9ebbe
Use @Sl4j instead of LOGGER
stephanj Mar 21, 2025
a68a6a3
Show MCP tool icon in action panel when enabled
stephanj Mar 22, 2025
07e1f18
Introduction of MCP Logs panel
stephanj Mar 22, 2025
2986c3c
Removed JSON formatting for MCP logs
stephanj Mar 22, 2025
dec2e81
Show MCP log automatically when enabled
stephanj Mar 22, 2025
9997972
Removed unused imports
stephanj Mar 22, 2025
050859b
More cleanup
stephanj Mar 22, 2025
04456ec
Include DEVOXXGENIE.md
stephanj Mar 22, 2025
be3f35a
Fixed all broken tests
stephanj Mar 22, 2025
a388c87
Restore prompt tests
stephanj Mar 22, 2025
9b96f45
MCP Fixes
stephanj Mar 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
642 changes: 484 additions & 158 deletions DEVOXXGENIE.md

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ With Claude 3.7 Sonnet, DevoxxGenie isn't just another developer tool... it's a

### Key Features:

- **🔥️ MCP Support **: You can now add MCP servers!</LI>
- **🗂️ DEVOXXGENIE.md**: By incorporating this into the system prompt, the LLM will gain a deeper understanding of your project and provide more relevant responses.
- **📸 DnD images (🔥 NEW)**: You can now DnD images with multimodal LLM's.
- **📸 DnD images**: You can now DnD images with multimodal LLM's.
- **🧐 RAG Support**: Retrieval-Augmented Generation (RAG) support for automatically incorporating project context into your prompts.
- **💪🏻 Git Diff/Merge** : Show Git Diff/Merge dialog to accept LLM suggestions.
- **👀 Chat History**: Your chats are stored locally, allowing you to easily restore them in the future.
Expand Down Expand Up @@ -69,7 +70,12 @@ With Claude 3.7 Sonnet, DevoxxGenie isn't just another developer tool... it's a
- In the DevoxxGenie window select your cloud provider and model
- Start prompting

### 🗂️ DEVOXXGENIE.md (Draft feature for v0.5.0)
### 🗂️ Model Context Protocol servers support (from v0.5.0 onwards)

Initial support for Model Context Protocol (MCP) server tools.


### 🗂️ DEVOXXGENIE.md (from v0.5.0 onwards)

You can now generate a **DEVOXXGENIE.md** file directly from the "Prompts" plugin settings page or just use /init in the prompt input field.

Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tasks.named("buildPlugin") {
}

dependencies {
val lg4j_version = "1.0.0-beta1"
val lg4j_version = "1.0.0-beta2"

// Add the dependencies for the core module
implementation(project(":core"))
Expand All @@ -68,6 +68,7 @@ dependencies {
implementation("dev.langchain4j:langchain4j-web-search-engine-tavily:$lg4j_version")
implementation("dev.langchain4j:langchain4j-azure-open-ai:$lg4j_version")
implementation("dev.langchain4j:langchain4j-chroma:$lg4j_version")
implementation("dev.langchain4j:langchain4j-mcp:$lg4j_version")

// Retrofit dependencies
implementation("com.squareup.retrofit2:converter-gson:2.11.0")
Expand Down
3 changes: 3 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## TODO
We'll refactor this module to devoxxgenie-core and update it with the newest model java files
See also https://github.com/devoxx/DevoxxGenieIDEAPlugin/issues/564
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repositories {
}

dependencies {
val lg4j_version = "0.36.0"
val lg4j_version = "1.0.0-beta2"
implementation("dev.langchain4j:langchain4j:$lg4j_version")
implementation("dev.langchain4j:langchain4j-ollama:$lg4j_version")
implementation("dev.langchain4j:langchain4j-local-ai:$lg4j_version")
Expand Down
67 changes: 67 additions & 0 deletions docs/prompt_structure_refactoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Prompt Structure Refactoring Guide

This document describes the refactoring applied to the prompt structure in the DevoxxGenie plugin to improve maintainability and extensibility.

## Overview of Changes

The prompt structure has been refactored to use cleaner design patterns and improve separation of concerns:

1. **Strategy Pattern** for different execution approaches
2. **Command Pattern** for prompt command handling
3. **Factory Pattern** for strategy selection
4. **Unified Memory Management**
5. **Centralized Prompt Service**

## New Components

### Core Services
- `PromptExecutionService` - Main service that orchestrates prompt execution
- `ChatMemoryManager` - Unified memory management
- `PromptCommandProcessor` - Central command processing

### Strategies
- `PromptExecutionStrategy` (interface)
- `NonStreamingPromptStrategy` - For regular, non-streaming responses
- `StreamingPromptStrategy` - For streaming responses
- `WebSearchPromptStrategy` - For web search based responses

### Commands
- `PromptCommand` (interface)
- `FindCommand` - Handles /find command
- `HelpCommand` - Handles /help command
- `CustomPromptCommand` - Handles user-defined commands

### Factory and Adapters
- `PromptExecutionStrategyFactory` - Creates appropriate strategies
- `LegacyPromptExecutorAdapter` - Adapter for backward compatibility

## Migration

The migration is designed to be incremental:

1. New components are registered in `plugin-services.xml`
2. Adapter classes provide backward compatibility
3. Existing code can gradually migrate to use the new services

## Benefits

1. **Better Separation of Concerns** - Each component has a focused responsibility
2. **Improved Testability** - Components can be tested in isolation
3. **Enhanced Extensibility** - New strategies/commands can be added easily
4. **Reduced Duplication** - Common patterns extracted to shared components
5. **More Consistent Behavior** - Standardized execution flow and memory management

## Future Work

1. Replace legacy calls to directly use the new services
2. Gradually phase out adapter classes
3. Add unit tests for the new components
4. Consider further enhancements like caching strategies or more specialized commands

## Implementation Details

The implementation follows modern Java practices and IntelliJ platform guidelines:
- Services are registered as application services
- Components use dependency injection
- Concurrency is handled safely
- Error handling is centralized
7 changes: 3 additions & 4 deletions src/main/java/com/devoxx/genie/action/AddSnippetAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.SelectionModel;
Expand All @@ -14,15 +13,15 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static com.devoxx.genie.ui.util.WindowPluginUtil.ensureToolWindowVisible;

@Slf4j
public class AddSnippetAction extends DumbAwareAction {

private static final Logger LOG = Logger.getInstance(AddSnippetAction.class);

public static final String CODE_SNIPPET = "codeSnippet";
public static final Key<VirtualFile> ORIGINAL_FILE_KEY = Key.create("ORIGINAL_FILE");
public static final Key<String> SELECTED_TEXT_KEY = Key.create("SELECTED_TEXT");
Expand Down Expand Up @@ -86,7 +85,7 @@ private void createAndAddVirtualFile(@Nullable Project project,
@NotNull Editor editor,
String selectedText) {
if (project == null) {
LOG.error("Project is null");
log.error("Project is null");
return;
}
SelectionModel selectionModel = editor.getSelectionModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
import com.devoxx.genie.model.LanguageModel;
import com.devoxx.genie.model.enumarations.ModelProvider;
import com.devoxx.genie.ui.settings.DevoxxGenieStateService;
import dev.langchain4j.model.bedrock.*;
import dev.langchain4j.model.bedrock.BedrockChatModel;
import dev.langchain4j.model.chat.request.ChatRequestParameters;
import software.amazon.awssdk.services.bedrockruntime.BedrockRuntimeClient;
import dev.langchain4j.model.chat.ChatLanguageModel;
import org.apache.commons.lang3.NotImplementedException;
import org.jetbrains.annotations.NotNull;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;

import java.util.List;

/**
Expand Down Expand Up @@ -64,62 +67,86 @@ public ChatLanguageModel createChatModel(ChatModel chatModel) {
* @return An instance of {@link ChatLanguageModel} configured for Anthropic models.
*/
private ChatLanguageModel createAnthropicChatModel(@NotNull ChatModel chatModel) {
return BedrockAnthropicMessageChatModel.builder()
.model(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.credentialsProvider(getCredentialsProvider())
.region(getRegion())
return BedrockChatModel.builder()
.modelId(chatModel.getModelName())
.client(BedrockRuntimeClient.builder()
.region(getRegion())
.credentialsProvider(getCredentialsProvider())
.build())
.defaultRequestParameters(ChatRequestParameters.builder()
.temperature(chatModel.getTemperature())
.maxOutputTokens(chatModel.getMaxTokens())
.build())
.build();
}

private ChatLanguageModel createMistralChatModel(@NotNull ChatModel chatModel) {
return BedrockMistralAiChatModel.builder()
.model(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.credentialsProvider(getCredentialsProvider())
.region(getRegion())
return BedrockChatModel.builder()
.modelId(chatModel.getModelName())
.client(BedrockRuntimeClient.builder()
.region(getRegion())
.credentialsProvider(getCredentialsProvider())
.build())
.defaultRequestParameters(ChatRequestParameters.builder()
.temperature(chatModel.getTemperature())
.maxOutputTokens(chatModel.getMaxTokens())
.build())
.build();
}

private ChatLanguageModel createCohereChatModel(@NotNull ChatModel chatModel) {
return BedrockCohereChatModel.builder()
.model(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.credentialsProvider(getCredentialsProvider())
.region(getRegion())
return BedrockChatModel.builder()
.modelId(chatModel.getModelName())
.client(BedrockRuntimeClient.builder()
.region(getRegion())
.credentialsProvider(getCredentialsProvider())
.build())
.defaultRequestParameters(ChatRequestParameters.builder()
.temperature(chatModel.getTemperature())
.maxOutputTokens(chatModel.getMaxTokens())
.build())
.build();
}

private ChatLanguageModel createLamaChatModel(@NotNull ChatModel chatModel) {
return BedrockLlamaChatModel.builder()
.model(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.credentialsProvider(getCredentialsProvider())
.region(getRegion())
return BedrockChatModel.builder()
.modelId(chatModel.getModelName())
.client(BedrockRuntimeClient.builder()
.region(getRegion())
.credentialsProvider(getCredentialsProvider())
.build())
.defaultRequestParameters(ChatRequestParameters.builder()
.temperature(chatModel.getTemperature())
.maxOutputTokens(chatModel.getMaxTokens())
.build())
.build();
}

private ChatLanguageModel createAI21ChatModel(@NotNull ChatModel chatModel) {
return BedrockAI21LabsChatModel.builder()
.model(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.credentialsProvider(getCredentialsProvider())
.region(getRegion())
return BedrockChatModel.builder()
.modelId(chatModel.getModelName())
.client(BedrockRuntimeClient.builder()
.region(getRegion())
.credentialsProvider(getCredentialsProvider())
.build())
.defaultRequestParameters(ChatRequestParameters.builder()
.temperature(chatModel.getTemperature())
.maxOutputTokens(chatModel.getMaxTokens())
.build())
.build();
}

private ChatLanguageModel createStabilityChatModel(@NotNull ChatModel chatModel) {
return BedrockStabilityAIChatModel.builder()
.model(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.credentialsProvider(getCredentialsProvider())
.region(getRegion())
return BedrockChatModel.builder()
.modelId(chatModel.getModelName())
.client(BedrockRuntimeClient.builder()
.region(getRegion())
.credentialsProvider(getCredentialsProvider())
.build())
.defaultRequestParameters(ChatRequestParameters.builder()
.temperature(chatModel.getTemperature())
.maxOutputTokens(chatModel.getMaxTokens())
.build())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.devoxx.genie.util.HttpClientProvider;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import okhttp3.*;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
Expand Down
Loading
Loading