Changesets · Branches · Tags · Compare
| Changeset | abb85586e0956b9115db6eb5eb5270352e067b1945c666dea84c8ddb762408f0 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-06-26 21:03 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-06-26 21:03 -07:00 |
| Parents | 6ae8fdd230bd, c286b0a1acf2 |
2 files changed
modified gui/src/pages/gui/Chat.tsx +5 −5
| @@ -42,12 +42,12 @@ | ||
| 42 | 42 | setDialogMessage, |
| 43 | 43 | setShowDialog, |
| 44 | 44 | } from "../../redux/slices/uiSlice"; |
| 45 | -import { cancelStream } from "../../redux/thunks/cancelStream"; | |
| 46 | 45 | import { streamEditThunk } from "../../redux/thunks/edit"; |
| 47 | 46 | import { loadLastSession } from "../../redux/thunks/session"; |
| 48 | 47 | import { streamResponseThunk } from "../../redux/thunks/streamResponse"; |
| 49 | 48 | import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util"; |
| 50 | 49 | |
| 50 | +import { cancelStream } from "../../redux/thunks/cancelStream"; | |
| 51 | 51 | import { getLocalStorage, setLocalStorage } from "../../util/localStorage"; |
| 52 | 52 | import { EmptyChatBody } from "./EmptyChatBody"; |
| 53 | 53 | import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; |
| @@ -125,14 +125,14 @@ | ||
| 125 | 125 | |
| 126 | 126 | useEffect(() => { |
| 127 | 127 | // Cmd + Backspace to delete current step |
| 128 | - const listener = (e: any) => { | |
| 128 | + const listener = (e: KeyboardEvent) => { | |
| 129 | 129 | if ( |
| 130 | 130 | e.key === "Backspace" && |
| 131 | 131 | (jetbrains ? e.altKey : isMetaEquivalentKeyPressed(e)) && |
| 132 | 132 | !e.shiftKey |
| 133 | 133 | ) { |
| 134 | - dispatch(cancelStream()); | |
| 135 | - ideMessenger.post("rejectDiff", {}); // just always cancel, if not in applying won't matter | |
| 134 | + void dispatch(cancelStream()); | |
| 135 | + if (isInEdit) ideMessenger.post("rejectDiff", {}); | |
| 136 | 136 | } |
| 137 | 137 | }; |
| 138 | 138 | window.addEventListener("keydown", listener); |
| @@ -140,7 +140,7 @@ | ||
| 140 | 140 | return () => { |
| 141 | 141 | window.removeEventListener("keydown", listener); |
| 142 | 142 | }; |
| 143 | - }, [isStreaming, jetbrains]); | |
| 143 | + }, [isStreaming, jetbrains, isInEdit]); | |
| 144 | 144 | |
| 145 | 145 | const { widget, highlights } = useFindWidget( |
| 146 | 146 | stepsDivRef, |
modified gui/src/util/index.ts +5 −5
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | import { MessageModes, ModelDescription } from "core"; |
| 2 | 2 | import { ProfileDescription } from "core/config/ProfileLifecycleManager"; |
| 3 | -import _ from "lodash"; | |
| 4 | -import { KeyboardEvent } from "react"; | |
| 5 | -import { getLocalStorage } from "./localStorage"; | |
| 6 | 3 | import { |
| 7 | - DEFAULT_CHAT_SYSTEM_MESSAGE, | |
| 8 | 4 | DEFAULT_AGENT_SYSTEM_MESSAGE, |
| 5 | + DEFAULT_CHAT_SYSTEM_MESSAGE, | |
| 9 | 6 | } from "core/llm/constructMessages"; |
| 7 | +import _ from "lodash"; | |
| 8 | +import { KeyboardEvent as ReactKeyboardEvent } from "react"; | |
| 9 | +import { getLocalStorage } from "./localStorage"; | |
| 10 | 10 | |
| 11 | 11 | export type Platform = "mac" | "linux" | "windows" | "unknown"; |
| 12 | 12 | |
| @@ -26,7 +26,7 @@ | ||
| 26 | 26 | export function isMetaEquivalentKeyPressed({ |
| 27 | 27 | metaKey, |
| 28 | 28 | ctrlKey, |
| 29 | -}: KeyboardEvent): boolean { | |
| 29 | +}: KeyboardEvent | ReactKeyboardEvent): boolean { | |
| 30 | 30 | const platform = getPlatform(); |
| 31 | 31 | switch (platform) { |
| 32 | 32 | case "mac": |