一个基于AI的智能写作助手工具,支持多平台内容创作,提供从选题到发布的完整写作工作流。
🎉 Beta 1.0 版本发布! 这是第一个公开测试版本,包含完整的核心功能和跨平台支持。欢迎试用并提供反馈!
- 选题分析:基于关键词智能生成多个选题方向
- 标题生成:创建吸引人的标题,提供多个选项
- 大纲创建:构建结构化的文章大纲
- 内容写作:根据大纲生成完整文章内容
- AI优化:去除AI痕迹,提升内容自然度
- OpenAI GPT:GPT-3.5, GPT-4系列
- Anthropic Claude:Claude-3 Sonnet, Opus
- 阿里云通义千问:qwen-turbo, qwen-plus
- 灵活配置:支持多个API作为备选
- 微信公众号:符合公众号写作规范
- 知乎:适配知乎内容风格
- 小红书:短文案和种草内容
- 抖音:短视频脚本创作
- 通用平台:适用于各种内容平台
- 个性化内容:根据用户输入生成定制化内容
- 风格适配:自动适应不同平台的写作风格
- 实时预览:所见即所得的编辑体验
- 版本管理:支持内容版本对比和回滚
- Node.js >= 16.0.0
- Python >= 3.8
- Docker (可选,用于Redis)
- Git
- 操作系统: Linux, macOS, Windows 10/11
# Linux/macOS
git clone https://github.com/zzgfn123/ai-writing.git
cd ai-writing
# Windows
git clone https://github.com/zzgfn123/ai-writing.git
cd ai-writing# Linux/macOS
cp .env.example .env
./configure-api.sh
# Windows
copy .env.example .env
configure-api.bat# Linux/macOS
./start.sh
# Windows
start.bat- 前端界面:http://localhost:3000
- 后端API:http://localhost:8000
- API文档:http://localhost:8000/docs
- Linux: Ubuntu 18.04+, CentOS 7+, 其他主流发行版
- macOS: macOS 10.15+
- Windows: Windows 10/11, Windows Server 2019+
详细的Windows部署指南请查看:Windows部署指南
# Linux/macOS
./configure-api.sh
# Windows
configure-api.bat按照提示选择AI提供商并输入API密钥。
编辑 .env 文件:
# Linux/macOS
nano .env
# Windows
notepad .env
# 配置内容
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CLAUDE_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TONGYI_API_KEY=your-tongyi-api-key| 提供商 | 获取地址 | 特点 |
|---|---|---|
| OpenAI | https://platform.openai.com/api-keys | 效果优秀,需付费 |
| Claude | https://console.anthropic.com/ | 效果出色,需申请 |
| 通义千问 | https://dashscope.console.aliyun.com/ | 国内稳定,有免费额度 |
- 访问前端界面:http://localhost:3000
- 创建新项目:
- 输入项目标题
- 选择目标平台
- 设置写作目标
- 开始写作流程:
- 选题分析 → 标题生成 → 大纲创建 → 内容写作 → AI优化
-
输入关键词:
春节传统文化 时间管理技巧 人工智能教育 -
系统分析:
- 目标受众分析
- 热点话题关联
- 内容价值评估
- 差异化角度建议
-
选择方向:从生成的10个选题中选择最适合的方向
- 字数:1500-3000字
- 风格:专业、有深度
- 结构:标题-引言-正文-总结
- 字数:800-2000字
- 风格:知识分享、干货
- 结构:问题-分析-解答-案例
- 字数:200-800字
- 风格:轻松、种草
- 结构:标题-要点-推荐
- 字数:100-300字
- 风格:简洁、有趣
- 结构:开头-内容-结尾
ai-writing-tool/
├── frontend/ # React前端
│ ├── src/
│ │ ├── components/ # 组件
│ │ ├── pages/ # 页面
│ │ ├── services/ # API服务
│ │ └── utils/ # 工具函数
│ └── package.json
├── backend/ # FastAPI后端
│ ├── app/
│ │ ├── api/ # API路由
│ │ ├── models/ # 数据模型
│ │ ├── services/ # 业务逻辑
│ │ └── core/ # 核心配置
│ └── requirements.txt
├── docs/ # 文档
├── scripts/ # 脚本工具
└── docker-compose.yml # Docker配置
cd backend
python -m venv venv
source venv/bin/activate # Linux/Mac
# 或 venv\Scripts\activate # Windows
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm startGET /api/v1/projects- 获取项目列表POST /api/v1/projects- 创建新项目POST /api/v1/projects/{id}/execute- 执行写作阶段GET /api/v1/models/status- 检查API配置状态
# 执行选题分析
POST /api/v1/projects/{project_id}/execute
{
"stage": "topic_selection",
"model_id": 1,
"parameters": {
"topic_hint": "人工智能教育"
}
}# 应用配置
PROJECT_NAME=AI写作助手工具
VERSION=1.0.0
API_V1_STR=/api/v1
# 数据库配置
DATABASE_URL=sqlite:///./ai_writing_tool.db
# AI模型配置
OPENAI_API_KEY=your-openai-api-key
CLAUDE_API_KEY=your-claude-api-key
TONGYI_API_KEY=your-tongyi-api-key
# CORS配置
ALLOWED_HOSTS=["http://localhost:3000"]{
"model": "gpt-3.5-turbo",
"temperature": 0.7,
"max_tokens": 2000,
"top_p": 0.8
}原因:未配置有效的API密钥 解决:
./check-api-config.sh # 检查配置状态
./configure-api.sh # 配置API密钥原因:网络问题或API密钥无效 解决:
- 检查网络连接
- 验证API密钥有效性
- 确认账户余额充足
原因:端口占用或依赖缺失 解决:
./stop.sh # 停止所有服务
lsof -i :3000 # 检查端口占用
lsof -i :8000
./start.sh # 重新启动原因:CORS配置或后端未启动 解决:
- 检查后端服务状态
- 验证CORS配置
- 查看浏览器控制台错误
# 查看后端日志
tail -f backend.log
# 查看前端日志
tail -f frontend.log
# 查看服务状态
ps aux | grep python
ps aux | grep node# 检查API配置
./check-api-config.sh
# 测试API连接
cd backend && source venv/bin/activate
python ../test-api-connection.py- 组件懒加载
- 图片压缩
- 代码分割
- 缓存策略
- 数据库索引
- API响应缓存
- 异步处理
- 连接池配置
- 请求去重
- 结果缓存
- 错误重试
- 负载均衡
- 使用环境变量存储
- 定期轮换密钥
- 监控使用量
- 设置使用限制
- 用户数据加密
- 访问权限控制
- 审计日志
- 备份策略
- Fork项目
- 创建功能分支
- 提交代码
- 创建Pull Request
- 遵循PEP 8(Python)
- 使用ESLint(JavaScript)
- 编写单元测试
- 更新文档
feat: 添加新功能
fix: 修复bug
docs: 更新文档
style: 代码格式调整
refactor: 代码重构
test: 添加测试
chore: 构建过程或辅助工具的变动
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
- OpenAI GPT API
- Anthropic Claude API
- 阿里云通义千问API
- React & FastAPI 社区
- 所有贡献者
- 问题反馈:GitHub Issues
- 功能建议:GitHub Discussions
- 文档:项目Wiki
开始你的AI写作之旅! 🚀