Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

read_config_from_api: true # Set to true when Java API is running

server:
ip: 0.0.0.0
port: 8000
http_port: 8003
# Update this with your actual IP if needed for vision endpoint
vision_explain: http://192.168.1.111:8003/mcp/vision/explain
mqtt_gateway:
enabled: true
broker: 192.168.1.111
port: 1883
udp_port: 8884

manager-api:
# Manager API endpoint
url: http://192.168.1.111:8002/toy
# Server secret from database
# secret: d153e93c-bb2f-42e7-8045-a1ee47a1dcfc
secret: a3c1734a-1efe-4ab7-8f43-98f88b874e4b
timeout: 30
max_retries: 3
retry_delay: 5
2 changes: 1 addition & 1 deletion docs/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ LLM:
但是如果你用docker部署,那么你的日志里给出的接口地址信息就不是真实的接口地址。

最正确的方法,是根据电脑的局域网IP来确定你的接口地址。
如果你的电脑的局域网IP比如是`192.168.1.25`,那么你的接口地址就是:`ws://192.168.1.25:8000/xiaozhi/v1/`,对应的OTA地址就是:`http://192.168.1.25:8003/xiaozhi/ota/`。
如果你的电脑的局域网IP比如是`192.168.1.1115`,那么你的接口地址就是:`ws://192.168.1.1115:8000/xiaozhi/v1/`,对应的OTA地址就是:`http://192.168.1.1115:8003/xiaozhi/ota/`。

这个信息很有用的,后面`编译esp32固件`需要用到。

Expand Down
10 changes: 5 additions & 5 deletions docs/firmware-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
### 如果你用的是简单Server部署
此刻,请你用浏览器打开你的ota地址,例如我的ota地址
```
http://192.168.1.25:8003/xiaozhi/ota/
http://192.168.1.1115:8003/xiaozhi/ota/
```
如果显示“OTA接口运行正常,向设备发送的websocket地址是:ws://xxx:8000/xiaozhi/v1/

Expand All @@ -22,7 +22,7 @@ http://192.168.1.25:8003/xiaozhi/ota/
### 如果你用的是全模块部署
此刻,请你用浏览器打开你的ota地址,例如我的ota地址
```
http://192.168.1.25:8002/xiaozhi/ota/
http://192.168.1.1115:8002/xiaozhi/ota/
```

如果显示“OTA接口运行正常,websocket集群数量:X”。那就往下进行2步。
Expand All @@ -36,7 +36,7 @@ http://192.168.1.25:8002/xiaozhi/ota/
- 3、在列表中找到`server.websocket`项目,输入你的`Websocket`地址。例如我的就是

```
ws://192.168.1.25:8000/xiaozhi/v1/
ws://192.168.1.1115:8000/xiaozhi/v1/
```

配置完后,再使用浏览器刷新你的ota接口地址,看看是不是正常了。如果还不正常就,就再次确认一下Websocket是否正常启动,是否配置了Websocket地址。
Expand All @@ -54,7 +54,7 @@ ws://192.168.1.25:8000/xiaozhi/v1/
## 第4步 修改OTA地址

找到`OTA_URL`的`default`的内容,把`https://api.tenclass.net/xiaozhi/ota/`
改成你自己的地址,例如,我的接口地址是`http://192.168.1.25:8002/xiaozhi/ota/`,就把内容改成这个。
改成你自己的地址,例如,我的接口地址是`http://192.168.1.1115:8002/xiaozhi/ota/`,就把内容改成这个。

修改前:
```
Expand All @@ -68,7 +68,7 @@ config OTA_URL
```
config OTA_URL
string "Default OTA URL"
default "http://192.168.1.25:8002/xiaozhi/ota/"
default "http://192.168.1.1115:8002/xiaozhi/ota/"
help
The application will access this URL to check for new firmwares and server address.
```
Expand Down
4 changes: 2 additions & 2 deletions docs/mcp-endpoint-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ Please copy the interface URL:

**Important: Since you're using Docker deployment, DO NOT use the above address directly!**

First copy the address and save it in a draft. You need to know your computer's local network IP. For example, if my computer's local IP is `192.168.1.25`, then the original interface address:
First copy the address and save it in a draft. You need to know your computer's local network IP. For example, if my computer's local IP is `192.168.1.1115`, then the original interface address:
```
http://172.1.1.1:8004/mcp_endpoint/health?key=xxxx
```
should be changed to:
```
http://192.168.1.25:8004/mcp_endpoint/health?key=xxxx
http://192.168.1.1115:8004/mcp_endpoint/health?key=xxxx
```

After making the change, please access this interface directly using your browser. When the browser displays code similar to this, it means success:
Expand Down
48 changes: 48 additions & 0 deletions main/livekit-server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Python bytecode and artifacts
__pycache__/
*.py[cod]
*.pyo
*.pyd
*.egg-info/
dist/
build/

# Virtual environments
.venv/
venv/

# Caches and test output
.cache/
.pytest_cache/
.ruff_cache/
coverage/

# Logs and temp files
*.log
*.gz
*.tgz
.tmp
.cache

# Environment variables
.env
.env.*

# VCS, editor, OS
.git
.gitignore
.gitattributes
.github/
.idea/
.vscode/
.DS_Store

# Project docs and misc
README.md
LICENSE

# Project tests
test/
tests/
eval/
evals/
21 changes: 21 additions & 0 deletions main/livekit-server/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MQTT_HOST=139.59.5.142
MQTT_PORT=1883
MQTT_CLIENT_ID=GID_test@@@00:11:22:33:44:55
MQTT_USERNAME=testuser
MQTT_PASSWORD=testpassword
# LiveKit Cloud Configuration (commented out - using local instead)
#LIVEKIT_URL=wss://cheeko-ycahauzs.livekit.cloud
#LIVEKIT_API_KEY=APInJFs2nTcUxcE
#LIVEKIT_API_SECRET=CDpl09fZm8WCMHHYBdi6OBrMqjq5u7D78ROH02O6I8Z

# LiveKit Local Configuration
LIVEKIT_URL=ws://localhost:7880
LIVEKIT_API_KEY=devkey
LIVEKIT_API_SECRET=secret

# Redis Configuration (using existing manager-api Redis)
REDIS_URL=redis://:redispassword@localhost:6380
REDIS_PASSWORD=redispassword

GOOGLE_API_KEY=your_google_api_key_here
GROQ_API_KEY=your_groq_api_key_here
Binary file added main/livekit-server/.github/assets/livekit-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions main/livekit-server/.github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Ruff

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
ruff-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v1
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install dependencies
run: UV_GIT_LFS=1 uv sync --dev

- name: Run ruff linter
run: uv run ruff check --output-format=github .

- name: Run ruff formatter
run: uv run ruff format --check --diff .
31 changes: 31 additions & 0 deletions main/livekit-server/.github/workflows/template-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# As this is a starter template project, we don't want to check in the uv.lock and livekit.toml files in its template form
# However, once you have cloned this repo for your own use, LiveKit recommends you check them in and delete this github workflow entirely

name: Template Check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
check-template-files:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Check template files not tracked in git
run: |
if git ls-files | grep -q "^uv\.lock$"; then
echo "Error: uv.lock should not be checked into git"
echo "Disable this test and commit the file once you have cloned this repo for your own use"
exit 1
fi
if git ls-files | grep -q "^livekit\.toml$"; then
echo "Error: livekit.toml should not be checked into git"
echo "Disable this test and commit the file once you have cloned this repo for your own use"
exit 1
fi
echo "✓ uv.lock and livekit.toml are correctly not tracked in git"
32 changes: 32 additions & 0 deletions main/livekit-server/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v1
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install dependencies
run: UV_GIT_LFS=1 uv sync --dev

- name: Run tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: uv run pytest -v
13 changes: 13 additions & 0 deletions main/livekit-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.env
.env.*
!.env.example
.DS_Store
__pycache__
.idea
KMS
.venv
.vscode
*.egg-info
.pytest_cache
.ruff_cache
venv
69 changes: 69 additions & 0 deletions main/livekit-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# syntax=docker/dockerfile:1

# Use the official UV Python base image with Python 3.11 on Debian Bookworm
# UV is a fast Python package manager that provides better performance than pip
# We use the slim variant to keep the image size smaller while still having essential tools
ARG PYTHON_VERSION=3.11
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim AS base

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/app" \
--shell "/sbin/nologin" \
--uid "${UID}" \
appuser

# Install build dependencies required for Python packages with native extensions
# gcc: C compiler needed for building Python packages with C extensions
# python3-dev: Python development headers needed for compilation
# We clean up the apt cache after installation to keep the image size down
RUN apt-get update && apt-get install -y \
gcc \
g++ \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

# Create a new directory for our application code
# And set it as the working directory
WORKDIR /app

# Copy just the dependency files first, for more efficient layer caching
COPY pyproject.toml uv.lock ./
RUN mkdir -p src

# Install Python dependencies using UV's lock file
# --locked ensures we use exact versions from uv.lock for reproducible builds
# This creates a virtual environment and installs all dependencies
# Ensure your uv.lock file is checked in for consistency across environments
RUN uv sync --locked

# Copy all remaining pplication files into the container
# This includes source code, configuration files, and dependency specifications
# (Excludes files specified in .dockerignore)
COPY . .

# Change ownership of all app files to the non-privileged user
# This ensures the application can read/write files as needed
RUN chown -R appuser:appuser /app

# Switch to the non-privileged user for all subsequent operations
# This improves security by not running as root
USER appuser

# Pre-download any ML models or files the agent needs
# This ensures the container is ready to run immediately without downloading
# dependencies at runtime, which improves startup time and reliability
RUN uv run src/agent.py download-files

# Run the application using UV
# UV will activate the virtual environment and run the agent.
# The "start" command tells the worker to connect to LiveKit and begin waiting for jobs.
CMD ["uv", "run", "src/agent.py", "start"]
Loading