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

相关推荐
学嵌入式的小杨同学11 小时前
从零打造 Linux 终端 MP3 播放器!用 C 语言实现音乐自由
linux·c语言·开发语言·前端·vscode·ci/cd·vim
badfl14 小时前
VSCode Claude Code插件配置教程:使用、配置中转API、常见问题
人工智能·vscode·ai
aidou131420 小时前
Visual Studio Code(VS Code)安装步骤
vscode·npm·node.js·环境变量
学嵌入式的小杨同学1 天前
【Linux 封神之路】进程进阶实战:fork/vfork/exec 函数族 + 作业实现(含僵尸进程解决方案)
linux·开发语言·vscode·嵌入式硬件·vim·软件工程·ux
一路向北North1 天前
vscode 安装插件非常慢
ide·vscode·编辑器
小乔的编程内容分享站1 天前
C语言函数的声明和定义(文章包括当VScode中含多个.c文件且含.h文件如何同时编译
c语言·开发语言·vscode
怣疯knight1 天前
vscode的md文件显示memaid图
vscode
小乔的编程内容分享站2 天前
记录使用VSCode调试含scanf()的C语言程序出现的两个问题
c语言·开发语言·笔记·vscode
mancy_1212122 天前
复古C语言代码复活!——以121+hello.c为例摘要
c语言·vscode·gitee·visual studio·新人首发·turbo c
qq_397562312 天前
使用vscode , 开发keil单片机工程 . (为了使用ai助手)
ide·vscode·编辑器