Spaces:
Running
Running
Juan Jimenez Carrero
feat: voice β talk to Reachy via OpenAI Realtime, wired to the kitchen tools
e6c8aff | import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk"; | |
| (window as unknown as { ReachyMini: typeof ReachyMini }).ReachyMini = ReachyMini; | |
| window.dispatchEvent(new Event("reachymini:ready")); | |
| const params = new URLSearchParams(window.location.search); | |
| const isEmbed = params.get("embedded") === "1" || params.get("embed") === "1"; | |
| // The host shell's HF OAuth redirect returns to `/?code=β¦` (or `?error=β¦`); | |
| // resume the host directly so the sign-in round-trip completes. | |
| const isOAuthReturn = params.has("code") || params.has("error"); | |
| const launched = sessionStorage.getItem("cookaiware:launched") === "1"; | |
| function bootHost(): Promise<void> { | |
| sessionStorage.setItem("cookaiware:launched", "1"); | |
| const root = document.getElementById("root"); | |
| if (root) root.innerHTML = ""; | |
| return import("@pollen-robotics/reachy-mini-sdk/host/auto").then(({ mountHost }) => { | |
| mountHost({ | |
| appName: "CookAIware", | |
| appIconUrl: "/icon.png", | |
| appEmoji: "π²", | |
| enableMicrophone: true, | |
| // Dev shortcuts from .env.local (gitignored), see guide Β§9. | |
| devToken: | |
| import.meta.env.VITE_HF_TOKEN && import.meta.env.VITE_HF_USERNAME | |
| ? { | |
| token: import.meta.env.VITE_HF_TOKEN as string, | |
| userName: import.meta.env.VITE_HF_USERNAME as string, | |
| } | |
| : undefined, | |
| clientId: import.meta.env.VITE_HF_OAUTH_CLIENT_ID as string | undefined, | |
| }); | |
| }); | |
| } | |
| if (import.meta.env.DEV && params.get("uidev") === "1") { | |
| // Dev-only UI harness without a robot session. | |
| void import("./devUi"); | |
| } else if (isEmbed) { | |
| void import("./embed"); | |
| } else if (isOAuthReturn || launched) { | |
| // Returning from sign-in, or already launched this session β host shell. | |
| void bootHost(); | |
| } else { | |
| // Fresh visit β informational landing page; "Connect your Reachy" hands off. | |
| void import("./landing").then(({ renderLanding }) => renderLanding(() => void bootHost())); | |
| } | |