fciannella commited on
Commit
88326b7
·
1 Parent(s): 0f2bb6a

Added modal with Disclaimer

Browse files
examples/voice_agent_webrtc_langgraph/ui/src/App.tsx CHANGED
@@ -20,6 +20,8 @@ function App() {
20
  const [selectedAssistant, setSelectedAssistant] = useState<string | null>(null);
21
  const [selectedAssistantName, setSelectedAssistantName] = useState<string>("Speech to Speech Demo");
22
  const [rtcConfig, setRtcConfig] = useState<ConstructorParameters<typeof RTCPeerConnection>[0]>({});
 
 
23
 
24
  const webRTC = usePipecatWebRTC({
25
  url: RTC_OFFER_URL,
@@ -107,8 +109,67 @@ function App() {
107
  }
108
  }, [webRTC.status]); // Triggers immediately when status becomes "connected"
109
 
 
 
 
 
 
 
110
  return (
111
  <div className="h-screen flex flex-col">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  <header className="bg-black p-6 flex items-center">
113
  <img src="logo_mm.png" alt="NVIDIA ACE Logo" className="h-16 mr-8" />
114
  <div className="flex-1 flex justify-center">
 
20
  const [selectedAssistant, setSelectedAssistant] = useState<string | null>(null);
21
  const [selectedAssistantName, setSelectedAssistantName] = useState<string>("Speech to Speech Demo");
22
  const [rtcConfig, setRtcConfig] = useState<ConstructorParameters<typeof RTCPeerConnection>[0]>({});
23
+ const [showDisclaimer, setShowDisclaimer] = useState<boolean>(true);
24
+ const [disclaimerAgreed, setDisclaimerAgreed] = useState<boolean>(false);
25
 
26
  const webRTC = usePipecatWebRTC({
27
  url: RTC_OFFER_URL,
 
109
  }
110
  }, [webRTC.status]); // Triggers immediately when status becomes "connected"
111
 
112
+ const handleDisclaimerContinue = () => {
113
+ if (disclaimerAgreed) {
114
+ setShowDisclaimer(false);
115
+ }
116
+ };
117
+
118
  return (
119
  <div className="h-screen flex flex-col">
120
+ {/* Disclaimer Modal */}
121
+ {showDisclaimer && (
122
+ <div className="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4">
123
+ <div className="bg-white rounded-lg shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-y-auto">
124
+ <div className="p-6 md:p-8">
125
+ <h2 className="text-2xl font-bold text-gray-900 mb-4">
126
+ Healthcare Agent – Demo & Disclaimer
127
+ </h2>
128
+ <div className="text-gray-700 space-y-4 mb-6">
129
+ <p>
130
+ This is a <strong>demo for educational purposes only</strong>. It is not medical advice,
131
+ a diagnosis, or a treatment tool, and it is not a medical device. The agent's responses
132
+ are generated by AI and may be incorrect, incomplete, harmful, or offensive. Do not share
133
+ personal or protected health information. No patient–provider relationship is created.
134
+ </p>
135
+ <p>
136
+ You are responsible for how you use the demo. We make no warranties and accept no liability
137
+ for actions taken based on the agent's responses. For medical concerns, consult a qualified
138
+ clinician. In an emergency, call 911 (or your local equivalent).
139
+ </p>
140
+ <p>
141
+ By continuing, you confirm you are 18+ and agree to our Terms and this Disclaimer.
142
+ </p>
143
+ </div>
144
+ <div className="mb-6">
145
+ <label className="flex items-start cursor-pointer">
146
+ <input
147
+ type="checkbox"
148
+ checked={disclaimerAgreed}
149
+ onChange={(e) => setDisclaimerAgreed(e.target.checked)}
150
+ className="mt-1 mr-3 h-5 w-5 text-nvidia border-gray-300 rounded focus:ring-nvidia"
151
+ />
152
+ <span className="text-gray-900 font-medium">
153
+ I understand and agree
154
+ </span>
155
+ </label>
156
+ </div>
157
+ <button
158
+ onClick={handleDisclaimerContinue}
159
+ disabled={!disclaimerAgreed}
160
+ className={`w-full py-3 px-6 rounded-lg font-semibold transition-colors ${
161
+ disclaimerAgreed
162
+ ? "bg-nvidia text-black hover:bg-nvidia/90 cursor-pointer"
163
+ : "bg-gray-300 text-gray-500 cursor-not-allowed"
164
+ }`}
165
+ >
166
+ Continue
167
+ </button>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ )}
172
+
173
  <header className="bg-black p-6 flex items-center">
174
  <img src="logo_mm.png" alt="NVIDIA ACE Logo" className="h-16 mr-8" />
175
  <div className="flex-1 flex justify-center">