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:
@@ -14,7 +14,7 @@
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
import config
|
||||
import settings
|
||||
import uvicorn
|
||||
from db.session import sync_interface_definitions
|
||||
from fastapi import FastAPI
|
||||
@@ -41,7 +41,7 @@ app = FastAPI(title="AI Video Assistant 平台 - 后端", lifespan=lifespan)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=config.CORS_ORIGINS,
|
||||
allow_origins=settings.CORS_ORIGINS,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
@@ -57,4 +57,4 @@ app.include_router(voice_ws.router)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run("app:app", host=config.HOST, port=config.PORT, reload=True)
|
||||
uvicorn.run("app:app", host=settings.HOST, port=settings.PORT, reload=True)
|
||||
|
||||
Reference in New Issue
Block a user