| import streamlit as st |
| import streamlit.components.v1 as components |
| import os |
|
|
| |
| assistant_id = "36f0a337-96e4-48e0-b13d-ad632eeea312" |
| public_api_key = "ea671a92-bb34-46dc-b999-70ef53b64a4b" |
|
|
| |
| st.title('Vapi.ai Voice Widget Integration') |
|
|
| |
| html_code = f""" |
| <script> |
| var vapiInstance = null; |
| const assistant = "{assistant_id}"; // ์ด์์คํดํธ ID |
| const apiKey = "{public_api_key}"; // ๊ณต๊ฐ API ํค |
| const buttonConfig = {{ |
| position: "bottom-right", |
| offset: "40px", |
| width: "50px", |
| height: "50px", |
| idle: {{ |
| color: "rgb(93, 254, 202)", |
| type: "pill", |
| title: "Have a quick question?", |
| subtitle: "Talk with our AI assistant", |
| icon: "https://unpkg.com/lucide-static@0.321.0/icons/phone.svg", |
| }}, |
| loading: {{ |
| color: "rgb(93, 124, 202)", |
| type: "pill", |
| title: "Connecting...", |
| subtitle: "Please wait", |
| icon: "https://unpkg.com/lucide-static@0.321.0/icons/loader-2.svg", |
| }}, |
| active: {{ |
| color: "rgb(255, 0, 0)", |
| type: "pill", |
| title: "Call is in progress...", |
| subtitle: "End the call.", |
| icon: "https://unpkg.com/lucide-static@0.321.0/icons/phone-off.svg", |
| }}, |
| }}; |
| |
| (function (d, t) {{ |
| var g = d.createElement(t), |
| s = d.getElementsByTagName(t)[0]; |
| g.src = "https://cdn.jsdelivr.net/gh/VapiAI/html-script-tag@latest/dist/assets/index.js"; |
| g.defer = true; |
| g.async = true; |
| s.parentNode.insertBefore(g, s); |
| |
| g.onload = function () {{ |
| vapiInstance = window.vapiSDK.run({{ |
| apiKey: apiKey, |
| assistant: assistant, |
| config: buttonConfig, |
| }}); |
| }}; |
| }})(document, "script"); |
| </script> |
| """ |
|
|
| |
| st.markdown("Note: ๋ฒํผ์ ํด๋ฆญํ์ฌ Vapi Voice Widget์ ์คํ/์ค์งํ์ธ์.") |
|
|
| |
| components.html(html_code, height=0) |
|
|