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. 参考文献

相关推荐
fenghx2586 小时前
仅用于个人记录:火狐有网,Vscode的codex连不上
vscode·编辑器
00后程序员张7 小时前
iOS 打包方式汇总 从 Xcode Archive 到轻量级工具链的 IPA 构建
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
Balabala噗8 小时前
VScode接入MiniMax流程
ide·vscode·编辑器
星云_byto2 天前
五分钟从零配置好VSCode + Claude Code + DeepSeek V4 Pro
ide·vscode·编辑器·cursor·codex·claude code·deepseekv4
你家人养牛3 天前
OOC Relation Plugin:C 语言面向对象 开发的高效辅助工具
c语言·vscode
林熙蕾LXL3 天前
VSCode调试
ide·vscode·编辑器
菜地里的小菜鸟3 天前
vscode接入claudecode
vscode·claude code·vscode接入claudecode
π同学3 天前
ESP-IDF+vscode开发ESP32第十七讲——USB设备栈
vscode·esp32·usb
逍遥德3 天前
前端工程化-01:前端工程化技术栈
前端·javascript·vue.js·vscode
爱就是恒久忍耐21 天前
VSCode里如何比较2个branch
ide·vscode·编辑器