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

相关推荐
小宋加油啊1 天前
Mac vscode安装PCL
ide·vscode·macos
꯭爿꯭巎꯭1 天前
visual studio code (vscode)下载
ide·vscode·编辑器
magic334165631 天前
ESP32S3开发环境介绍和创建工程
vscode·c·头文件
萌萌站起1 天前
Vscode 中 python模块的导入问题
ide·vscode·python
aqiu~1 天前
VSCode编辑器用于Unity项目
vscode·unity
ZXF_H2 天前
VSCode C/C++函数Ctrl+鼠标点击无法跳转的解决方法
c++·ide·vscode
zhangfeng11332 天前
vscode 之类的编辑器 ,跳转到某一个函数 方法 是什么快捷键 this->getEbayReturns($shop);
ide·vscode·编辑器
ShawnLiaoking2 天前
vscode 配置环境
ide·vscode·编辑器
弈风千秋万古愁2 天前
vscode使用markdown+plantuml
vscode·markdown·plantuml
日更嵌入式的打工仔2 天前
Visual Studio 与 Visual Studio Code 区别
ide·vscode