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

相关推荐
琢瑜2 小时前
VS Code 最下面那一整条蓝色状态栏不见了怎么恢复(Status Bar)状态栏(Status Bar)
vscode
努力的小帅5 小时前
通过VSCode远程连接到CentOS7/Ubuntu18等老系统
ide·vscode·编辑器
MC皮蛋侠客5 小时前
distcc结合VSCode实现分布式编译的全面指南
c++·ide·分布式·vscode
风为你而吹6 小时前
mac m3上使用vscode + platformio开发esp32
ide·vscode·macos
坚果派·白晓明6 小时前
【开发者可选工具】Windows 11 安装 Visual Studio Code 完整指南
ide·windows·vscode·开发者可选工具·开源项目可选ide
づ安眠丶乐灬15 小时前
计算机视觉中的多视图几何 - 1
人工智能·vscode·计算机视觉
咩咩大主教17 小时前
VSCode远程连接Linux部署的Docker
linux·vscode·docker
UVM_ERROR18 小时前
RDMA Scheduler + TX + Completion RTL 开发经验分享
笔记·vscode·ssh·github·芯片
JobDocLS1 天前
VScode使用方法
ide·vscode·编辑器
hoppss1 天前
vscode config
vscode