To prevent multiple inputs to the Salesforce Agentforce when using Messaging for Web feature, we can make use of enableUserInputForConversationWithBot.
When embeddedservice_bootstrap.settings.enableUserInputForConversationWithBot is set to false, end users won’t be able to send multiple messages until the Agentforce Agent responds back. This prevents visitors sending multiple chat messages at the same time.
Sample Code:
embeddedservice_bootstrap.settings.enableUserInputForConversationWithBot = false;
If you are using Salesforce Experience Cloud site, then add the following code snippet in your Head Markup.
<script>
window.addEventListener(
"onEmbeddedMessagingReady", () => {
console.log(
'Inside Messaging Ready Block'
);
embeddedservice_bootstrap.settings.enableUserInputForConversationWithBot = false;
}
);
</script>

Also, on the Content Security Policy (CSP), set the Security Level to “Relaxed CSP: Permit Access to Inline Scripts and Allowed Hosts”.

Publish the Experience Cloud Site. Test it from the Experience Cloud Site once it is published.
If you are using the Salesforce Messaging for Web Code snippet in your third party website, add it in the try block of initEmbeddedMessaging() method.

Output:
When the user sends a message, the input field to send the message will be disabled until the Agentforce Agents response is received.

Reference Article: