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

相关推荐
骑着毛驴数星星10 小时前
CANDB++中的CAN_DBC快速编辑方法,使用文本编辑器(如notepad++和VScode)
vscode·can
weixin_3077791319 小时前
VS Code配置MinGW64编译Ipopt库
开发语言·c++·vscode·算法
weixin_307779131 天前
VS Code配置MinGW64编译backward库
开发语言·c++·vscode·算法
QL.ql1 天前
vscode的ws环境,esp32s3连接wifi
ide·vscode·编辑器
Hyvial2 天前
VsCode 使用指南(配置 + 美化)
vscode
十秒耿直拆包选手2 天前
IDE:vscode的vue3模板
javascript·ide·vscode
QL.ql2 天前
vscode的wsl环境,ESP32驱动0.96寸oled屏幕
ide·vscode·编辑器
羊子雄起3 天前
GitHub宕机时的协作方案
运维·vscode·github·visual studio
霸气十足+拼命+追梦少年3 天前
vscode远程服务器出现一直卡在正在打开远程和连接超时解决办法
服务器·ide·vscode
QL.ql3 天前
(一)vscode搭建espidf环境
ide·vscode·编辑器