Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New branch vercell at 100 #15

Open
wants to merge 158 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
04297de
Update App.jsx
damonkost Jan 17, 2025
94f8aa3
Update App.jsx
damonkost Jan 18, 2025
a94c146
Update App.jsx
damonkost Jan 18, 2025
161c01f
Update App.jsx
damonkost Jan 18, 2025
ad6c2b8
Update App.jsx
damonkost Jan 18, 2025
226350f
Update App.jsx
damonkost Jan 18, 2025
09e6b94
Update App.jsx
damonkost Jan 18, 2025
cf92f76
Update App.jsx
damonkost Jan 18, 2025
956aa81
Update App.jsx
damonkost Jan 18, 2025
e4fb989
Update package.json
damonkost Jan 18, 2025
caa3d26
Update package.json
damonkost Jan 18, 2025
23c13d8
Update package.json
damonkost Jan 18, 2025
d3d234d
Update package.json
damonkost Jan 18, 2025
0406d1b
Update package.json
damonkost Jan 18, 2025
53b47e3
Update package.json
damonkost Jan 18, 2025
330c136
Update package.json
damonkost Jan 18, 2025
b1dddbf
Update package.json
damonkost Jan 18, 2025
77c1f9c
Update package.json
damonkost Jan 18, 2025
cdc8547
Update package.json
damonkost Jan 18, 2025
7e52bd7
Update package.json
damonkost Jan 18, 2025
7495afe
Update App.jsx
damonkost Jan 18, 2025
bf01cf9
Update App.jsx
damonkost Jan 18, 2025
e427a10
Update App.jsx
damonkost Jan 18, 2025
8e478af
Update package.json
damonkost Jan 18, 2025
36a25ab
Update App.jsx
damonkost Jan 18, 2025
48fa6e6
Update App.jsx
damonkost Jan 18, 2025
a7071ae
Update App.jsx
damonkost Jan 18, 2025
20e165b
Update App.jsx
damonkost Jan 18, 2025
45c3478
Update App.jsx
damonkost Jan 18, 2025
f846970
Update App.jsx
damonkost Jan 18, 2025
4e7907c
Update App.jsx
damonkost Jan 18, 2025
9ca6737
Update App.jsx
damonkost Jan 18, 2025
c37ebe3
Update Button.jsx
damonkost Jan 18, 2025
11813ea
Update App.jsx
damonkost Jan 18, 2025
db7794a
Update Button.jsx
damonkost Jan 18, 2025
d5fe181
Update Button.jsx
damonkost Jan 18, 2025
7d1c8de
Update Button.jsx
damonkost Jan 18, 2025
a22d438
Update Button.jsx
damonkost Jan 18, 2025
2d91966
Update Button.jsx
damonkost Jan 18, 2025
eb3a3b5
Update Button.jsx
damonkost Jan 18, 2025
7e25ab1
Update Button.jsx
damonkost Jan 18, 2025
0e00fe8
Update Button.jsx
damonkost Jan 18, 2025
d0c340d
Update Button.jsx
damonkost Jan 18, 2025
e13710f
Update Button.jsx
damonkost Jan 18, 2025
5c94fcd
Update Button.jsx
damonkost Jan 18, 2025
a87bf07
Update Button.jsx
damonkost Jan 18, 2025
4150caf
Update Button.jsx
damonkost Jan 18, 2025
46d9122
Update Button.jsx
damonkost Jan 18, 2025
1c6afd6
Update Button.jsx
damonkost Jan 18, 2025
e5527c8
Update Button.jsx
damonkost Jan 18, 2025
0853b33
Update Button.jsx
damonkost Jan 18, 2025
50f430a
Update index.css
damonkost Jan 18, 2025
420cbee
Update Button.jsx
damonkost Jan 18, 2025
3b237c0
Update Button.jsx
damonkost Jan 18, 2025
6e0afec
Update Button.jsx
damonkost Jan 18, 2025
bd33144
Update Button.jsx
damonkost Jan 18, 2025
56451e3
Update Button.jsx
damonkost Jan 18, 2025
7649dea
Update index.html
damonkost Jan 20, 2025
7aabc47
Update index.css
damonkost Jan 20, 2025
eea3c53
Update index.js
damonkost Jan 20, 2025
d33755f
Update index.html
damonkost Jan 20, 2025
c2df821
Update index.js
damonkost Jan 20, 2025
3201364
Update index.js
damonkost Jan 20, 2025
40bf12f
Update index.js
damonkost Jan 20, 2025
cc81b3e
Update index.html
damonkost Jan 20, 2025
cb0a555
Update index.html
damonkost Jan 20, 2025
c5be67a
Update App.jsx
damonkost Jan 20, 2025
d308c50
Update App.jsx
damonkost Jan 20, 2025
92f0350
Update index.js
damonkost Jan 20, 2025
d234876
Update Button.jsx
damonkost Jan 20, 2025
fa61d90
Update index.html
damonkost Jan 20, 2025
8a139dd
Update index.js
damonkost Jan 20, 2025
72be274
Update Button.jsx
damonkost Jan 20, 2025
41c52dd
Update Button.jsx
damonkost Jan 20, 2025
8e58b2c
Update Button.jsx
damonkost Jan 20, 2025
2ea3883
Update index.html
damonkost Jan 20, 2025
942e372
Update index.html
damonkost Jan 20, 2025
06829fe
Update index.html
damonkost Jan 20, 2025
1db6e60
Update index.css
damonkost Jan 20, 2025
fa52716
Update index.css
damonkost Jan 20, 2025
80fdac2
Update index.css
damonkost Jan 20, 2025
30cc390
Update index.html
damonkost Jan 20, 2025
e7b3392
Update index.css
damonkost Jan 20, 2025
0441d65
Update index.css
damonkost Jan 20, 2025
133093b
Update index.html
damonkost Jan 20, 2025
228c297
Update Button.jsx
damonkost Jan 20, 2025
773d30f
Update index.css
damonkost Jan 20, 2025
f2a46a0
Update index.css
damonkost Jan 20, 2025
d50f56c
Update index.css
damonkost Jan 20, 2025
b11acd7
Update Button.jsx
damonkost Jan 20, 2025
77bb327
Update Button.jsx
damonkost Jan 20, 2025
79f9613
Update Button.jsx
damonkost Jan 20, 2025
e6449c9
Update App.jsx
damonkost Jan 20, 2025
ac6be4c
Update App.jsx
damonkost Jan 20, 2025
8ef01a3
Update index.css
damonkost Jan 20, 2025
cd36f59
Update index.css
damonkost Jan 20, 2025
b3a61c3
Update index.css
damonkost Jan 20, 2025
55d4730
Update index.css
damonkost Jan 20, 2025
4a6bbcb
Update index.css
damonkost Jan 20, 2025
80ae8ae
Update index.css
damonkost Jan 20, 2025
ec88c14
Update index.css
damonkost Jan 20, 2025
99a7126
Update index.css
damonkost Jan 20, 2025
67a734b
Update index.css
damonkost Jan 20, 2025
cf02244
Update index.css
damonkost Jan 20, 2025
af5afde
Update index.css
damonkost Jan 20, 2025
702f384
Update index.css
damonkost Jan 20, 2025
42aca84
Update index.css
damonkost Jan 20, 2025
c416822
Update Button.jsx
damonkost Jan 20, 2025
474303a
Update Button.jsx
damonkost Jan 20, 2025
e57038d
Update Button.jsx
damonkost Jan 20, 2025
0a22551
Update Button.jsx
damonkost Jan 20, 2025
3b823dc
Update index.html
damonkost Jan 20, 2025
7129e1d
Update index.css
damonkost Jan 20, 2025
9a70598
Update index.css
damonkost Jan 20, 2025
fbb6a8b
Update index.html
damonkost Jan 20, 2025
1a23206
Update index.html
damonkost Jan 20, 2025
8e88c8d
Update index.css
damonkost Jan 20, 2025
b3b3447
Update index.css
damonkost Jan 20, 2025
1f3db5f
Update index.css
damonkost Jan 20, 2025
2936ea3
Update index.css
damonkost Jan 20, 2025
dfb7858
Update Button.jsx
damonkost Jan 20, 2025
e80f866
Update Button.jsx
damonkost Jan 20, 2025
18bd30a
Update index.css
damonkost Jan 20, 2025
e06369f
Update index.css
damonkost Jan 20, 2025
129b68b
Update index.css
damonkost Jan 20, 2025
ae760e2
Update index.css
damonkost Jan 20, 2025
e4bfe77
Update index.css
damonkost Jan 20, 2025
2c7f334
Update Button.jsx
damonkost Jan 20, 2025
447e525
Update App.jsx
damonkost Jan 20, 2025
589258b
Update App.jsx
damonkost Jan 20, 2025
ea0e628
Update App.jsx
damonkost Jan 20, 2025
ba68259
Update App.jsx
damonkost Jan 20, 2025
9d3c8bb
Update index.css
damonkost Jan 20, 2025
b885655
Update index.html
damonkost Jan 20, 2025
d229290
Update App.jsx
damonkost Jan 20, 2025
7142aa5
Update index.css
damonkost Jan 20, 2025
d986d15
Update Button.jsx
damonkost Jan 20, 2025
9fc97db
Update Button.jsx
damonkost Jan 20, 2025
7bead32
Update Button.jsx
damonkost Jan 20, 2025
084a8e4
Update Button.jsx
damonkost Jan 20, 2025
2fb98de
Update Button.jsx
damonkost Jan 20, 2025
81771e5
Update Button.jsx
damonkost Jan 20, 2025
bd9b605
Update ActiveCallDetail.jsx
damonkost Jan 20, 2025
b2f4c19
Update index.css
damonkost Jan 21, 2025
6f38863
Update index.css
damonkost Jan 21, 2025
3e2ade9
Update index.css
damonkost Jan 21, 2025
88d8f58
Update index.css
damonkost Jan 21, 2025
9c4b5a9
Update index.css
damonkost Jan 21, 2025
2256daf
Update index.css
damonkost Jan 21, 2025
d0cbfc8
Update index.css
damonkost Jan 21, 2025
01df406
Update index.css
damonkost Jan 21, 2025
eb27e01
Update index.css
damonkost Jan 21, 2025
47b2b7f
Update index.css
damonkost Jan 21, 2025
eea6c83
Update index.css
damonkost Jan 21, 2025
7927e1c
Update index.css
damonkost Jan 21, 2025
6975032
Update index.css
damonkost Jan 21, 2025
d42be16
Update Button.jsx
damonkost Jan 21, 2025
391b1f1
updated hero message and style html
damonkost Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 39 additions & 19 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="description" content="Vapi Web Quickstart" />
<link rel="icon" href="https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/Zf7Uh2x67Yz3nEftEH2i/pub/CGUchpsfP4hSCQZJI1dr.gif" />
<meta name="description" content="LegalScout AI" />

<!-- Inter Font -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap"
rel="stylesheet"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap" rel="stylesheet" />

<title>Vapi Web Quickstart</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
<link rel="stylesheet" href="index.css" />

<title>LegalScout AI</title>
</head>
<body>
<header>
<nav>
<div class="logo-container">
<img class="logo" src="https://res.cloudinary.com/glide/image/fetch/f_auto,c_limit/https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Fglide-prod.appspot.com%2Fo%2Ficon-images%252Fanonymous-4ec86c98-f143-4160-851d-892f167b223c.png%3Falt%3Dmedia%26token%3Dcdc26513-26ae-48f6-b085-85b8bb806c4c" alt="LegalScout Logo" />
</div>
<div class="nav-links">
<a href="https://legalscout.ai/dl/Home">Home</a>
<a href="https://legalscout.ai/dl/Cases">My Cases</a>
<a href="https://legalscout.ai/dl/About">About</a>
</div>
</nav>
</header>

<main class="hero">
<div class="statement">
<h1 class="gradient-text">✨ Legal Help, Simplified ✨</h1>
<p>Don't navigate the legal system alone! 😓 LegalScout AI is your guide. Tell us about your case, and we'll connect you with the perfect attorney.</p>
<p>Get matched with lawyers who are experienced, available, and eager to take your case. 💪</p>
<p>See our <a href="https://legalscout.ai/dl/Terms">Terms & Conditions</a>.</p>
<button class="call-button">Call Scout</button>
</div>
</main>

<script src="index.js"></script>
</body>
</html>
185 changes: 76 additions & 109 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,104 @@ import Vapi from "@vapi-ai/web";
import { isPublicKeyMissingError } from "./utils";

// Put your Vapi Public Key below.
const vapi = new Vapi("0000XXXX-XXXX-XXXX-XXXX-XXXXXXXX0000");
const vapi = new Vapi("310f0d43-27c2-47a5-a76d-e55171d024f7"); // Replace with your actual public key

const App = () => {
const [connecting, setConnecting] = useState(false);
const [connected, setConnected] = useState(false);

const [assistantIsSpeaking, setAssistantIsSpeaking] = useState(false);
const [volumeLevel, setVolumeLevel] = useState(0);
const [microphoneAllowed, setMicrophoneAllowed] = useState(false); // Add state for microphone permission

const { showPublicKeyInvalidMessage, setShowPublicKeyInvalidMessage } = usePublicKeyInvalid();

// hook into Vapi events
useEffect(() => {
vapi.on("call-start", () => {
const handleCallStart = () => {
setConnecting(false);
setConnected(true);

setShowPublicKeyInvalidMessage(false);
});
};

vapi.on("call-end", () => {
const handleCallEnd = () => {
setConnecting(false);
setConnected(false);

setShowPublicKeyInvalidMessage(false);
});
};

vapi.on("speech-start", () => {
const handleSpeechStart = () => {
setAssistantIsSpeaking(true);
});
};

vapi.on("speech-end", () => {
const handleSpeechEnd = () => {
setAssistantIsSpeaking(false);
});
};

vapi.on("volume-level", (level) => {
const handleVolumeLevel = (level) => {
setVolumeLevel(level);
});
};

vapi.on("error", (error) => {
const handleError = (error) => {
console.error(error);

setConnecting(false);
if (isPublicKeyMissingError({ vapiError: error })) {
setShowPublicKeyInvalidMessage(true);
}
});

// we only want this to fire on mount
};

// Add event listeners
vapi.on("call-start", handleCallStart);
vapi.on("call-end", handleCallEnd);
vapi.on("speech-start", handleSpeechStart);
vapi.on("speech-end", handleSpeechEnd);
vapi.on("volume-level", handleVolumeLevel);
vapi.on("error", handleError);

// Clean up event listeners on unmount
return () => {
vapi.off("call-start", handleCallStart);
vapi.off("call-end", handleCallEnd);
vapi.off("speech-start", handleSpeechStart);
vapi.off("speech-end", handleSpeechEnd);
vapi.off("volume-level", handleVolumeLevel);
vapi.off("error", handleError);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// call start handler
const startCallInline = () => {
const startCallInline = async () => {
setConnecting(true);
vapi.start(assistantOptions);

try {
// Request microphone access
await navigator.mediaDevices.getUserMedia({ audio: true });
setMicrophoneAllowed(true);

const assistantOverrides = {
transcriber: {
provider: "deepgram",
model: "nova-2",
language: "en-US",
},
recordingEnabled: true,
// Add any other overrides you need here, like:
// endCallOnNoSpeech: false, // Disable automatic end on no speech
// maxDuration: 3600, // Set a longer max duration (in seconds)
};

vapi.start('e3fff1dd-2e82-4cce-ac6c-8c3271eb0865', assistantOverrides);
} catch (error) {
console.error("Error accessing microphone:", error);
setConnecting(false);
// Handle microphone access errors (e.g., display an error message)
}
};

const endCall = () => {
vapi.stop();
};
Expand All @@ -79,9 +120,11 @@ const App = () => {
>
{!connected ? (
<Button
label="Call Vapi’s Pizza Front Desk"
label="Call Scout"
onClick={startCallInline}
isLoading={connecting}
disabled={!microphoneAllowed} // Disable button if mic access is not allowed
icon={<LegalScoutIcon />}
/>
) : (
<ActiveCallDetail
Expand All @@ -92,69 +135,18 @@ const App = () => {
)}

{showPublicKeyInvalidMessage ? <PleaseSetYourPublicKeyMessage /> : null}
<ReturnToDocsLink />
</div>
);
};

const assistantOptions = {
name: "Vapi’s Pizza Front Desk",
firstMessage: "Vappy’s Pizzeria speaking, how can I help you?",
transcriber: {
provider: "deepgram",
model: "nova-2",
language: "en-US",
},
voice: {
provider: "playht",
voiceId: "jennifer",
},
model: {
provider: "openai",
model: "gpt-4",
messages: [
{
role: "system",
content: `You are a voice assistant for Vappy’s Pizzeria, a pizza shop located on the Internet.

Your job is to take the order of customers calling in. The menu has only 3 types
of items: pizza, sides, and drinks. There are no other types of items on the menu.

1) There are 3 kinds of pizza: cheese pizza, pepperoni pizza, and vegetarian pizza
(often called "veggie" pizza).
2) There are 3 kinds of sides: french fries, garlic bread, and chicken wings.
3) There are 2 kinds of drinks: soda, and water. (if a customer asks for a
brand name like "coca cola", just let them know that we only offer "soda")

Customers can only order 1 of each item. If a customer tries to order more
than 1 item within each category, politely inform them that only 1 item per
category may be ordered.

Customers must order 1 item from at least 1 category to have a complete order.
They can order just a pizza, or just a side, or just a drink.

Be sure to introduce the menu items, don't assume that the caller knows what
is on the menu (most appropriate at the start of the conversation).

If the customer goes off-topic or off-track and talks about anything but the
process of ordering, politely steer the conversation back to collecting their order.

Once you have all the information you need pertaining to their order, you can
end the conversation. You can say something like "Awesome, we'll have that ready
for you in 10-20 minutes." to naturally let the customer know the order has been
fully communicated.

It is important that you collect the order in an efficient manner (succinct replies
& direct questions). You only have 1 task here, and it is to collect the customers
order, then end the conversation.

- Be sure to be kind of funny and witty!
- Keep all your responses short and simple. Use casual language, phrases like "Umm...", "Well...", and "I mean" are preferred.
- This is a voice conversation, so keep your responses short, like in a real conversation. Don't ramble for too long.`,
},
],
},
};
// Make sure the image URL is correct and accessible
const LegalScoutIcon = () => (
<img
src="https://res.cloudinary.com/glide/image/fetch/f_auto,w_500,c_limit/https%3A%2F%2Fstorage.googleapis.com%2Fglide-prod.appspot.com%2Fuploads-v2%2FZf7Uh2x67Yz3nEftEH2i%2Fpub%2FipEv2VSSLIL0o0e2ostK.png"
alt="LegalScout Icon"
style={{ width: "24px", height: "24px" }}
/>
);

const usePublicKeyInvalid = () => {
const [showPublicKeyInvalidMessage, setShowPublicKeyInvalidMessage] = useState(false);
Expand All @@ -177,42 +169,17 @@ const usePublicKeyInvalid = () => {
const PleaseSetYourPublicKeyMessage = () => {
return (
<div
style={{
position: "fixed",
bottom: "25px",
left: "25px",
padding: "10px",
color: "#fff",
backgroundColor: "#f03e3e",
borderRadius: "5px",
boxShadow: "0 2px 5px rgba(0,0,0,0.2)",
}}
style={{
display: "flex",
width: "100vw",
height: "100vh",
justifyContent: "center", // This centers horizontally
alignItems: "center", // This centers vertically
}}
>
Is your Vapi Public Key missing? (recheck your code)
</div>
);
};

const ReturnToDocsLink = () => {
return (
<a
href="https://docs.vapi.ai"
target="_blank"
rel="noopener noreferrer"
style={{
position: "fixed",
top: "25px",
right: "25px",
padding: "5px 10px",
color: "#fff",
textDecoration: "none",
borderRadius: "5px",
boxShadow: "0 2px 5px rgba(0,0,0,0.2)",
}}
>
return to docs
</a>
);
};

export default App;
7 changes: 4 additions & 3 deletions src/components/ActiveCallDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import VolumeLevel from "./call/VolumeLevel";
const ActiveCallDetail = ({ assistantIsSpeaking, volumeLevel, onEndCallClick }) => {
return (
<div>
<div style={{ marginTop: "20px", textAlign: "center" }}>
<Button label="End Call" onClick={onEndCallClick} />
</div>
<div
style={{
display: "flex",
Expand All @@ -22,9 +25,7 @@ const ActiveCallDetail = ({ assistantIsSpeaking, volumeLevel, onEndCallClick })
<AssistantSpeechIndicator isSpeaking={assistantIsSpeaking} />
<VolumeLevel volume={volumeLevel} />
</div>
<div style={{ marginTop: "20px", textAlign: "center" }}>
<Button label="End Call" onClick={onEndCallClick} />
</div>

</div>
);
};
Expand Down
Loading