Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix chat steering shortcut toast

Louis Beaumontfb7725be87b9
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index ff2c733c8..9ae9cdee9 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -2991,7 +2991,7 @@ export function StandaloneChat({
return;
}
- if (isComposerSteerShortcut(e) && !showMentionDropdown) {
+ if (isComposerSteerShortcut(e, isMac) && !showMentionDropdown) {
e.preventDefault();
if (input.trim() || pastedImages.length > 0) {
steerMessage(input.trim());
@@ -5038,13 +5038,6 @@ export function StandaloneChat({
from_queue: !!imageDataUrls,
});
- if (hadActiveReply) {
- toast({
- title: "steering current reply",
- description: "Stopping the current reply and running this now.",
- });
- }
-
return sendPiMessage(trimmed, displayLabel, imageDataUrls);
}
@@ -6270,7 +6263,7 @@ export function StandaloneChat({
role="listitem"
onKeyDown={(e) => {
if (isBusy) return;
- if (isQueuedItemSteerShortcut(e)) {
+ if (isQueuedItemSteerShortcut(e, isMac)) {
e.preventDefault();
steerQueuedPrompt(p);
} else if (isQueuedItemCancelShortcut(e)) {
diff --git a/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts b/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts
index cacb8f45d..56a116d75 100644
--- a/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts
+++ b/apps/screenpipe-app-tauri/lib/__tests__/chat-queue-controls.test.ts
@@ -34,18 +34,23 @@ describe("chat queue controls", () => {
});
it("uses a deliberate modifier shortcut for composer steering", () => {
- expect(isComposerSteerShortcut({ key: "Enter", metaKey: true })).toBe(true);
- expect(isComposerSteerShortcut({ key: "Enter", ctrlKey: true })).toBe(true);
- expect(isComposerSteerShortcut({ key: "Enter" })).toBe(false);
- expect(isComposerSteerShortcut({ key: "Enter", metaKey: true, shiftKey: true })).toBe(false);
- expect(isComposerSteerShortcut({ key: "Enter", metaKey: true, altKey: true })).toBe(false);
+ expect(isComposerSteerShortcut({ key: "Enter", metaKey: true }, true)).toBe(true);
+ expect(isComposerSteerShortcut({ key: "Enter", ctrlKey: true }, true)).toBe(false);
+ expect(isComposerSteerShortcut({ key: "Enter", ctrlKey: true }, false)).toBe(true);
+ expect(isComposerSteerShortcut({ key: "Enter", metaKey: true }, false)).toBe(false);
+ expect(isComposerSteerShortcut({ key: "Enter" }, false)).toBe(false);
+ expect(isComposerSteerShortcut({ key: "Enter", metaKey: true, shiftKey: true }, true)).toBe(false);
+ expect(isComposerSteerShortcut({ key: "Enter", metaKey: true, altKey: true }, true)).toBe(false);
});
it("supports focused queued-item steering and cancellation shortcuts", () => {
- expect(isQueuedItemSteerShortcut({ key: "s" })).toBe(true);
- expect(isQueuedItemSteerShortcut({ key: "S" })).toBe(true);
- expect(isQueuedItemSteerShortcut({ key: "s", metaKey: true })).toBe(false);
- expect(isQueuedItemSteerShortcut({ key: "Enter", ctrlKey: true })).toBe(true);
+ expect(isQueuedItemSteerShortcut({ key: "s" }, true)).toBe(true);
+ expect(isQueuedItemSteerShortcut({ key: "S" }, false)).toBe(true);
+ expect(isQueuedItemSteerShortcut({ key: "s", metaKey: true }, true)).toBe(false);
+ expect(isQueuedItemSteerShortcut({ key: "Enter", metaKey: true }, true)).toBe(true);
+ expect(isQueuedItemSteerShortcut({ key: "Enter", ctrlKey: true }, true)).toBe(false);
+ expect(isQueuedItemSteerShortcut({ key: "Enter", ctrlKey: true }, false)).toBe(true);
+ expect(isQueuedItemSteerShortcut({ key: "Enter", metaKey: true }, false)).toBe(false);
expect(isQueuedItemCancelShortcut({ key: "Delete" })).toBe(true);
expect(isQueuedItemCancelShortcut({ key: "Backspace" })).toBe(true);
diff --git a/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts b/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts
index b7dfb835c..a4d1f5036 100644
--- a/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts
+++ b/apps/screenpipe-app-tauri/lib/chat-queue-controls.ts
@@ -32,17 +32,21 @@ export function normalizeQueueEventPayload<TQueued>(
};
}
-export function isComposerSteerShortcut(event: KeyLike): boolean {
+export function isComposerSteerShortcut(event: KeyLike, isMac: boolean): boolean {
+ const hasPlatformModifier = isMac
+ ? Boolean(event.metaKey && !event.ctrlKey)
+ : Boolean(event.ctrlKey && !event.metaKey);
+
return (
event.key === "Enter" &&
!event.shiftKey &&
!event.altKey &&
- Boolean(event.metaKey || event.ctrlKey)
+ hasPlatformModifier
);
}
-export function isQueuedItemSteerShortcut(event: KeyLike): boolean {
- if (isComposerSteerShortcut(event)) return true;
+export function isQueuedItemSteerShortcut(event: KeyLike, isMac: boolean): boolean {
+ if (isComposerSteerShortcut(event, isMac)) return true;
return (
event.key.toLowerCase() === "s" &&
!event.metaKey &&