fix: add number key support to approval dialogs (#821)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -114,6 +114,17 @@ export const InlineBashApproval = memo(
|
||||
if (key.escape) {
|
||||
// Cancel (queue denial, return to input)
|
||||
onCancel?.();
|
||||
return;
|
||||
}
|
||||
|
||||
// Number keys for quick selection (only for fixed options, not custom text input)
|
||||
if (input === "1") {
|
||||
onApprove();
|
||||
return;
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways("project");
|
||||
return;
|
||||
}
|
||||
},
|
||||
{ isActive: isFocused },
|
||||
|
||||
@@ -276,6 +276,20 @@ export const InlineFileEditApproval = memo(
|
||||
}
|
||||
if (key.escape) {
|
||||
onCancel?.();
|
||||
return;
|
||||
}
|
||||
|
||||
// Number keys for quick selection (only for fixed options, not custom text input)
|
||||
if (input === "1") {
|
||||
onApprove(diffsToPass.size > 0 ? diffsToPass : undefined);
|
||||
return;
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways(
|
||||
"project",
|
||||
diffsToPass.size > 0 ? diffsToPass : undefined,
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
{ isActive: isFocused },
|
||||
|
||||
@@ -127,6 +127,17 @@ export const InlineGenericApproval = memo(
|
||||
}
|
||||
if (key.escape) {
|
||||
onCancel?.();
|
||||
return;
|
||||
}
|
||||
|
||||
// Number keys for quick selection (only for fixed options, not custom text input)
|
||||
if (input === "1") {
|
||||
onApprove();
|
||||
return;
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways("project");
|
||||
return;
|
||||
}
|
||||
},
|
||||
{ isActive: isFocused },
|
||||
|
||||
@@ -109,6 +109,17 @@ export const InlineTaskApproval = memo(
|
||||
}
|
||||
if (key.escape) {
|
||||
onCancel?.();
|
||||
return;
|
||||
}
|
||||
|
||||
// Number keys for quick selection (only for fixed options, not custom text input)
|
||||
if (input === "1") {
|
||||
onApprove();
|
||||
return;
|
||||
}
|
||||
if (input === "2" && allowPersistence) {
|
||||
onApproveAlways("session");
|
||||
return;
|
||||
}
|
||||
},
|
||||
{ isActive: isFocused },
|
||||
|
||||
@@ -100,6 +100,17 @@ export const StaticPlanApproval = memo(
|
||||
}
|
||||
if (key.escape) {
|
||||
onKeepPlanning("User cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
// Number keys for quick selection (only for fixed options, not custom text input)
|
||||
if (input === "1") {
|
||||
onApproveAndAcceptEdits();
|
||||
return;
|
||||
}
|
||||
if (input === "2") {
|
||||
onApprove();
|
||||
return;
|
||||
}
|
||||
},
|
||||
{ isActive: isFocused },
|
||||
|
||||
Reference in New Issue
Block a user