Skip to content

Commit

Permalink
fix: chat reset button state when current conversation not properly c…
Browse files Browse the repository at this point in the history
…onfigured (fixes #651)
  • Loading branch information
carlrobertoh committed Aug 13, 2024
1 parent c6e4d5f commit 1d7f3e8
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import ee.carlrobert.codegpt.actions.ActionType;
import ee.carlrobert.codegpt.actions.editor.EditorActionsUtil;
import ee.carlrobert.codegpt.conversations.ConversationsState;
import ee.carlrobert.codegpt.telemetry.TelemetryAction;
import org.jetbrains.annotations.NotNull;

public class ClearChatWindowAction extends AnAction {
public class ClearChatWindowAction extends DumbAwareAction {

private final Runnable onActionPerformed;

Expand All @@ -20,14 +19,6 @@ public ClearChatWindowAction(Runnable onActionPerformed) {
EditorActionsUtil.registerAction(this);
}

@Override
public void update(@NotNull AnActionEvent event) {
super.update(event);
var currentConversation = ConversationsState.getCurrentConversation();
var isEnabled = currentConversation != null && !currentConversation.getMessages().isEmpty();
event.getPresentation().setEnabled(isEnabled);
}

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
try {
Expand Down

0 comments on commit 1d7f3e8

Please sign in to comment.