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

相关推荐
zfj32118 小时前
vscode是js开发的,为什么能支持golang java等各种语言开发
javascript·vscode·golang
有梦想的鱼20 小时前
vscode letax编译中英文论文(傻瓜式、一分钟)
ide·vscode·编辑器
春日见1 天前
ubuntu以前可以联网,突然无法上网了
linux·服务器·ubuntu·debug
Lei活在当下1 天前
【项目踩坑实录】并发环境下,Glide缓存引起的图片加载异常
android·debug·glide
猪在黑魔纹里2 天前
解决VSCode无法高亮、解析numpy中的部分接口(如pi、deg2rad)
ide·vscode·python·numpy
辣椒酱.2 天前
vscode报错------控制台
vscode·编辑器
欢喜躲在眉梢里2 天前
基于 openFuyao 社区的无硬件 UB 开发实战指南
运维·数据库·人工智能·vscode·ai·开发工具·go开发
粤M温同学2 天前
VsCode快速打出console.log()方法设置
vscode·编辑器
阿关@2 天前
Vscode中Python无法将pip/pytest”项识别为 cmdlet、函数、脚本文件或可运行程序的名称
vscode·python·pip
前端小臻2 天前
分享一个vscode的todo插件(todo Tree 包含使用
ide·vscode·编辑器