doc: update readme for uv

This commit is contained in:
qixinbo
2026-04-01 21:47:49 +08:00
parent 5dc6b63525
commit a4c2078e6e
2 changed files with 24 additions and 31 deletions
+10 -12
View File
@@ -103,11 +103,11 @@ uv build --wheel --out-dir ../dist
```bash ```bash
# 建议先创建虚拟环境 # 建议先创建虚拟环境
python -m venv .venv uv venv
source .venv/bin/activate source .venv/bin/activate
# 安装 DataClaw(示例:安装根目录 dist 下的 wheel) # 安装 DataClaw(示例:安装根目录 dist 下的 wheel)
pip install ./dist/dataclaw-*.whl uv pip install ./dist/dataclaw-*.whl
# 启动服务(默认 http://127.0.0.1:8000 # 启动服务(默认 http://127.0.0.1:8000
dataclaw start dataclaw start
@@ -141,14 +141,14 @@ export DATA_ROOT=/absolute/path/to/data
```bash ```bash
cd backend cd backend
# 创建虚拟环境(可选但强烈建议) # 创建虚拟环境(可选但强烈建议)
python -m venv .venv uv venv
source .venv/bin/activate source .venv/bin/activate
# 安装依赖 # 安装依赖
pip install -r requirements.txt uv sync
# 启动 FastAPI 服务器 # 启动 FastAPI 服务器
uvicorn app.main:app --reload --port 8000 uv run uvicorn app.main:app --reload --port 8000
``` ```
```bash ```bash
@@ -168,10 +168,10 @@ npm run dev
```bash ```bash
cd whisper cd whisper
python -m venv .venv uv venv
source .venv/bin/activate source .venv/bin/activate
pip install -r requirements.txt uv pip install -r requirements.txt
python main.py uv run python main.py
``` ```
默认服务地址:`http://localhost:8001` 默认服务地址:`http://localhost:8001`
@@ -313,15 +313,13 @@ curl -X POST http://127.0.0.1:8000/api/v1/a2a/tasks/<task_id>/webhooks \
```bash ```bash
# 终端1:实例 A # 终端1:实例 A
cd backend cd backend
source .venv/bin/activate DATA_ROOT=/tmp/dataclaw-a uv run uvicorn main:app --reload --port 8000
DATA_ROOT=/tmp/dataclaw-a uvicorn main:app --reload --port 8000
``` ```
```bash ```bash
# 终端2:实例 B # 终端2:实例 B
cd backend cd backend
source .venv/bin/activate DATA_ROOT=/tmp/dataclaw-b uv run uvicorn main:app --reload --port 8001
DATA_ROOT=/tmp/dataclaw-b uvicorn main:app --reload --port 8001
``` ```
然后在两个实例分别注册并登录,拿到 token: 然后在两个实例分别注册并登录,拿到 token:
+14 -19
View File
@@ -103,27 +103,26 @@ Once built, the wheel is located in the project root `dist/` directory, e.g., `d
```bash ```bash
# We recommend creating a virtual environment first # We recommend creating a virtual environment first
python -m venv .venv uv venv
source .venv/bin/activate
# Install DataClaw # Install DataClaw
pip install ./dist/dataclaw-*.whl uv pip install ./dist/dataclaw-*.whl
# Start the service (defaults to http://127.0.0.1:8000) # Start the service (defaults to http://127.0.0.1:8000)
dataclaw start uv run dataclaw start
``` ```
Common service control commands: Common service control commands:
```bash ```bash
# Check running status # Check running status
dataclaw status uv run dataclaw status
# Custom host/port # Custom host/port
dataclaw start --host 0.0.0.0 --port 8000 uv run dataclaw start --host 0.0.0.0 --port 8000
# Stop the service # Stop the service
dataclaw stop uv run dataclaw stop
``` ```
Optional environment variable: Optional environment variable:
@@ -141,14 +140,13 @@ If you want to debug the frontend code or rebuild the frontend artifacts, use th
```bash ```bash
cd backend cd backend
# Create a virtual environment (optional but recommended) # Create a virtual environment (optional but recommended)
python -m venv .venv uv venv
source .venv/bin/activate
# Install dependencies # Install dependencies
pip install -r requirements.txt uv sync
# Start the FastAPI server # Start the FastAPI server
uvicorn app.main:app --reload --port 8000 uv run uvicorn app.main:app --reload --port 8000
``` ```
```bash ```bash
@@ -168,10 +166,9 @@ If you want to use voice input in chat, run the standalone `whisper` service:
```bash ```bash
cd whisper cd whisper
python -m venv .venv uv venv
source .venv/bin/activate uv pip install -r requirements.txt
pip install -r requirements.txt uv run python main.py
python main.py
``` ```
Default service URL: `http://localhost:8001` Default service URL: `http://localhost:8001`
@@ -264,15 +261,13 @@ Run them in two terminals:
```bash ```bash
# Terminal 1 - Instance A # Terminal 1 - Instance A
cd backend cd backend
source .venv/bin/activate DATA_ROOT=/tmp/dataclaw-a uv run uvicorn main:app --reload --port 8000
DATA_ROOT=/tmp/dataclaw-a uvicorn main:app --reload --port 8000
``` ```
```bash ```bash
# Terminal 2 - Instance B # Terminal 2 - Instance B
cd backend cd backend
source .venv/bin/activate DATA_ROOT=/tmp/dataclaw-b uv run uvicorn main:app --reload --port 8001
DATA_ROOT=/tmp/dataclaw-b uvicorn main:app --reload --port 8001
``` ```
Create/login users and fetch tokens: Create/login users and fetch tokens: