50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
from functools import lru_cache
|
|
|
|
class Settings(BaseSettings):
|
|
# Japi Server 配置
|
|
host: str = "0.0.0.0"
|
|
port: int = 8101
|
|
debug: bool = False
|
|
|
|
# API路由配置
|
|
router_prefix: str = "/jchat"
|
|
chat_route: str = "/chat"
|
|
default_api_name: str = "jingrow-chat" # 默认API名称
|
|
|
|
upload_url: str = "http://images.jingrow.com:8080/api/v1/image"
|
|
|
|
# Jingrow Jcloud API 配置
|
|
jingrow_api_url: str = "https://cloud.jingrow.com"
|
|
jingrow_api_key: Optional[str] = None
|
|
jingrow_api_secret: Optional[str] = None
|
|
|
|
# DeepSeek配置
|
|
deepseek_api_url: str = "https://api.deepseek.com/v1/chat/completions"
|
|
deepseek_api_key: Optional[str] = None
|
|
deepseek_api_model: str = "deepseek-chat"
|
|
|
|
# Doubao配置
|
|
doubao_api_url: str = "https://ark.cn-beijing.volces.com/api/v3/chat/completions"
|
|
doubao_api_key: Optional[str] = None
|
|
doubao_api_model: str = "doubao-1-5-pro-32k-250115"
|
|
|
|
# ChatGPT配置
|
|
chatgpt_api_url: str = "https://api.openai.com/v1/chat/completions"
|
|
chatgpt_api_key: Optional[str] = None
|
|
chatgpt_api_model: str = "gpt-4"
|
|
|
|
# 默认服务模型配置
|
|
translation_model: str = "Doubao"
|
|
image_to_text_model: str = "Doubao"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
# 创建全局配置实例
|
|
settings = get_settings() |