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

相关推荐
GDAL1 小时前
vscode 使用正则查找替换
ide·vscode·正则表达式·编辑器
HERR_QQ3 小时前
【cpp tool】GDB coredump vscode GUI 和多线程常用笔记
ide·笔记·vscode
研來如此3 小时前
VSCode连接远程服务器
服务器·ide·vscode
GHL2842710904 小时前
VSCode无法连接虚拟机,报错“XHR failed“,手动部署VSCode Server
ide·vscode·编辑器
啃火龙果的兔子4 小时前
vscode中的git插件
git·vscode·elasticsearch
deng-c-f14 小时前
配置(11):vscode中使用bookmarks扩展
ide·vscode·编辑器
CRAB19 小时前
解锁移动端H5调试:Eruda & VConsole 实战指南
前端·debug·webview
啃火龙果的兔子20 小时前
目前免费的ai编辑器或者vscode适用的免费的ai插件有哪些
人工智能·vscode·编辑器
小桥流水人家丶20 小时前
vscode 格式Prettier配置
ide·vscode·编辑器
番茄灭世神1 天前
使用VScode开发ARM核芯片通用配置
arm开发·vscode·mcu·cmake·clangd·llvm·ninja