Initial commit: clean project structure

- Backend: FastAPI + SQLAlchemy + Celery (Python 3.11+)
- Frontend: Vue 3 + TypeScript + Pinia + Tailwind
- Admin Frontend: separate Vue 3 app for management
- Docker Compose: 9 services orchestration
- Specs: design prototypes, memory system PRD, product roadmap

Cleanup performed:
- Removed temporary debug scripts from backend root
- Removed deprecated admin_app.py (embedded UI)
- Removed duplicate docs from admin-frontend
- Updated .gitignore for Vite cache and egg-info
This commit is contained in:
zhangtuo
2026-01-20 18:20:03 +08:00
commit e9d7f8832a
241 changed files with 33070 additions and 0 deletions

61
backend/app/admin_main.py Normal file
View File

@@ -0,0 +1,61 @@
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api import admin_providers, admin_reload
from app.core.config import settings
from app.core.logging import get_logger, setup_logging
from app.db.database import init_db
setup_logging()
logger = get_logger(__name__)
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Admin App lifespan manager."""
logger.info("admin_app_starting")
await init_db()
# 可以在这里加载特定的 Admin 缓存或预热
yield
logger.info("admin_app_shutdown")
app = FastAPI(
title=f"{settings.app_name} Admin Console",
description="Administrative Control Plane for DreamWeaver.",
version="0.1.0",
lifespan=lifespan,
)
# Admin 后台通常允许更宽松的 CORS或者特定的管理域名
app.add_middleware(
CORSMiddleware,
allow_origins=settings.cors_origins, # 或者专门的 ADMIN_CORS_ORIGINS
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# 根据配置开关挂载路由
if settings.enable_admin_console:
app.include_router(admin_providers.router, prefix="/admin", tags=["admin-providers"])
app.include_router(admin_reload.router, prefix="/admin", tags=["admin-reload"])
else:
@app.get("/admin/{path:path}")
@app.post("/admin/{path:path}")
@app.put("/admin/{path:path}")
@app.delete("/admin/{path:path}")
async def admin_disabled(path: str):
from fastapi import HTTPException
raise HTTPException(
status_code=403,
detail="Admin console is disabled in environment configuration."
)
@app.get("/health")
async def health_check():
return {"status": "ok", "service": "admin-backend"}