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

相关推荐
明月夜&43 分钟前
Ubuntu 20.04 Docker 部署 Ollama + DeepSeek-Coder:本地 AI 编程助手实战
git·vscode·ubuntu·docker·大语言模型·智能体
码匠许师傅1 小时前
【STM32开发笔记】基于STM32CubeMX2 和STM32CubeIDE for VSCode的全新STM32C5开发体验
笔记·vscode·stm32
Stone_OverLooking1 小时前
vscode 配置Qt qmake项目
ide·vscode·qt
ฅ ฅBonnie2 小时前
使用 VSCODE 连接远程服务器上的容器
服务器·ide·vscode
守护安静星空2 小时前
esp32开发笔记-wifi网络
网络·笔记·vscode·单片机·tcp/ip
ol木子李lo2 小时前
Qt6 替代废弃 QMediaPlaylist 的解决方案
c语言·c++·vscode·qt·个人开发·visual studio·qt6.3
lss_dgr11 小时前
vscode中ssh环境登录copilot没有反应的问题解决
ide·vscode·copilot
云淡风轻__18 小时前
在 VSCode 中配置 LaTeX 环境的保姆级教程
ide·vscode·编辑器
水云桐程序员1 天前
一个GCC编译C语言命令的执行过程和错误输出:目录不存在:当前目录下没有output子目录|C语言编译的解决办法|Visual Studio Code
c语言·开发语言·vscode
Zender Han1 天前
VS Code 开发 Flutter 常用快捷键和插件工具详解
android·vscode·flutter·ios