Files
llm_speed_test_app/backend/config.py
T

32 lines
1.3 KiB
Python
Raw 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.
"""全局配置"""
import os
# ---- 推理后端选择 ----
# 可选值: "ollama"(本地 Ollama)| "openai"(任意 OpenAI 兼容 /v1 服务)
LLM_BACKEND = os.environ.get("LLM_BACKEND", "openai")
# ---- Ollama 服务(backend=ollama)----
# 本地 Ollama 默认监听端口 11434,可通过环境变量覆盖
OLLAMA_BASE_URL = os.environ.get("OLLAMA_BASE_URL", "http://localhost:11434")
# 默认模型(前端会从 /api/models 动态加载实际可用的模型列表)
DEFAULT_MODEL = os.environ.get("DEFAULT_MODEL", "qwen3.6:35b-a3b")
# ---- OpenAI 兼容服务(backend=openai)----
OPENAI_BASE_URL = os.environ.get("OPENAI_BASE_URL", "https://ai.lebiztrips.com/v1")
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "123")
OPENAI_DEFAULT_MODEL = os.environ.get("OPENAI_DEFAULT_MODEL", "Q3.6-35B-A3B-Orig-Thi")
# ---- 并发压力测试 ----
DEFAULT_CONCURRENCY = int(os.environ.get("DEFAULT_CONCURRENCY", "100"))
# ---- HTTP 服务 ----
SERVER_HOST = os.environ.get("SPEED_TEST_HOST", "0.0.0.0")
SERVER_PORT = int(os.environ.get("SPEED_TEST_PORT", "8000"))
# ---- 目录结构 ----
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BACKEND_DIR = os.path.dirname(os.path.abspath(__file__))
FRONTEND_DIR = os.path.join(ROOT_DIR, "frontend")
RESULTS_DIR = os.path.join(ROOT_DIR, "results")
REPORT_DIR = os.path.join(ROOT_DIR, "report")