26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
"""novel-app 中央配置。
|
||
|
||
所有值均可通过环境变量覆盖(NOVEL_APP_* 前缀,SECRET_KEY 例外,
|
||
沿用惯例的 FLASK_SECRET_KEY)。上下文组装预算(字符数)由
|
||
services/context.py 与 routes/ 共享。
|
||
"""
|
||
|
||
import os
|
||
|
||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||
|
||
DB_PATH = os.environ.get("NOVEL_APP_DB_PATH", os.path.join(BASE_DIR, "novel.db"))
|
||
|
||
LLM_URL = os.environ.get("NOVEL_APP_LLM_URL", "http://127.0.0.1:4000/v1")
|
||
LLM_MODEL = os.environ.get("NOVEL_APP_LLM_MODEL", "default")
|
||
LLM_TIMEOUT = int(os.environ.get("NOVEL_APP_LLM_TIMEOUT", "600"))
|
||
|
||
PORT = int(os.environ.get("NOVEL_APP_PORT", "8091"))
|
||
|
||
# 上下文组装预算(字符数)
|
||
CTX_PREV_CHAPTERS = int(os.environ.get("NOVEL_APP_CTX_PREV_CHAPTERS", "2")) # 最近 N 章全文
|
||
CTX_SUMMARY_CHAPTERS = int(os.environ.get("NOVEL_APP_CTX_SUMMARY_CHAPTERS", "20")) # 结构化摘要窗口
|
||
CTX_BUDGET_MIN = int(os.environ.get("NOVEL_APP_CTX_BUDGET_MIN", "8000"))
|
||
CTX_BUDGET_MAX = int(os.environ.get("NOVEL_APP_CTX_BUDGET_MAX", "120000"))
|
||
|
||
SECRET_KEY = os.environ.get("FLASK_SECRET_KEY", "dev-novel-secret-change-me") |