53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
"""Configuration settings for P2P Wiki AI system."""
|
|
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
# Paths
|
|
project_root: Path = Path(__file__).parent.parent
|
|
data_dir: Path = project_root / "data"
|
|
xmldump_dir: Path = project_root / "xmldump"
|
|
|
|
# Vector store
|
|
chroma_persist_dir: Path = data_dir / "chroma"
|
|
embedding_model: str = "all-MiniLM-L6-v2" # Fast, good quality
|
|
|
|
# Ollama (local LLM)
|
|
ollama_base_url: str = "http://localhost:11434"
|
|
ollama_model: str = "llama3.2" # Default model for local inference
|
|
|
|
# Claude API (for complex tasks)
|
|
anthropic_api_key: str = ""
|
|
claude_model: str = "claude-sonnet-4-20250514"
|
|
|
|
# Hybrid routing thresholds
|
|
use_claude_for_drafts: bool = True # Use Claude for article drafting
|
|
use_ollama_for_chat: bool = True # Use Ollama for simple Q&A
|
|
|
|
# MediaWiki
|
|
mediawiki_api_url: str = "https://wiki.p2pfoundation.net/api.php"
|
|
wiki_cookie_file: Path = Path("/tmp/wiki_cookies.txt")
|
|
|
|
# Server
|
|
host: str = "0.0.0.0"
|
|
port: int = 8420
|
|
|
|
# Review queue
|
|
review_queue_dir: Path = data_dir / "review_queue"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
|
|
|
|
settings = Settings()
|
|
|
|
# Ensure directories exist
|
|
settings.data_dir.mkdir(parents=True, exist_ok=True)
|
|
settings.chroma_persist_dir.mkdir(parents=True, exist_ok=True)
|
|
settings.review_queue_dir.mkdir(parents=True, exist_ok=True)
|