feat: add python-dotenv support for local .env files
- 添加 python-dotenv 依赖 - 在 config.py 中加载 .env 文件 - 添加 .env.example 示例文件
This commit is contained in:
6
.env.example
Normal file
6
.env.example
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# OpenAI API Key
|
||||||
|
OPENAI_API_KEY=sk-your-api-key-here
|
||||||
|
|
||||||
|
# 可选:自定义路由阈值
|
||||||
|
# ROUTE_SIMPLE_THRESHOLD=100
|
||||||
|
# ROUTE_MEDIUM_THRESHOLD=500
|
||||||
@@ -3,7 +3,10 @@
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
# 加载 .env 文件
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
# 模型配置
|
# 模型配置
|
||||||
MODEL_CONFIG = {
|
MODEL_CONFIG = {
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ pydantic>=2.5.0
|
|||||||
openai>=1.6.0
|
openai>=1.6.0
|
||||||
tiktoken>=0.5.0
|
tiktoken>=0.5.0
|
||||||
httpx>=0.25.0
|
httpx>=0.25.0
|
||||||
|
python-dotenv>=1.0.0
|
||||||
pytest>=7.4.0
|
pytest>=7.4.0
|
||||||
pytest-asyncio>=0.21.0
|
pytest-asyncio>=0.21.0
|
||||||
|
|||||||
Reference in New Issue
Block a user