diff --git a/build.gradle.kts b/build.gradle.kts index 2ff4dd8e..84243b3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "com.devoxx.genie" -version = "0.1.17" +version = "0.1.18" repositories { mavenCentral() diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Candidate.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Candidate.class new file mode 100644 index 00000000..ccfa8793 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Candidate.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationMetadata$CitationMetadataBuilder.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationMetadata$CitationMetadataBuilder.class new file mode 100644 index 00000000..a71da5d6 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationMetadata$CitationMetadataBuilder.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationMetadata.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationMetadata.class new file mode 100644 index 00000000..1082d757 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationMetadata.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationSources$CitationSourcesBuilder.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationSources$CitationSourcesBuilder.class new file mode 100644 index 00000000..dc8281e9 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationSources$CitationSourcesBuilder.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationSources.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationSources.class new file mode 100644 index 00000000..b6a17d80 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/CitationSources.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Content$ContentBuilder.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Content$ContentBuilder.class new file mode 100644 index 00000000..9b12008f Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Content$ContentBuilder.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Content.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Content.class new file mode 100644 index 00000000..ed32df5b Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Content.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/GenerationConfig$GenerationConfigBuilder.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/GenerationConfig$GenerationConfigBuilder.class new file mode 100644 index 00000000..56049d66 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/GenerationConfig$GenerationConfigBuilder.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/GenerationConfig.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/GenerationConfig.class new file mode 100644 index 00000000..c7b8237c Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/GenerationConfig.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Part$PartBuilder.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Part$PartBuilder.class new file mode 100644 index 00000000..960053d2 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Part$PartBuilder.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Part.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Part.class new file mode 100644 index 00000000..3b72b573 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/Part.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SafetyRatings.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SafetyRatings.class new file mode 100644 index 00000000..24f934ad Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SafetyRatings.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SystemInstruction$SystemInstructionBuilder.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SystemInstruction$SystemInstructionBuilder.class new file mode 100644 index 00000000..8986f2e5 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SystemInstruction$SystemInstructionBuilder.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SystemInstruction.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SystemInstruction.class new file mode 100644 index 00000000..ce2fa15c Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/SystemInstruction.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/UsageMetadata.class b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/UsageMetadata.class new file mode 100644 index 00000000..c14d54aa Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/gemini/model/UsageMetadata.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/jan/Data.class b/core/build/classes/java/main/com/devoxx/genie/model/jan/Data.class new file mode 100644 index 00000000..c5e6b6bc Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/jan/Data.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/jan/Metadata.class b/core/build/classes/java/main/com/devoxx/genie/model/jan/Metadata.class new file mode 100644 index 00000000..16a6c8c2 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/jan/Metadata.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/jan/Parameters.class b/core/build/classes/java/main/com/devoxx/genie/model/jan/Parameters.class new file mode 100644 index 00000000..58d3b454 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/jan/Parameters.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/jan/ResponseDTO.class b/core/build/classes/java/main/com/devoxx/genie/model/jan/ResponseDTO.class new file mode 100644 index 00000000..a7753636 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/jan/ResponseDTO.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/jan/Settings.class b/core/build/classes/java/main/com/devoxx/genie/model/jan/Settings.class new file mode 100644 index 00000000..08bfd405 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/jan/Settings.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/ollama/OllamaModelDTO.class b/core/build/classes/java/main/com/devoxx/genie/model/ollama/OllamaModelDTO.class new file mode 100644 index 00000000..e895ceb5 Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/ollama/OllamaModelDTO.class differ diff --git a/core/build/classes/java/main/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.class b/core/build/classes/java/main/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.class new file mode 100644 index 00000000..79bc6b5c Binary files /dev/null and b/core/build/classes/java/main/com/devoxx/genie/model/ollama/OllamaModelEntryDTO.class differ diff --git a/core/build/libs/core-0.1.16.jar b/core/build/libs/core-0.1.16.jar new file mode 100644 index 00000000..f03e0138 Binary files /dev/null and b/core/build/libs/core-0.1.16.jar differ diff --git a/core/build/tmp/compileJava/previous-compilation-data.bin b/core/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 00000000..d985493c Binary files /dev/null and b/core/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/core/build/tmp/jar/MANIFEST.MF b/core/build/tmp/jar/MANIFEST.MF new file mode 100644 index 00000000..58630c02 --- /dev/null +++ b/core/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/main/java/com/devoxx/genie/service/ChatMemoryService.java b/src/main/java/com/devoxx/genie/service/ChatMemoryService.java index 1a1658ff..48dcd020 100644 --- a/src/main/java/com/devoxx/genie/service/ChatMemoryService.java +++ b/src/main/java/com/devoxx/genie/service/ChatMemoryService.java @@ -1,5 +1,6 @@ package com.devoxx.genie.service; +import com.devoxx.genie.model.request.ChatMessageContext; import com.devoxx.genie.ui.listener.ChatMemorySizeListener; import com.devoxx.genie.ui.settings.DevoxxGenieStateService; import com.devoxx.genie.ui.topic.AppTopics; @@ -26,12 +27,19 @@ public void init() { createChangeListener(); } + /** + * Create the change listener. + */ private void createChangeListener() { ApplicationManager.getApplication().getMessageBus() .connect() .subscribe(AppTopics.CHAT_MEMORY_SIZE_TOPIC, this); } + /** + * Get the chat memory service instance. + * @return the chat memory service instance + */ @NotNull public static ChatMemoryService getInstance() { return ApplicationManager.getApplication().getService(ChatMemoryService.class); @@ -41,23 +49,68 @@ public void clear() { chatMemory.clear(); } + /** + * Add the chat message to the chat memory. + * @param chatMessage the chat message + */ public void add(ChatMessage chatMessage) { chatMemory.add(chatMessage); } + /** + * Remove the chat message from the chat memory. + * @param chatMessageContext the chat message context + */ + public void remove(@NotNull ChatMessageContext chatMessageContext) { + List messages = chatMemory.messages(); + messages.remove(chatMessageContext.getAiMessage()); + messages.remove(chatMessageContext.getUserMessage()); + chatMemory.clear(); + messages.forEach(this::add); + } + + /** + * Remove the last message from the chat memory. + * This is used when an exception occurs and the last message is not valid. + */ + public void removeLast() { + List messages = chatMemory.messages(); + if (!messages.isEmpty()) { + messages.remove(messages.size() - 1); + chatMemory.clear(); + messages.forEach(this::add); + } + } + + /** + * Get the messages from the chat memory. + * @return the list of chat messages + */ public List messages() { return chatMemory.messages(); } + /** + * Check if the chat memory is empty. + * @return true if the chat memory is empty + */ public boolean isEmpty() { return chatMemory.messages().isEmpty(); } + /** + * On chat memory size changed. + * @param chatMemorySize the chat memory size + */ @Override public void onChatMemorySizeChanged(int chatMemorySize) { createChatMemory(chatMemorySize); } + /** + * Create the chat memory. + * @param chatMemorySize the chat memory size + */ private void createChatMemory(int chatMemorySize) { chatMemory = MessageWindowChatMemory.builder() .id("devoxxgenie") diff --git a/src/main/java/com/devoxx/genie/service/ChatMessageRemovalService.java b/src/main/java/com/devoxx/genie/service/ChatMessageRemovalService.java deleted file mode 100644 index 8a62c324..00000000 --- a/src/main/java/com/devoxx/genie/service/ChatMessageRemovalService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.devoxx.genie.service; - -import com.devoxx.genie.model.request.ChatMessageContext; -import com.devoxx.genie.ui.listener.ChatMessageManagementService; -import com.devoxx.genie.ui.topic.AppTopics; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.util.messages.MessageBus; -import com.intellij.util.messages.MessageBusConnection; -import dev.langchain4j.data.message.ChatMessage; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class ChatMessageRemovalService implements ChatMessageManagementService { - - @NotNull - public static ChatMessageRemovalService getInstance() { - return ApplicationManager.getApplication().getService(ChatMessageRemovalService.class); - } - - /** - * Constructor. - */ - public ChatMessageRemovalService() { - MessageBus bus = ApplicationManager.getApplication().getMessageBus(); - MessageBusConnection connection = bus.connect(); - connection.subscribe(AppTopics.CHAT_MESSAGES_CHANGED_TOPIC, this); - } - - /** - * Removes the user and AI response message from the chat memory. - * - * @param chatMessageContext the chat message context - */ - public void removeMessagePair(ChatMessageContext chatMessageContext) { - List messages = ChatMemoryService.getInstance().messages(); - - messages.removeIf(m -> (m.equals(chatMessageContext.getAiMessage()) || m.equals(chatMessageContext.getUserMessage()))); - - ChatMemoryService.getInstance().clear(); - messages.forEach(ChatMemoryService.getInstance()::add); - } -} diff --git a/src/main/java/com/devoxx/genie/service/ChatPromptExecutor.java b/src/main/java/com/devoxx/genie/service/ChatPromptExecutor.java index 2b1cc0c6..a31bc7da 100644 --- a/src/main/java/com/devoxx/genie/service/ChatPromptExecutor.java +++ b/src/main/java/com/devoxx/genie/service/ChatPromptExecutor.java @@ -1,6 +1,7 @@ package com.devoxx.genie.service; import com.devoxx.genie.model.request.ChatMessageContext; +import com.devoxx.genie.service.exception.ProviderUnavailableException; import com.devoxx.genie.ui.panel.PromptOutputPanel; import com.devoxx.genie.ui.settings.DevoxxGenieStateService; import com.devoxx.genie.ui.util.NotificationUtil; @@ -11,6 +12,8 @@ import dev.langchain4j.model.chat.StreamingChatLanguageModel; import org.jetbrains.annotations.NotNull; +import javax.swing.*; +import java.net.ConnectException; import java.util.Optional; import java.util.concurrent.CancellationException; import java.util.concurrent.TimeoutException; @@ -163,10 +166,16 @@ private void runPrompt(@NotNull ChatMessageContext chatMessageContext, return null; } if (e.getCause() instanceof TimeoutException) { - promptOutputPanel.addWarningText(chatMessageContext, "Timeout occurred. Please try again."); + NotificationUtil.sendNotification(chatMessageContext.getProject(), + "Timeout occurred. Please increase the timeout setting."); + return null; + } else if (e.getCause() instanceof ProviderUnavailableException) { + NotificationUtil.sendNotification(chatMessageContext.getProject(), + "LLM provider not available. Please select another provider or make sure it's running."); return null; } - promptOutputPanel.addWarningText(chatMessageContext, e.getMessage()); + String message = e.getMessage() + ". Maybe create an issue on GitHub?"; + NotificationUtil.sendNotification(chatMessageContext.getProject(), "Error occurred: " + message); return null; }); diff --git a/src/main/java/com/devoxx/genie/service/MessageCreationService.java b/src/main/java/com/devoxx/genie/service/MessageCreationService.java index 33f7c1ed..50794c6b 100644 --- a/src/main/java/com/devoxx/genie/service/MessageCreationService.java +++ b/src/main/java/com/devoxx/genie/service/MessageCreationService.java @@ -42,7 +42,7 @@ public static MessageCreationService getInstance() { if ((selectedText != null && !selectedText.isEmpty()) || (context != null && !context.isEmpty())) { userMessage = constructUserMessage(chatMessageContext, context); } else { - userMessage = new UserMessage(QUESTION + " " + chatMessageContext.getUserPrompt()); + userMessage = new UserMessage(chatMessageContext.getUserPrompt()); } return userMessage; } diff --git a/src/main/java/com/devoxx/genie/service/PromptExecutionService.java b/src/main/java/com/devoxx/genie/service/PromptExecutionService.java index db7b2e83..99006bb8 100644 --- a/src/main/java/com/devoxx/genie/service/PromptExecutionService.java +++ b/src/main/java/com/devoxx/genie/service/PromptExecutionService.java @@ -2,6 +2,7 @@ import com.devoxx.genie.model.Constant; import com.devoxx.genie.model.request.ChatMessageContext; +import com.devoxx.genie.service.exception.ProviderUnavailableException; import com.devoxx.genie.ui.settings.DevoxxGenieStateService; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; @@ -96,7 +97,8 @@ private boolean isCanceled() { ChatMemoryService.getInstance().add(response.content()); return Optional.of(response.content()); } catch (Exception e) { - throw new CompletionException(e); + ChatMemoryService.getInstance().removeLast(); + throw new ProviderUnavailableException(e.getMessage()); } } } diff --git a/src/main/java/com/devoxx/genie/service/StreamingResponseHandler.java b/src/main/java/com/devoxx/genie/service/StreamingResponseHandler.java index eacfc954..5cb94072 100644 --- a/src/main/java/com/devoxx/genie/service/StreamingResponseHandler.java +++ b/src/main/java/com/devoxx/genie/service/StreamingResponseHandler.java @@ -1,14 +1,18 @@ package com.devoxx.genie.service; import com.devoxx.genie.model.request.ChatMessageContext; +import com.devoxx.genie.service.exception.ProviderUnavailableException; import com.devoxx.genie.ui.component.ExpandablePanel; import com.devoxx.genie.ui.panel.ChatStreamingResponsePanel; import com.devoxx.genie.ui.panel.PromptOutputPanel; +import com.devoxx.genie.ui.util.NotificationUtil; import dev.langchain4j.data.message.AiMessage; import dev.langchain4j.model.output.Response; import org.jetbrains.annotations.NotNull; import javax.swing.*; +import java.net.ConnectException; +import java.util.concurrent.TimeoutException; public class StreamingResponseHandler implements dev.langchain4j.model.StreamingResponseHandler { @@ -34,8 +38,8 @@ public void onNext(String token) { @Override public void onComplete(@NotNull Response response) { - AiMessage content = response.content(); - ChatMemoryService.getInstance().add(content); + chatMessageContext.setAiMessage(response.content()); + ChatMemoryService.getInstance().add(response.content()); enableButtons.run(); if (chatMessageContext.hasFiles()) { SwingUtilities.invokeLater(() -> { @@ -48,8 +52,17 @@ public void onComplete(@NotNull Response response) { @Override public void onError(Throwable error) { - // TODO Show error message enableButtons.run(); + if (error.getCause() instanceof TimeoutException) { + NotificationUtil.sendNotification(chatMessageContext.getProject(), + "Timeout occurred. Please increase the timeout setting."); + } else if (error.getCause() instanceof ConnectException) { + NotificationUtil.sendNotification(chatMessageContext.getProject(), + "LLM provider not available. Please select another provider or make sure it's running."); + } else { + NotificationUtil.sendNotification(chatMessageContext.getProject(), + "An error occurred. Please try again."); + } } } diff --git a/src/main/java/com/devoxx/genie/service/exception/ProviderUnavailableException.java b/src/main/java/com/devoxx/genie/service/exception/ProviderUnavailableException.java new file mode 100644 index 00000000..3ef47858 --- /dev/null +++ b/src/main/java/com/devoxx/genie/service/exception/ProviderUnavailableException.java @@ -0,0 +1,8 @@ +package com.devoxx.genie.service.exception; + +public class ProviderUnavailableException extends RuntimeException { + + public ProviderUnavailableException(String message) { + super(message); + } +} diff --git a/src/main/java/com/devoxx/genie/ui/component/FileEntryComponent.java b/src/main/java/com/devoxx/genie/ui/component/FileEntryComponent.java index b477022d..a7ccfb97 100644 --- a/src/main/java/com/devoxx/genie/ui/component/FileEntryComponent.java +++ b/src/main/java/com/devoxx/genie/ui/component/FileEntryComponent.java @@ -1,7 +1,6 @@ package com.devoxx.genie.ui.component; import com.devoxx.genie.ui.listener.FileRemoveListener; -import com.devoxx.genie.ui.util.FileTypeIconUtil; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.project.Project; diff --git a/src/main/java/com/devoxx/genie/ui/listener/ChatMessageManagementService.java b/src/main/java/com/devoxx/genie/ui/listener/ChatMessageManagementService.java deleted file mode 100644 index 8fb69940..00000000 --- a/src/main/java/com/devoxx/genie/ui/listener/ChatMessageManagementService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.devoxx.genie.ui.listener; - -import com.devoxx.genie.model.request.ChatMessageContext; - -public interface ChatMessageManagementService { - - void removeMessagePair(ChatMessageContext chatMessageContext); -} diff --git a/src/main/java/com/devoxx/genie/ui/panel/UserPromptPanel.java b/src/main/java/com/devoxx/genie/ui/panel/UserPromptPanel.java index a436ac6c..1a13ddd6 100644 --- a/src/main/java/com/devoxx/genie/ui/panel/UserPromptPanel.java +++ b/src/main/java/com/devoxx/genie/ui/panel/UserPromptPanel.java @@ -1,22 +1,19 @@ package com.devoxx.genie.ui.panel; import com.devoxx.genie.model.request.ChatMessageContext; +import com.devoxx.genie.service.ChatMemoryService; import com.devoxx.genie.ui.component.JEditorPaneUtils; import com.devoxx.genie.ui.component.JHoverButton; import com.devoxx.genie.ui.component.StyleSheetsFactory; -import com.devoxx.genie.ui.listener.ChatMessageManagementService; -import com.devoxx.genie.ui.topic.AppTopics; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.ui.components.JBLabel; -import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; -import java.util.Arrays; import static com.devoxx.genie.ui.util.DevoxxGenieIcons.DevoxxIcon; import static com.devoxx.genie.ui.util.DevoxxGenieIcons.TrashIcon; +import static java.util.Arrays.*; public class UserPromptPanel extends BackgroundPanel { @@ -36,7 +33,7 @@ public UserPromptPanel(JPanel container, JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.setOpaque(false); - headerPanel.add(createHeaderLabel(chatMessageContext), BorderLayout.WEST); + headerPanel.add(createHeaderLabel(), BorderLayout.WEST); headerPanel.add(createDeleteButton(chatMessageContext), BorderLayout.EAST); // User prompt setup @@ -49,10 +46,8 @@ public UserPromptPanel(JPanel container, /** * Create the header label. - * - * @param chatMessageContext the chat message context */ - private @NotNull JBLabel createHeaderLabel(@NotNull ChatMessageContext chatMessageContext) { + private @NotNull JBLabel createHeaderLabel() { JBLabel createdOnLabel = new JBLabel("DevoxxGenie", DevoxxIcon, SwingConstants.LEFT); createdOnLabel.setFont(createdOnLabel.getFont().deriveFont(12f)); createdOnLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); @@ -80,7 +75,7 @@ public UserPromptPanel(JPanel container, private void removeChat(ChatMessageContext chatMessageContext) { // Get all container components and delete by name - Arrays.stream(container.getComponents()) + stream(container.getComponents()) .filter(c -> c.getName() != null && c.getName().equals(chatMessageContext.getName())) .forEach(container::remove); @@ -88,20 +83,8 @@ private void removeChat(ChatMessageContext chatMessageContext) { container.revalidate(); container.repaint(); - // Broadcast that the chat message has been removed, this way the chat memory can be updated - notifyChatMessageRemoval(chatMessageContext); - } - - /** - * Notify the chat message removal. - * - * @param chatMessageContext the chat message context - */ - private void notifyChatMessageRemoval(ChatMessageContext chatMessageContext) { - // Trigger the chat message change listener - MessageBus bus = ApplicationManager.getApplication().getMessageBus(); - ChatMessageManagementService chatChangeListener = bus.syncPublisher(AppTopics.CHAT_MESSAGES_CHANGED_TOPIC); - chatChangeListener.removeMessagePair(chatMessageContext); + // Remove the chat from memory + ChatMemoryService.getInstance().remove(chatMessageContext); } } diff --git a/src/main/java/com/devoxx/genie/ui/topic/AppTopics.java b/src/main/java/com/devoxx/genie/ui/topic/AppTopics.java index e67335ae..faf61500 100644 --- a/src/main/java/com/devoxx/genie/ui/topic/AppTopics.java +++ b/src/main/java/com/devoxx/genie/ui/topic/AppTopics.java @@ -1,7 +1,6 @@ package com.devoxx.genie.ui.topic; import com.devoxx.genie.ui.listener.ChatMemorySizeListener; -import com.devoxx.genie.ui.listener.ChatMessageManagementService; import com.devoxx.genie.ui.listener.SettingsChangeListener; import com.intellij.util.messages.Topic; @@ -10,9 +9,6 @@ public class AppTopics { public static final Topic SETTINGS_CHANGED_TOPIC = Topic.create("SettingsChanged", SettingsChangeListener.class); - public static final Topic CHAT_MESSAGES_CHANGED_TOPIC = - Topic.create("chatChanged", ChatMessageManagementService.class); - public static final Topic CHAT_MEMORY_SIZE_TOPIC = new Topic<>("CHAT_MEMORY_SIZE_TOPIC", ChatMemorySizeListener.class); } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index ebf41a4c..e97bc5ec 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -32,6 +32,12 @@ ]]> v0.1.18 +
    +
  • Claude 3.5 Sonnet support (Anthropic)
  • +
  • Fix 99: Improved timeout msg
  • +
  • Fix 99: Show timout msg without clicking on the chat window
  • +

v0.1.17

  • Feat: Split settings into different panels underneath Tools menu
  • @@ -214,7 +220,6 @@ -