Files
autogen/TROUBLESHOOTING.md
2026-03-12 13:27:03 +08:00

157 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# AutoGen SDLC 系统 - 问题修复说明
## 🔧 已修复的问题
### 问题Streamlit 运行时报错 `'TERMINAL'`
**错误现象**:
```
错误:'TERMINAL'
```
**根本原因**:
`UserProxyAgent``human_input_mode="TERMINAL"` 设置会在 Web 环境下尝试使用终端输入,导致 Streamlit 报错。
**解决方案**:
将所有文件中的 `human_input_mode="TERMINAL"` 改为 `human_input_mode="NEVER"`
### 修改的文件
1.`frontend/streamlit_app_v2.py` (第 224 行)
2.`frontend/streamlit_app.py` (第 104 行)
3.`autogen_sdls_system.py` (第 115 行)
---
## 🚀 现在可以正常运行了
### 方式 1: Streamlit 增强版界面(推荐)
```bash
streamlit run frontend/streamlit_app_v2.py
```
**功能特色**:
- 🎭 Agent 实时状态面板
- 🔄 Mermaid 工作流程图
- ⏱️ 执行时间线
- 💬 对话实录展示
- 📁 生成文件预览
- 📊 统计仪表盘
### 方式 2: Streamlit 经典界面
```bash
streamlit run frontend/streamlit_app.py
```
### 方式 3: 命令行完整工作流
```bash
python autogen_sdls_system.py
```
### 方式 4: HTML 独立演示(无需依赖)
```bash
# 直接在浏览器打开
demo_visualization.html
```
---
## ⚙️ 配置说明
### 环境变量设置
**Windows PowerShell**:
```powershell
$env:DASHSCOPE_API_KEY="your_api_key_here"
```
**Linux/Mac**:
```bash
export DASHSCOPE_API_KEY="your_api_key_here"
```
### 依赖安装
```bash
pip install -r requirements.txt
```
或单独安装:
```bash
pip install streamlit autogen dashscope pytest
```
---
## 🎯 Agent 说明
| Agent | 职责 | 图标 |
|-------|------|------|
| PM Agent | 产品经理 - 需求分析与 SRS 生成 | 📋 |
| QA Agent | 测试工程师 - 测试用例设计 | ✅ |
| Dev Agent | 开发工程师 - 代码实现 | 💻 |
| Orchestrator | 协调器 - 流程调度与验证 | 🎯 |
| User Proxy | 用户代理 - 人机交互 | 👤 |
---
## 📊 工作流程
```
用户需求
📋 PM Agent → SRS 文档
✅ QA Agent → 测试用例
💻 Dev Agent → 源代码
🔧 自动测试
↓ (失败)
💻 Dev Agent (修复)
↓ (通过)
🎯 Orchestrator → 最终报告
```
---
## 💡 使用提示
1. **API Key 获取**: 访问 [阿里云 DashScope 控制台](https://dashscope.console.aliyun.com/)
2. **模型选择**: 推荐使用 `qwen3.5-flash`(速度快、成本低)
3. **工作目录**: 所有生成的文件保存在 `workspace/` 目录
4. **日志位置**: 对话历史保存在 `logs/` 目录
5. **人机协同**: 如需人工确认,可在代码中添加 Streamlit 弹窗
---
## 🐛 常见问题
### Q1: 仍然报错怎么办?
**检查清单**:
- [ ] API Key 是否正确设置
- [ ] 依赖包是否安装完整
- [ ] Python 版本是否 >= 3.9
- [ ] 工作目录是否有写权限
### Q2: 如何查看详细的错误信息?
在 Streamlit 界面查看底部的红色错误提示,或在命令行运行查看完整堆栈。
### Q3: 生成的代码在哪里?
所有生成的文件都在 `workspace/` 目录下,可以在 Streamlit 界面的"生成的文件"区域查看。
---
## 📞 技术支持
如有其他问题,请查看:
- [AutoGen 官方文档](https://microsoft.github.io/autogen/)
- [阿里云 DashScope 文档](https://help.aliyun.com/zh/dashscope/)