# 项目文件整理说明 ## 📁 目录结构重组 ### `/scripts` - 生产脚本 保留的核心脚本: - `demo.py` - 系统演示脚本 - `port_manager.sh` - 统一的端口管理工具(新建) - `start_service.sh` - 后端服务启动脚本 - `start_web_dev.sh` - Web开发服务器启动脚本 - `stop_service.sh` - 后端服务停止脚本 ### `/tests` - 测试文件 保留的核心测试: - `tests/unit/` - 单元测试 - `test_memory.py` - `test_retrieval.py` - `test_sse.py` - `tests/integration/` - 集成测试 - `test_api.py` - API接口测试 - `test_e2e_tool_ui.py` - 端到端工具UI测试 - `test_full_workflow.py` - 完整工作流测试 - `test_mocked_streaming.py` - 模拟流式响应测试 - `test_streaming_integration.py` - 流式集成测试 ### `/tmp` - 临时文件(已移动) 移动到此目录的冗余/临时文件: **重复的端口管理脚本:** - `clear_dev_ports.sh` - `kill_port.sh` - `kill_port_auto.sh` - `port_functions.sh` **临时调试测试脚本:** - `debug_tool_events.py` - `integration_test.py` - `quick_tool_test.py` - `test_ai_sdk_endpoint.py` - `test_frontend_api.py` - `test_markdown_response.py` - `test_markdown_simple.py` - `test_real_streaming.py` - `test_setup.py` - `test_streaming_with_debug.py` - `test_tool_ui.py` - `test_ui_simple.py` ## 🔧 新建工具 ### `Makefile` - 统一命令接口 提供简化的开发命令: **安装与设置:** ```bash make install # 安装所有依赖 make check-install # 检查安装状态 ``` **服务管理:** ```bash make start # 启动后端服务 make stop # 停止后端服务 make restart # 重启后端服务 make status # 检查服务状态 ``` **开发:** ```bash make dev-web # 启动前端开发服务器 make dev-backend # 启动后端开发模式 make dev # 同时启动前后端 ``` **测试:** ```bash make test # 运行所有测试 make test-unit # 运行单元测试 make test-integration # 运行集成测试 make test-e2e # 运行端到端测试 ``` **工具:** ```bash make logs # 查看服务日志 make health # 检查服务健康状态 make port-check # 检查端口状态 make port-kill # 清理端口进程 make clean # 清理临时文件 ``` ### `scripts/port_manager.sh` - 统一端口管理 替代了多个重复的端口管理脚本: ```bash ./scripts/port_manager.sh kill [port] # 杀死指定端口进程 ./scripts/port_manager.sh clear # 清理所有常用开发端口 ./scripts/port_manager.sh check [port] # 检查端口状态 ./scripts/port_manager.sh help # 显示帮助 ``` ## 📊 整理效果 ### 前: - 根目录散落大量临时测试脚本 - `/scripts` 目录有多个功能重复的端口管理脚本 - 缺乏统一的开发命令接口 ### 后: - 清理了根目录,移除临时文件 - 统一了端口管理功能 - 提供了简洁的Makefile命令接口 - 测试文件按功能分类整理 ## 🚀 使用建议 1. **日常开发** - 使用 `make dev` 启动开发环境 2. **测试** - 使用 `make test` 运行测试 3. **端口管理** - 使用 `make port-check` 和 `make port-kill` 4. **服务管理** - 使用 `make start/stop/restart` 5. **清理** - 使用 `make clean` 清理临时文件 这样的整理使得项目结构更清晰,开发流程更简化。