05e173b293
Replace the WebView shell with SwiftUI screens, add account-scoped Wiki and TTS APIs with adaptive review and photo scan support, and keep web/iOS pages usable while data loads asynchronously. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
from functools import lru_cache
|
|
from urllib.parse import quote_plus
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
mysql_host: str = "localhost"
|
|
mysql_port: int = 3306
|
|
mysql_user: str = "boot"
|
|
mysql_password: str = "888888"
|
|
mysql_database: str = "wordloop"
|
|
|
|
deepseek_api_key: str = ""
|
|
deepseek_base_url: str = "https://api.deepseek.com"
|
|
deepseek_model: str = "deepseek-chat"
|
|
ai_wiki_daily_llm_limit: int = 20
|
|
|
|
tkmind_tts_base_url: str = "https://asr.tkmind.cn"
|
|
tkmind_tts_enabled: bool = True
|
|
tkmind_tts_spk_id: str = "aitong"
|
|
tkmind_tts_timeout: int = 20
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
user = quote_plus(self.mysql_user)
|
|
password = quote_plus(self.mysql_password)
|
|
return (
|
|
f"mysql+pymysql://{user}:{password}"
|
|
f"@{self.mysql_host}:{self.mysql_port}/{self.mysql_database}"
|
|
"?charset=utf8mb4"
|
|
)
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|