mirror of
https://github.com/Jerryplusy/AI-powered-switches.git
synced 2025-07-04 21:29:18 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
b93d9646ee
6
.idea/AI-powered-switches.iml
generated
6
.idea/AI-powered-switches.iml
generated
@ -1,10 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Python" name="Python facet">
|
||||
<configuration sdkName="Python 3.12" />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Python 3.12 interpreter library" level="application" />
|
||||
</component>
|
||||
</module>
|
28
README.md
28
README.md
@ -1,29 +1,41 @@
|
||||
# 基于人工智能实现的交换机自动或半自动配置
|
||||
|
||||
### 技术栈
|
||||
- Python3
|
||||
- JavaScript
|
||||
- **Python3**
|
||||
- Flask
|
||||
- FastAPI
|
||||
- Flask-CORS
|
||||
- **JavaScript**
|
||||
- React
|
||||
- JSX
|
||||
- Framer-motion
|
||||
- ~~chakra-ui~~
|
||||
- shadcn-ui
|
||||
- HTML5
|
||||
|
||||
### 项目分工
|
||||
- **后端api,人工智能算法** : `3`(主要) & `log_out` 使用python
|
||||
- **后端api,人工智能算法** : `3`(主要) & `log_out` & `Jerry`(maybe) 使用python
|
||||
- **前端管理后台设计**:`Jerry`使用react
|
||||
- **论文撰写**:`log_out`
|
||||
|
||||
### 各部分说明
|
||||
|
||||
[网页管理前端](https://github.com/Jerryplusy/AI-powered-switches/blob/main/src/frontend/README.md)
|
||||
|
||||
[逻辑处理后端](https://github.com/Jerryplusy/AI-powered-switches/blob/main/src/backend/README.md)
|
||||
|
||||
### 贡献流程
|
||||
|
||||
- **后端api**:
|
||||
- 对于`3`:直接推送到`main`分支
|
||||
- 对于`Jerry`&`log_out`:**fork** 到自己仓库下,提交推送到自己的仓库,然后提交pullrequest并指定`3`审核
|
||||
- 对于`Jerry`&`log_out`:新建额外的`feat`或`fix`分支,提交推送到自己的分支,然后提交`pullrequest`到`main`分支并指定`3`审核
|
||||
|
||||
- **前端管理后台**:
|
||||
- 对于`Jerry`:直接推送更新到`main`分支
|
||||
- 对于`3`&`log_out`:**fork** 到自己仓库下,提交推送到自己的仓库,然后提交pullrequest并指定`Jerry`审核
|
||||
- 对于`3`&`log_out`:新建额外的`feat`或`fix`分支,提交推送到自己的分支,然后提交`pullrequest`到`main`分支并指定`Jerry`审核
|
||||
|
||||
- **论文(thesis)**:
|
||||
- **fork** 到自己仓库下,提交推送到自己的仓库,然后提交pullrequest并指定`log_out`审核
|
||||
|
||||
- **注意在推送前先更新项目**
|
||||
- 提交`pullrequest`并指定`log_out`审核
|
||||
### 项目活动时间
|
||||
2025 6 - 8月
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# 硅基流动API配置
|
||||
SILICONFLOW_API_KEY=sk-mhzuedasunrgdrxfkcxmxgaypgjnxgodvvmrzzdbqrwtkqej
|
||||
SILICONFLOW_API_KEY=sk-114514
|
||||
SILICONFLOW_API_URL=https://api.siliconflow.ai/v1
|
||||
|
||||
# 交换机登录凭证
|
48
src/backend/README.md
Normal file
48
src/backend/README.md
Normal file
@ -0,0 +1,48 @@
|
||||
# AI-powered-switches Backend
|
||||
|
||||
这是 AI-powered-switches 的后端服务,基于 `Flask` 构建,提供 `REST API` 接口,用于解析自然语言生成网络交换机配置并下发到设备
|
||||
|
||||
### 项目结构
|
||||
|
||||
```bash
|
||||
src/backend/
|
||||
├── app/
|
||||
│ ├── __init__.py # 创建 Flask 应用实例
|
||||
│ ├── api/ # API 路由模块
|
||||
│ │ ├── __init__.py # 注册 API 蓝图
|
||||
│ │ ├── command_parser.py # /api/parse_command 接口
|
||||
│ │ └── network_config.py # /api/apply_config 接口
|
||||
│ └── services/ # 核心服务逻辑
|
||||
│ └── ai_services.py # 调用外部 AI 服务生成配置
|
||||
├── config.py # 配置加载与环境变量管理
|
||||
├── exceptions.py # 自定义异常定义
|
||||
├── run.py # 程序入口
|
||||
├── requirements.txt # Python 依赖列表
|
||||
└── Dockerfile/Dockerfile # 后端 Docker 镜像构建文件
|
||||
```
|
||||
|
||||
### 本地运行
|
||||
|
||||
``` bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
创建`.env`并参照`.envExample`写入环境变量
|
||||
|
||||
```bash
|
||||
python run.py
|
||||
```
|
||||
|
||||
### Docker构建
|
||||
|
||||
```bash
|
||||
docker build -t ai-switch-backend -f Dockerfile/Dockerfile .
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run -p 5000:5000 \
|
||||
-e AI_API_KEY=your_api_key \
|
||||
-e SWITCH_USER=admin \
|
||||
-e SWITCH_PASS=your_password \
|
||||
ai-switch-backend
|
||||
```
|
@ -1,3 +1,6 @@
|
||||
ignoredBuiltDependencies:
|
||||
- core-js
|
||||
- core-js-pure
|
||||
|
||||
packages:
|
||||
- '.'
|
||||
|
@ -1,12 +1,14 @@
|
||||
'use client'
|
||||
'use client';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import { ColorModeProvider } from './color-mode';
|
||||
import createSystem from '@/theme';
|
||||
|
||||
import { ChakraProvider, defaultSystem } from '@chakra-ui/react'
|
||||
import { ColorModeProvider } from './color-mode'
|
||||
const system = createSystem;
|
||||
|
||||
export function Provider(props) {
|
||||
return (
|
||||
<ChakraProvider value={defaultSystem}>
|
||||
<ChakraProvider value={system}>
|
||||
<ColorModeProvider {...props} />
|
||||
</ChakraProvider>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
0
src/frontend/src/constants/keep
Normal file
0
src/frontend/src/constants/keep
Normal file
@ -3,7 +3,6 @@ import ReactDOM from 'react-dom/client';
|
||||
import App from '@/App';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { Provider } from '@/components/ui/provider';
|
||||
import system from '@/theme';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
|
0
src/frontend/src/libs/keep
Normal file
0
src/frontend/src/libs/keep
Normal file
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Button, Heading, VStack } from '@chakra-ui/react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import Card from '@/components/ui/Card';
|
||||
|
||||
const Welcome = () => {
|
||||
const navigate = useNavigate();
|
||||
|
0
src/frontend/src/resources/keep
Normal file
0
src/frontend/src/resources/keep
Normal file
@ -3,25 +3,21 @@ import { defineConfig, createSystem, defaultConfig } from '@chakra-ui/react';
|
||||
const config = defineConfig({
|
||||
cssVarsRoot: ':where(:root, :host)',
|
||||
cssVarsPrefix: 'ck',
|
||||
strictTokens: false,
|
||||
strictTokens: true,
|
||||
|
||||
globalCss: {
|
||||
'html, body': {
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
fontFamily: "'Roboto', sans-serif",
|
||||
backgroundColor: '{colors.bg}',
|
||||
color: '{colors.text}',
|
||||
},
|
||||
},
|
||||
globalCss: {}, //全局css
|
||||
|
||||
conditions: {
|
||||
cqSm: '@container(min-width: 320px)',
|
||||
child: '& > *',
|
||||
child: '& > *', //子元素选择
|
||||
},
|
||||
|
||||
theme: {
|
||||
//核心主题配置
|
||||
components: {
|
||||
//组件样式
|
||||
},
|
||||
breakpoints: {
|
||||
//响应式断点
|
||||
sm: '320px',
|
||||
md: '768px',
|
||||
lg: '960px',
|
||||
@ -29,6 +25,7 @@ const config = defineConfig({
|
||||
},
|
||||
|
||||
tokens: {
|
||||
//基础主题
|
||||
colors: {
|
||||
bg: '#f9fafb',
|
||||
text: '#1a202c',
|
||||
@ -46,6 +43,7 @@ const config = defineConfig({
|
||||
},
|
||||
|
||||
semanticTokens: {
|
||||
//自定义标记
|
||||
colors: {
|
||||
danger: { value: '{colors.red}' },
|
||||
primary: { value: '{colors.primary}' },
|
||||
@ -54,6 +52,7 @@ const config = defineConfig({
|
||||
},
|
||||
|
||||
keyframes: {
|
||||
//关键帧
|
||||
fadeIn: {
|
||||
from: { opacity: 0 },
|
||||
to: { opacity: 1 },
|
||||
@ -65,6 +64,7 @@ const config = defineConfig({
|
||||
},
|
||||
|
||||
animationStyles: {
|
||||
//预定义动画样式
|
||||
fadeIn: {
|
||||
animation: 'fadeIn 0.3s ease-in',
|
||||
},
|
||||
@ -74,6 +74,7 @@ const config = defineConfig({
|
||||
},
|
||||
|
||||
textStyles: {
|
||||
//文字样式
|
||||
heading: {
|
||||
description: 'Page heading',
|
||||
value: {
|
||||
@ -90,6 +91,7 @@ const config = defineConfig({
|
||||
},
|
||||
|
||||
layerStyles: {
|
||||
//层样式
|
||||
card: {
|
||||
bg: 'white',
|
||||
boxShadow: 'soft',
|
||||
@ -100,6 +102,4 @@ const config = defineConfig({
|
||||
},
|
||||
});
|
||||
|
||||
const system = createSystem(defaultConfig, config);
|
||||
|
||||
export default system;
|
||||
export default createSystem(defaultConfig, config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user