Fix composer send shortcut conflicts
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type { MessagePayload } from "@/composer/types";
|
||||
|
||||
export type SendBehavior = "interrupt" | "queue";
|
||||
|
||||
interface SendActionContext {
|
||||
defaultSendBehavior: SendBehavior;
|
||||
isAgentRunning: boolean;
|
||||
onQueue: ((payload: MessagePayload) => void) | undefined;
|
||||
handleSendMessage: () => void;
|
||||
handleQueueMessage: () => void;
|
||||
}
|
||||
|
||||
export function computeCanStartDictation(input: {
|
||||
client: DaemonClient | null;
|
||||
@@ -12,3 +23,21 @@ export function computeCanStartDictation(input: {
|
||||
socketConnected && readyForDictation && !input.disabled && !input.dictationUnavailableMessage
|
||||
);
|
||||
}
|
||||
|
||||
export function runDefaultSendAction(ctx: SendActionContext): void {
|
||||
if (ctx.defaultSendBehavior === "queue" && ctx.isAgentRunning && ctx.onQueue) {
|
||||
ctx.handleQueueMessage();
|
||||
return;
|
||||
}
|
||||
ctx.handleSendMessage();
|
||||
}
|
||||
|
||||
export function runAlternateSendAction(ctx: SendActionContext): void {
|
||||
if (ctx.defaultSendBehavior === "queue") {
|
||||
ctx.handleSendMessage();
|
||||
return;
|
||||
}
|
||||
if (ctx.isAgentRunning && ctx.onQueue) {
|
||||
ctx.handleQueueMessage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user