
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
中文 | English
一个基于 LangChain 的智能 MVC 代码生成器,支持自然语言描述生成 Web 应用代码。
MVCGen 追求智能、高效、易用,适合快速原型开发、代码生成、自动化开发等场景。
# 克隆仓库
git clone https://github.com/your-username/mvcgen.git
cd mvcgen
# 安装依赖
pip install -e .
# 开发模式安装
pip install -e ".[dev]"
# 安装依赖
pip install -e ".[dev]"
# 运行测试
pytest
# 代码格式化
black .
# 代码检查
flake8
# 运行示例
python examples/basic_example.py
from mvcgen import Agent
# 创建 Agent 实例
agent = Agent()
# 生成用户管理模块
result = await agent.run("创建一个用户管理系统,包含用户注册、登录、个人信息管理功能")
print(result)
from mvcgen.models import Model
# 创建用户模型
user_model = Model("User", {
"id": "int primary key",
"username": "str unique",
"email": "str unique",
"password": "str",
"created_at": "datetime"
})
# 生成 CRUD 操作
crud_code = await user_model.generate_crud()
创建 .env
文件:
# OpenAI API 配置
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_BASE_URL=https://api.openai.com/v1
# 数据库配置
DATABASE_URL=sqlite://./mvcgen.db
# 应用配置
DEBUG=True
HOST=0.0.0.0
PORT=8000
# 日志配置
LOG_LEVEL=INFO
from mvcgen import Agent
# 自定义配置
agent = Agent(
model_name="gpt-4",
temperature=0.7,
max_tokens=2000,
system_prompt="你是一个专业的 Python 开发者..."
)
result = await agent.run("生成一个博客系统")
# 批量生成多个模块
modules = [
"用户管理模块",
"文章管理模块",
"评论系统模块",
"标签管理模块"
]
for module in modules:
result = await agent.run(f"创建{module}")
print(f"生成 {module}: {result}")
from mvcgen.models import Model
# 创建记录
user_data = {"username": "john", "email": "john@example.com"}
user = await UserModel.create(user_data)
# 查询记录
users = await UserModel.get_all(filters={"username": "john"})
# 更新记录
await UserModel.update(1, {"email": "new@example.com"})
# 删除记录
await UserModel.delete(1)
# 生成完整的博客系统
blog_system = await agent.run("""
创建一个博客系统,包含以下功能:
- 用户注册和登录
- 文章发布和编辑
- 评论系统
- 标签管理
- 搜索功能
- 管理员后台
""")
# 生成电商系统
ecommerce = await agent.run("""
创建一个电商系统,包含:
- 商品管理
- 购物车
- 订单管理
- 支付集成
- 用户评价
- 库存管理
""")
mvcgen/
├── src/mvcgen/
│ ├── __init__.py
│ ├── agent.py # 核心 Agent 类
│ ├── models.py # 数据库模型管理
│ ├── schemas.py # 数据模型定义
│ ├── utils.py # 工具函数
│ └── dotenv.py # 环境变量管理
├── examples/ # 示例代码
├── docs/ # 文档
├── tests/ # 测试文件
├── pyproject.toml # 项目配置
├── README.md # 项目说明
└── .env.example # 环境变量示例
MVCGen 参考和对标了以下主流代码生成和 AI 开发框架:
欢迎贡献代码!请查看我们的贡献指南:
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
FAQs
一个基于 LangGraph 的智能体框架,支持自然语言数据库操作和 MVC 模式生成
We found that mvcgen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.