init repo
This commit is contained in:
57
app/config.py
Normal file
57
app/config.py
Normal file
@@ -0,0 +1,57 @@
|
||||
"""Application configuration — multi-model pool by domain."""
|
||||
|
||||
from pathlib import Path
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
# --- Model Pool ---
|
||||
# Global analysis (English-native): strongest global reasoning
|
||||
llm_global: str = "openai/Claude-3.5-Sonnet"
|
||||
# China domestic (Chinese-native): deepest Chinese market knowledge
|
||||
llm_china: str = "openai/DeepSeek-R1"
|
||||
# Synthesis & review: strongest reasoning for cross-domain work
|
||||
llm_reasoning: str = "openai/Claude-3.5-Sonnet"
|
||||
# Data & fast tasks: cost-effective structured output
|
||||
llm_fast: str = "openai/Gemini-2.0-Flash"
|
||||
# Translation: high-quality bidirectional EN↔ZH
|
||||
llm_translation: str = "openai/Claude-3.5-Sonnet"
|
||||
|
||||
# Fallback default (if domain not specified)
|
||||
llm_model: str = "openai/Claude-3.5-Sonnet"
|
||||
|
||||
# API config (Poe as unified gateway)
|
||||
llm_api_key: str = ""
|
||||
llm_api_base: str = "https://api.poe.com/bot/"
|
||||
|
||||
# Server
|
||||
host: str = "0.0.0.0"
|
||||
port: int = 4200
|
||||
|
||||
# Paths
|
||||
base_dir: Path = Path(__file__).resolve().parent.parent
|
||||
templates_dir: Path = base_dir / "templates"
|
||||
output_dir: Path = base_dir / "output"
|
||||
|
||||
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
|
||||
|
||||
def model_for_domain(self, domain: str) -> str:
|
||||
"""Get the best model for a content domain.
|
||||
|
||||
Domains:
|
||||
global — international markets, global competition, tech trends
|
||||
china — Chinese market, domestic policy, local competition
|
||||
reasoning — synthesis, review, strategic recommendations
|
||||
fast — data processing, chart generation, structured output
|
||||
translation — high-quality EN↔ZH translation
|
||||
"""
|
||||
return {
|
||||
"global": self.llm_global,
|
||||
"china": self.llm_china,
|
||||
"reasoning": self.llm_reasoning,
|
||||
"fast": self.llm_fast,
|
||||
"translation": self.llm_translation,
|
||||
}.get(domain, self.llm_model)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user