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

相关推荐
小杨啥都学20 小时前
vscode修改默认终端
vscode
郝学胜-神的一滴1 天前
C++20模板元编程 01:从零吃透模板核心底层逻辑
开发语言·c++·vscode·程序人生·开源
無限進步D1 天前
VSCode 简介+安装+JavaWeb前端常用插件+简单配置
java·开发语言·css·vscode·html·css3·插件
Molesidy2 天前
【Git】分别给出添加到Keil工程和IAR工程中的gitnore文件以便不跟踪编译文件的git记录
git·vscode·插件
www.022 天前
Codex额度用完怎么办?Windows定时自动继续VS Code Codex任务实战
人工智能·windows·vscode·自动化·openai·codex·autohotkey
golang学习记2 天前
Zed 新特性:这次继续抄VSCode
vscode·编辑器·zed
InsightCore2 天前
别再往 Skill 里塞一切:我们如何重新思考 AI Debug Engineer
android·debug
皓月盈江2 天前
Linux系统使用VSCode搭建GO开发环境
linux·vscode·ubuntu·golang·debian
宁静致远20213 天前
VSCode 开发 STM32 的 Keil工程 (Keil Assistant)
vscode·stm32·stm32cubeide
晴天163 天前
VSCodium 项目介绍
前端·javascript·vscode