feat: refactor API key configuration and enhance application initialization

- Renamed `check_environment` to `check_api_key_configured` for clarity, simplifying the API key validation logic.
- Removed the blocking behavior of the API key check during application startup, allowing the app to run while providing a prompt for configuration.
- Updated `LocalAgentApp` to accept an `api_configured` parameter, enabling conditional messaging for API key setup.
- Enhanced the `SandboxRunner` to support backup management and improved execution result handling with detailed metrics.
- Integrated data governance strategies into the `HistoryManager`, ensuring compliance and improved data management.
- Added privacy settings and metrics tracking across various components to enhance user experience and application safety.
This commit is contained in:
Mimikko-zeus
2026-02-27 14:32:30 +08:00
parent ab5bbff6f7
commit 8a538bb950
58 changed files with 13457 additions and 350 deletions

83
run_tests.bat Normal file
View File

@@ -0,0 +1,83 @@
@echo off
REM LocalAgent 测试运行脚本
REM 用于快速执行各类测试
echo ========================================
echo LocalAgent 测试套件
echo ========================================
echo.
:menu
echo 请选择测试模式:
echo [1] 运行关键路径测试 (推荐)
echo [2] 运行所有测试
echo [3] 仅运行单元测试
echo [4] 运行端到端集成测试
echo [5] 运行安全回归测试
echo [0] 退出
echo.
set /p choice="请输入选项 (0-5): "
if "%choice%"=="1" goto critical
if "%choice%"=="2" goto all
if "%choice%"=="3" goto unit
if "%choice%"=="4" goto e2e
if "%choice%"=="5" goto security
if "%choice%"=="0" goto end
echo 无效选项,请重新选择
echo.
goto menu
:critical
echo.
echo 运行关键路径测试...
echo ========================================
python tests/test_runner.py --mode critical
goto result
:all
echo.
echo 运行所有测试...
echo ========================================
python tests/test_runner.py --mode all
goto result
:unit
echo.
echo 运行单元测试...
echo ========================================
python tests/test_runner.py --mode unit
goto result
:e2e
echo.
echo 运行端到端集成测试...
echo ========================================
python -m unittest tests.test_e2e_integration -v
goto result
:security
echo.
echo 运行安全回归测试...
echo ========================================
python -m unittest tests.test_security_regression -v
goto result
:result
echo.
echo ========================================
echo 测试完成
echo ========================================
echo.
echo 测试报告已保存到: workspace\test_reports\
echo.
pause
goto menu
:end
echo.
echo 感谢使用 LocalAgent 测试套件
exit /b 0