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

相关推荐
治金的blog11 小时前
vben-admin和vite,ant-design-vue的结合的联系
前端·vscode
你怎么知道我是队长18 小时前
Vs Code创建---代码统计工具
vscode
Jackson@ML1 天前
2026最新版Visual Studio Code安装使用指南
ide·vscode·编辑器
狂放不羁霸1 天前
Tailscale | 校园网外笔记本借助校园网内主机连接实验室服务器
运维·服务器·vscode
New_Horizons6661 天前
VScode 无法使用shift + F12查看引用
ide·vscode·编辑器
tc&1 天前
VSCode远程连接AlmaLinux虚拟机问题总结
ide·vscode·编辑器
web守墓人1 天前
【编辑器】简单了解下vscode的go语言插件原理
ide·vscode·编辑器
事在人wёi1 天前
Vscode 大工程 C/C++插件无法跳转到原函数
vscode
颖风船2 天前
vscode连接vmware中的deepin虚拟机,deepin端配置
linux·ide·vscode
Gowilli2 天前
SSH私钥登陆方案配置及VSCode支持
运维·vscode·ssh