250405-VSCode编辑launch.json实现Debug调试Open-WebUI

A. 最终效果

  • 根据__init__.py配置launch.json

  • 根据中utils/chat.pyform_data'messages' = [{'role': 'user', 'content': '唐老鸭'}],可以找到用户输入,进而通过关键词或模型调用的方式,对敏感问题进行特殊处理。

B. 文件配置

  • launch.json
json 复制代码
// {
//     // Use IntelliSense to learn about possible attributes.
//     // Hover to view descriptions of existing attributes.
//     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
//     "version": "0.2.0",
//     "configurations": [
//         {
//             "name": "Python Debugger: FastAPI",
//             "type": "debugpy",
//             "request": "launch",
//             "module": "uvicorn",
//             "args": [
//                 "main:app",
//                 "--reload"
//             ],
//             "jinja": true
//         }
//     ]
// }

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: FastAPI",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceFolder}/__init__.py",  // 这里指定实际的脚本路径
            "args": [
                "serve",  // 修改为执行 `serve` 命令
                "--host", "0.0.0.0",
                "--port", "8080"
            ],
            "jinja": true,
            "justMyCode": false,  // 设置为 false 以调试第三方库代码
            "purpose": ["debug-in-terminal"] 
        }
    ],
}

C. 参考文献

相关推荐
稷下元歌21 小时前
7天学会plc加机器视觉关于运动控制部份,配套视频在bib
开发语言·c++·git·vscode·python·docker·pip
仰望星空的凡人2 天前
VSCODE接入Claude Code使用第三方模型教程
ide·vscode·ai智能体·claude code
yongridada2 天前
公司内网使用Vscode+claude code
vscode·claude code
阿林爱吃大米饭2 天前
VSCode Remote SSH 内网服务器使用Codex插件 + Codex跨Provider历史会话迁移完整教程
服务器·vscode·ssh
高级打杂工程师-伍六六2 天前
想随时随地做点自己的事?创建一台VSCode登录的云电脑
人工智能·vscode
2023自学中2 天前
Linux虚拟机,VSCode + GDB 调试配置:launch.json 模板
linux·vscode·嵌入式
维度攻城狮2 天前
vscode使用SSH远程控制时显示远程主机运行的软件界面
vscode·ssh
棒棒的唐2 天前
Vscode Continue插件 集成 本地llama.cpp大模型实现代码补全
ide·vscode·编辑器
养肥胖虎2 天前
多Agent开发笔记:为什么4个Codex加1个Claude会把cpu跑满
vscode·agent·codex
bush43 天前
vscode编辑设备树插件 devicetree LSP
ide·vscode·里氏替换原则