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

相关推荐
CodeQingqing5 小时前
cubemx + Keil + vscode + Keil Assistant 工作流
ide·vscode·编辑器·keil
Chasing Aurora6 小时前
vscode连接 服务器进行 深度学习
linux·ide·vscode·深度学习·研究生·解压缩·连接服务器
西柚云19 小时前
把Codex装进VSCode!OpenAI编程助手插件版来了
服务器·ide·vscode·ai编程·codex
推理幻觉21 小时前
vs code ssh使用codex
vscode·ssh·codex
十铭忘1 天前
windows下右键没有通过Vscode打开
ide·windows·vscode
红叶尽染寂绀蓝1 天前
已解决:同一ip下,Mac和Windows同时用vscode连接某个Linux远程服务器后,Mac再次连接时无法正确打开远程文件夹,由于转发设置导致
linux·服务器·windows·vscode·tcp/ip·macos
Nicolas8931 天前
解决Cursor连远程服务器慢的问题
服务器·vscode·cursor·速度慢·连接远程服务器·ai编程ide
charlie1145141912 天前
从0开始榨干 Claude Code:VSCode 实战配置与默认读取文件完整踩坑记录
ide·vscode·编辑器
secondyoung3 天前
Git使用:Git使用问题及解决方法总结
windows·经验分享·git·vscode·gitee·github·gitcode
念越4 天前
VS2022安装与第一个C程序编写教程
c++·vscode