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

相关推荐
SiYuanFeng2 小时前
vscode中markdown使用单个$显示公式($...$),preview页面里公式显示失败
ide·vscode·编辑器
御坂10101号2 小时前
Total Recall:让 Claude 学会忘记,优化记忆管理
经验分享·vscode·开源·软件工程·ai编程
嵌入小生0074 小时前
线程 --- 嵌入式(Linux)
linux·vscode·vim·嵌入式·线程·进程
coderYYY16 小时前
VSCode终端启动报错
前端·ide·vscode·npm·编辑器
淡海水20 小时前
【节点】[EyeSurfaceTypeDebug节点]原理解析与实际应用
unity·游戏引擎·debug·shadergraph·图形·surface·eye
qinaoaini21 小时前
[golang][MAC]Go环境搭建+VsCode配置
vscode·macos·golang
风静如云2 天前
VSCode:避免打开新文件时会在标签页覆盖旧文件
vscode
春日见2 天前
如何查看我一共commit了多少个,是哪几个,如何回退到某一个版本
vscode·算法·docker·容器·自动驾驶
西柚云2 天前
告别命令行!在VSCode中直接使用Claude Code编程
服务器·ide·vscode·编辑器·claude
___波子 Pro Max.2 天前
解决vscode code命令找不到问题
vscode