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

相关推荐
holeer2 天前
VS Code插件离线迁移教程
ide·vscode
jimy12 天前
关闭VS Code中的GitHub Copilot部分功能,降低远程开发机服务器的CPU内存使用率
vscode·copilot
chinxue20082 天前
VSCODE使用vivado
ide·vscode·fpga开发·编辑器
jimy12 天前
本地下载vscode server安装包(tar.gz)然后上传至服务器开发机
服务器·ide·vscode
匆匆整棹还2 天前
vscode突然无法连接远程服务器问题
服务器·vscode
小代码20162 天前
ubuntu vscode docker php 环境搭建
vscode·ubuntu·docker·php·laravel
thulium_2 天前
vscode 使用
ide·vscode·编辑器
2301_789015622 天前
C++:set/multiset和map/multimap文档详细解析
c语言·开发语言·c++·vscode·排序算法·set·map
emem.2 天前
【超详细】VSCode连接GitHub全攻略:上传/克隆代码一步到位
ide·vscode·github
彭石榴2 天前
github copilot学生认证教程,免费使用两年Copilot Pro!!(避免踩坑版)
vscode·github·copilot