This commit is contained in:
3 2025-07-09 13:26:10 +08:00
parent 71eb1ee79a
commit ba1a7c216c
5 changed files with 13 additions and 19 deletions

View File

@ -9,7 +9,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.11 (AI-powered-switches)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.12 interpreter library" level="application" />
</component>

View File

@ -1,11 +0,0 @@
# 硅基流动API配置
SILICONFLOW_API_KEY=sk-114514
SILICONFLOW_API_URL=https://api.siliconflow.ai/v1
# 交换机登录凭证
SWITCH_USERNAME=admin
SWITCH_PASSWORD=your_switch_password
SWITCH_TIMEOUT=10
# 应用设置
DEBUG=True

View File

@ -26,7 +26,7 @@ class AIService:
"""
data = {
"model": "text-davinci-003",
"model": "deepseek-ai/DeepSeek-V3",
"prompt": prompt,
"max_tokens": 1000,
"temperature": 0.3
@ -35,7 +35,7 @@ class AIService:
try:
async with httpx.AsyncClient() as client:
response = await client.post(
f"{self.api_url}/completions",
f"{self.api_url}/chat/completions",
headers=self.headers,
json=data,
timeout=30

View File

@ -1,26 +1,30 @@
from pydantic import BaseModel
from pydantic_settings import BaseSettings
from dotenv import load_dotenv
import os
load_dotenv()
import os
class Settings(BaseSettings):
APP_NAME: str = "AI Network Configurator"
DEBUG: bool = True
API_PREFIX: str = "/api"
# 硅基流动API配置
SILICONFLOW_API_KEY: str = os.getenv("SILICON_API_KEY", "")
SILICONFLOW_API_URL: str = os.getenv("SILICONFLOW_API_URL", "https://api.siliconflow.ai/v1")
SILICONFLOW_API_KEY: str = os.getenv("SILICONFLOW_API_KEY", "sk-mhzuedasunrgdrxfkcxmxgaypgjnxgodvvmrzzdbqrwtkqej")
SILICONFLOW_API_URL: str = os.getenv("SILICONFLOW_API_URL", "https://api.siliconflow.cn/v1")
# 交换机配置
SWITCH_USERNAME: str = os.getenv("SWITCH_USERNAME", "admin")
SWITCH_PASSWORD: str = os.getenv("SWITCH_PASSWORD", "admin")
SWITCH_TIMEOUT: int = os.getenv("SWITCH_TIMEOUT", 10)
# eNSP配置
ENSP_DEFAULT_IP: str = "172.17.99.201"
ENSP_DEFAULT_PORT: int = 2000
class Config:
env_file = ".env"
extra = "ignore"
settings = Settings()

View File

@ -13,6 +13,7 @@ telnetlib3==2.0.3
httpx==0.27.0
python-nmap==0.7.1
# 异步文件操作 -i https://pypi.tuna.tsinghua.edu.cn/simple
aiofiles==23.2.1