diff --git a/packages/app/src/components/agent-input-area.tsx b/packages/app/src/components/agent-input-area.tsx index 9918bcf7c..d91941be5 100644 --- a/packages/app/src/components/agent-input-area.tsx +++ b/packages/app/src/components/agent-input-area.tsx @@ -101,12 +101,12 @@ export function AgentInputArea({ agentId, serverId }: AgentInputAreaProps) { }), [] ); - const noopSendAgentMessage = useCallback(async () => {}, []); - const noopSendAgentAudio = useCallback(async () => {}, []); - const noopCancelAgentRun = useCallback(() => {}, []); - const noopGetDraftInput = useCallback(() => undefined, []); - const noopSaveDraftInput = useCallback(() => {}, []); - const noopSetQueuedMessages = useCallback(() => {}, []); + const noopSendAgentMessage = useCallback(async () => {}, []); + const noopSendAgentAudio = useCallback(async () => {}, []); + const noopCancelAgentRun = useCallback(() => {}, []); + const noopGetDraftInput = useCallback(() => undefined, []); + const noopSaveDraftInput = useCallback(() => {}, []); + const noopSetQueuedMessages = useCallback(() => {}, []); const ws = session?.ws ?? inertWebSocket; const sendAgentMessage = session?.sendAgentMessage ?? noopSendAgentMessage; const sendAgentAudio = session?.sendAgentAudio ?? noopSendAgentAudio; @@ -380,7 +380,7 @@ export function AgentInputArea({ agentId, serverId }: AgentInputAreaProps) { setIsProcessing(true); try { - await sendAgentMessage(agentId, message, imageAttachments); + await sendAgentMessage(agentIdRef.current, message, imageAttachments); } catch (error) { console.error("[AgentInput] Failed to send message:", error); } finally { @@ -662,7 +662,7 @@ export function AgentInputArea({ agentId, serverId }: AgentInputAreaProps) { const updateQueue = useCallback( (updater: (current: QueuedMessage[]) => QueuedMessage[]) => { - setQueuedMessagesByAgent((prev) => { + setQueuedMessagesByAgent((prev: Map) => { const next = new Map(prev); next.set(agentId, updater(prev.get(agentId) ?? [])); return next; @@ -831,7 +831,7 @@ export function AgentInputArea({ agentId, serverId }: AgentInputAreaProps) { return; } setIsCancellingAgent(true); - cancelAgentRun(agentId); + cancelAgentRun(agentIdRef.current); } function handleQueueCurrentInput() { @@ -866,7 +866,7 @@ export function AgentInputArea({ agentId, serverId }: AgentInputAreaProps) { // Cancels current agent run before sending queued prompt handleCancelAgent(); - await sendAgentMessage(agentId, item.text, item.images); + await sendAgentMessage(agentIdRef.current, item.text, item.images); } const realtimeButton = (