Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(calls): read a spoken yes or no through spokenConsent in Take turns and room calls

yofizane0dfb1061d257
diff --git a/src/components/CallView.tsx b/src/components/CallView.tsx
index 98a543d30d..59f4b2f4ce 100644
--- a/src/components/CallView.tsx
+++ b/src/components/CallView.tsx
@@ -10,7 +10,7 @@ import { cn } from "@/lib/cn";
import { useMenuMotion } from "./MenuMotion";
import { currentCall, deferCallCleanup, endCall, startCall, useOnCall } from "@/lib/call";
import { CALL_MODES, callModeHint, effectiveCallMode, setCallMode, useCallMode, type CallMode } from "@/lib/call-mode";
-import { NO, YES } from "../../shared/call-consent";
+import { spokenConsent } from "../../shared/call-consent";
import { dismissStartPrompt, hangUpLiveCall, isLiveCallRunning, startLiveCall, useLiveMedia } from "@/lib/live-call-media";
import { t } from "@/lib/i18n";
import { speaker } from "@/lib/tts";
@@ -588,8 +588,9 @@ function Call({ bot }: { bot: Bot }) {
hush();
return;
}
- if (YES.test(said) || NO.test(said)) {
- const allow = YES.test(said);
+ const decision = spokenConsent(said, "turns");
+ if (decision) {
+ const allow = decision === "allow";
if (allow && open.skill) {
setHeard("");
void sayThenListen("Open this chat to review the complete skill before approving it. You can say no now to deny it.");
diff --git a/src/components/GroupCallView.tsx b/src/components/GroupCallView.tsx
index 000dda7eba..b706d4fcca 100644
--- a/src/components/GroupCallView.tsx
+++ b/src/components/GroupCallView.tsx
@@ -20,9 +20,7 @@ import { CALL_ENDPOINT_MS, speechBridge } from "@/lib/speech";
import { useDesktopCapabilities } from "./DesktopCapabilities";
import { isRoutineApproval, isSkillApproval, pendingApprovals, spokenApprovalPrompt } from "./PendingApproval";
import { titledCard } from "./ApprovalCard";
-
-const YES = /^(yes|yeah|yep|yup|sure|ok|okay|go ahead|do it|allow|approve|approved|fine|please do)\b/i;
-const NO = /^(no|nope|don'?t|do not|stop|deny|denied|cancel|never|skip it)\b/i;
+import { spokenConsent } from "../../shared/call-consent";
type Phase = "listening" | "sending" | "working" | "speaking";
@@ -237,8 +235,9 @@ function GroupCall({ group, members }: { group: Group; members: Bot[] }) {
hush();
return;
}
- if (YES.test(said) || NO.test(said)) {
- const allow = YES.test(said);
+ const decision = spokenConsent(said, "turns");
+ if (decision) {
+ const allow = decision === "allow";
if (allow && openApproval.skill) {
setHeard("");
enqueueSpeech(