Refactor backend configuration management and update environment settings

- Replace the `config.py` module with a new `settings.py` to streamline environment variable management, focusing on database, CORS, and TURN settings.
- Update references throughout the backend codebase to use the new `settings` module instead of the deprecated `config`.
- Modify the `.env.example` file to reflect the new configuration approach, indicating that model provider credentials should be maintained separately.
- Enhance the `AssistantConfig` model to clarify the source of runtime connection information, ensuring it is injected from model resources rather than relying on defaults from the environment.
- Introduce new user scripts for audio and video management in the Tampermonkey environment, enhancing WebRTC capabilities.
This commit is contained in:
Xin Wang
2026-07-09 21:40:29 +08:00
parent 195579c5b7
commit 35d24acf40
19 changed files with 106 additions and 139 deletions

View File

@@ -25,7 +25,7 @@ pipecat 把"管线"和"输出方式"解耦:同一条 `STT→LLM→TTS` 管线可
```
ai-video-backend/
├── app.py # FastAPI 入口,挂路由 + CORS
├── config.py # 读 .env,模型接口环境变量兜底
├── settings.py # 读 .env,仅存数据库/CORS/TURN 等运行设置
├── models.py # AssistantConfig(对齐前端 AssistantForm)
├── routes/ # 一个文件一组端点(对齐 dograh routes/)
│ ├── health.py
@@ -96,7 +96,7 @@ uv pip install fastapi "uvicorn[standard]" sqlalchemy asyncpg greenlet python-do
# 阶段 B:做语音时再装全量(含 pipecat,需 3.10+)
# uv pip install -r requirements.txt
cp .env.example .env # CRUD 阶段只需 DATABASE_URL;语音再填模型 key
cp .env.example .env # 只放数据库/CORS/TURN;模型 key 在模型资源里维护
# 起 Postgres:在 ai-video/ 下 docker compose up -d postgres
cd ..
make db-migrate # 首次或表结构变更后执行 Alembic 迁移