54 lines
2.2 KiB
Python
54 lines
2.2 KiB
Python
"""中心服务端配置。
|
||
|
||
它和桌面端后端是两套东西:桌面端连 school_assistant 库、只看自己那所学校;
|
||
中心服务端连 school_assistant_hub 库,收所有学校报上来的经验草稿,审核后发布回去。
|
||
"""
|
||
|
||
from pathlib import Path
|
||
|
||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
||
ROOT_DIR = Path(__file__).resolve().parent.parent
|
||
CONSOLE_DIST = ROOT_DIR / "dist" / "console"
|
||
|
||
|
||
class ServerSettings(BaseSettings):
|
||
model_config = SettingsConfigDict(
|
||
env_file=str(ROOT_DIR / ".env"),
|
||
env_file_encoding="utf-8",
|
||
env_prefix="HUB_",
|
||
extra="ignore",
|
||
)
|
||
|
||
port: int = 8801
|
||
# 中心库(与桌面端同一个 PostgreSQL 实例,不同数据库)
|
||
pg_host: str = "127.0.0.1"
|
||
pg_port: int = 15433
|
||
pg_user: str = "assistant"
|
||
pg_password: str = "assistant_dev_123"
|
||
pg_database: str = "school_assistant_hub"
|
||
# 维护库:建库时先连它(CREATE DATABASE 不能在目标库里执行)
|
||
pg_maintenance_database: str = "postgres"
|
||
|
||
# 后台登录口令。留空则只监听 127.0.0.1 且不校验,方便本机开发
|
||
console_token: str = ""
|
||
|
||
# 智能预审用的模型(不配就只做规则预审,不调模型)
|
||
llm_provider: str = "deepseek"
|
||
llm_api_key: str = ""
|
||
llm_model: str = "deepseek-chat"
|
||
llm_base_url: str = "https://api.deepseek.com/v1"
|
||
|
||
# 智能采纳的门槛(见 server/autoreview.py)。只影响控件技巧 / 入口路径类,系统规则永远人审
|
||
auto_min_schools: int = 2 # 跨校观察达到几所就认为成立
|
||
auto_min_observations: int = 3 # 只有一所学校时,观察多少次才够
|
||
auto_min_trials: int = 2 # Agent 在真实页面上验证相符几次算实测通过(唯一能解锁系统规则类的证据)
|
||
auto_require_llm: bool = True # 配了模型 Key 时是否要求模型也同意
|
||
auto_reject: bool = True # 是否自动清掉明显的垃圾(标记 auto,再上报会退回队列)
|
||
auto_max_actions: int = 50 # 单次最多处理多少条
|
||
# 上报后自动跑一遍智能采纳。默认关:先用后台按钮手动跑几次,看准了再打开
|
||
auto_on_report: bool = False
|
||
|
||
|
||
settings = ServerSettings()
|