From 282c0ffa9c2c9eba0f3299513b8dc2befdab1194 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 1 Sep 2025 13:18:17 -0700 Subject: [PATCH] Worked once --- Dockerfile.voicebot | 46 ++ client/src/App.tsx | 21 +- client/src/MediaControl.tsx | 55 +- client/src/UserList.tsx | 13 +- docker-compose.yml | 6 +- server/main.py | 406 ++++++++-- voicebot/entrypoint.sh | 17 +- voicebot/logger.py | 124 ++++ voicebot/main.py | 1149 ++++++++++++++++++++++++----- voicebot/pyproject.toml | 20 + voicebot/scripts/reload_runner.py | 161 ++++ 11 files changed, 1753 insertions(+), 265 deletions(-) create mode 100644 Dockerfile.voicebot create mode 100644 voicebot/logger.py create mode 100644 voicebot/pyproject.toml create mode 100644 voicebot/scripts/reload_runner.py diff --git a/Dockerfile.voicebot b/Dockerfile.voicebot new file mode 100644 index 0000000..d705d9d --- /dev/null +++ b/Dockerfile.voicebot @@ -0,0 +1,46 @@ +FROM ubuntu:plucky + +# Install some utilities frequently used +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + gpg \ + iputils-ping \ + jq \ + nano \ + rsync \ + wget \ + python3 \ + python3-pip \ + # python3-venv \ + # python3-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} + +# Install packages required for voicebot +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libgl1 \ + libglib2.0-0t64 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} + + +# Install uv using the official Astral script +RUN curl -Ls https://astral.sh/uv/install.sh | bash +ENV PATH=/root/.local/bin:$PATH + +WORKDIR /voicebot + +# Copy code and entrypoint +COPY ./voicebot /voicebot +COPY ./voicebot/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Set environment variable for production mode (default: development) +ENV PRODUCTION=false + +# the cache and target directories are on different filesystems, hardlinking may not be supported. +ENV UV_LINK_MODE=copy + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/client/src/App.tsx b/client/src/App.tsx index 07648a1..5bd0d01 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -5,7 +5,7 @@ import { Session } from "./GlobalContext"; import { UserList } from "./UserList"; import "./App.css"; import { ws_base, base } from "./Common"; -import { Box, Button } from "@mui/material"; +import { Box, Button, Tooltip } from "@mui/material"; import { BrowserRouter as Router, Route, Routes, useParams } from "react-router-dom"; import useWebSocket, { ReadyState } from "react-use-websocket"; @@ -28,9 +28,10 @@ const LobbyView: React.FC = (props: LobbyProps) => { const { lobbyName = "default" } = useParams<{ lobbyName: string }>(); const [lobby, setLobby] = useState(null); const [editName, setEditName] = useState(""); + const [editPassword, setEditPassword] = useState(""); const [socketUrl, setSocketUrl] = useState(null); const [creatingLobby, setCreatingLobby] = useState(false); - + const socket = useWebSocket(socketUrl, { onOpen: () => console.log("app - WebSocket connection opened."), onClose: () => console.log("app - WebSocket connection closed."), @@ -125,7 +126,7 @@ const LobbyView: React.FC = (props: LobbyProps) => { const setName = (name: string) => { sendJsonMessage({ type: "set_name", - data: { name }, + data: { name, password: editPassword ? editPassword : undefined }, }); }; @@ -156,6 +157,10 @@ const LobbyView: React.FC = (props: LobbyProps) => { {!session.name && ( Enter your name to join: + + You can optionally set a password to reserve this name; supply it again to takeover the name from + another client. + = (props: LobbyProps) => { onKeyDown={handleKeyDown} placeholder="Your name" /> + setEditPassword(e.target.value)} + placeholder="Optional password" + /> + + +