fix: Windows compatibility and startup scripts

- Add explicit .env loading in config.py for Windows compatibility
- Add backend directory to sys.path in main.py to fix module imports
- Add start.bat and start-full.bat for Windows startup
- Add frontend/package-lock.json for dependency tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
panw
2026-03-30 19:23:23 +08:00
parent 44921c5646
commit c625425971
5 changed files with 1920 additions and 1 deletions

View File

@@ -1,9 +1,17 @@
import base64
import os
from pathlib import Path
from typing import Optional
from pydantic import field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
# Load .env file explicitly - Windows compatibility
# This ensures environment variables are loaded before Settings instantiation
_env_path = Path(__file__).parent.parent.parent / '.env'
if _env_path.exists():
from dotenv import load_dotenv
load_dotenv(_env_path, override=True)
class Settings(BaseSettings):
"""应用配置,从环境变量加载."""

View File

@@ -8,8 +8,15 @@ This module creates and configures the FastAPI application with:
- CORS middleware
- Exception handlers
"""
from contextlib import asynccontextmanager
import sys
from pathlib import Path
# Add backend directory to Python path for imports to work
backend_dir = Path(__file__).parent.parent
if str(backend_dir) not in sys.path:
sys.path.insert(0, str(backend_dir))
from contextlib import asynccontextmanager
from typing import Callable
from fastapi import FastAPI, Request, status