mirror of
https://github.com/Jerryplusy/AI-powered-switches.git
synced 2025-10-14 09:49:19 +00:00
1
This commit is contained in:
parent
71eb1ee79a
commit
ba1a7c216c
2
.idea/AI-powered-switches.iml
generated
2
.idea/AI-powered-switches.iml
generated
@ -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>
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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()
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user