- Added `auth.py` for mock login and JWT issuance. - Introduced `chat.py` for handling chat requests with role-based access control. - Enhanced `main.py` to include new routers and middleware for tracing. - Implemented input validation in `input_guard.py` to prevent SQL injection. - Created repositories for managing agent sessions and audit logs. - Added exception handling for authorization errors. - Updated settings to include JWT configuration. - Introduced tests for authentication and input validation.
38 lines
1013 B
Python
38 lines
1013 B
Python
"""环境配置(从 .env 读取,见 .env.example)。"""
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
|
|
app_env: str = "development"
|
|
|
|
mysql_host: str = "127.0.0.1"
|
|
mysql_port: int = 3306
|
|
mysql_database: str = "jinrong_agent"
|
|
mysql_core_database: str = "jinrong_core"
|
|
mysql_user: str = "root"
|
|
mysql_password: str = ""
|
|
|
|
redis_url: str = "redis://127.0.0.1:6379/0"
|
|
|
|
neo4j_uri: str = "bolt://localhost:7687"
|
|
neo4j_user: str = "neo4j"
|
|
neo4j_password: str = ""
|
|
|
|
milvus_uri: str = "./data/milvus.db"
|
|
|
|
ollama_base_url: str = "http://127.0.0.1:11434"
|
|
embed_model: str = "bge-m3"
|
|
|
|
deepseek_api_key: str = ""
|
|
deepseek_base_url: str = "https://api.deepseek.com"
|
|
|
|
jwt_dev_secret: str = "change-me-in-dev-only"
|
|
jwt_dev_algorithm: str = "HS256"
|
|
jwt_dev_expire_hours: int = 8
|
|
|
|
|
|
settings = Settings()
|