Files
nba-fan-hub/config.py
T

44 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""
NBA球迷大全 - 全局配置
所有环境相关配置集中在此,便于迁移与扩展(新增 CBA / 足球等只需扩展数据库,不改代码)
"""
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_DIR = os.path.join(BASE_DIR, "data")
LOG_DIR = os.path.join(BASE_DIR, "logs")
STATIC_DIR = os.path.join(BASE_DIR, "static")
DB_PATH = os.path.join(DATA_DIR, "nba_fan.db")
os.makedirs(DATA_DIR, exist_ok=True)
os.makedirs(LOG_DIR, exist_ok=True)
# ---------------- 大模型(DeepSeek ----------------
LLM_BASE_URL = "https://api.deepseek.com"
LLM_API_KEY = "sk-edb9df58ff574f8c98df1cd6a425e97c"
LLM_MODEL = "deepseek-v4-flash"
LLM_TIMEOUT = 90 # 单次请求超时(秒)
LLM_MAX_TOKENS = 2048
LLM_TEMPERATURE = 0.3 # 事实问答,低温度更准确
# ---------------- Embedding 服务(本地 16011OpenAI 兼容) ----------------
EMBEDDING_API_URL = "http://121.40.164.32:16011/v1/embeddings"
EMBEDDING_MODEL = "bge-large-zh-v1.5" # 容器内白名单模型名(1024 维)
EMBEDDING_DIM = 1024
# ---------------- Rerank 服务(本地 16011Cohere 兼容,可选) ----------------
RERANK_API_URL = "http://121.40.164.32:16011/v1/rerank"
RERANK_MODEL = "bge-reranker-v2-m3"
USE_RERANK = True
# ---------------- Chroma 向量库(本地 16010 ----------------
CHROMA_HOST = "121.40.164.32"
CHROMA_PORT = 16010
CHROMA_COLLECTION = "nba_fan_knowledge_v1" # 集合名(升级可换 v2,平滑迁移)
# ---------------- 服务 ----------------
SERVICE_PORT = 16090
SERVICE_HOST = "0.0.0.0"
SERVICE_NAME = "NBA球迷大全"