Files
catonline_ai/vw-agentic-rag/docs/topics/VSCODE_DEBUG_DEMO.md
2025-09-26 17:15:54 +08:00

1.6 KiB
Raw Permalink Blame History

VS Code调试演示

你现在已经成功配置了VS Code调试环境下面是具体的使用步骤

🎯 立即开始调试

步骤1: 打开VS Code

如果还没有在VS Code中打开项目

cd /home/fl/code/ai-solution/agentic-rag-4
code .

步骤2: 选择Python解释器

  1. Ctrl+Shift+P
  2. 输入 "Python: Select Interpreter"
  3. 选择 .venv/bin/python

步骤3: 设置断点

service/llm_client.py 的第42行astream 方法)设置断点:

  • 点击行号左侧设置红色断点

步骤4: 开始调试

  1. Ctrl+Shift+D 打开调试面板
  2. 选择 "Debug Service with uvicorn"
  3. F5 或点击绿色箭头

步骤5: 触发断点

在另一个终端运行测试:

cd /home/fl/code/ai-solution/agentic-rag-4
uv run python scripts/test_real_streaming.py

断点将在LLM流式调用时触发

📋 可用的调试配置

  1. Debug Agentic RAG Service - 直接调试服务
  2. Debug Service with uvicorn - 推荐使用uvicorn调试
  3. Run Tests - 调试测试用例
  4. Run Streaming Test - 调试流式测试

🛠️ 调试功能

  • 断点调试: 在任意行设置断点
  • 变量查看: 鼠标悬停或查看变量面板
  • 调用栈: 查看函数调用链
  • 监视表达式: 添加自定义监视
  • 调试控制台: 执行Python表达式

🔧 常用快捷键

  • F5 - 开始调试/继续
  • F9 - 切换断点
  • F10 - 单步跳过
  • F11 - 单步进入
  • Shift+F11 - 单步跳出
  • Shift+F5 - 停止调试

现在你可以在VS Code中愉快地调试你的服务了🚀