欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > 250405-VSCode编辑launch.json实现Debug调试Open-WebUI

250405-VSCode编辑launch.json实现Debug调试Open-WebUI

2025/4/9 13:08:07 来源:https://blog.csdn.net/qq_33039859/article/details/147017515  浏览:    关键词:250405-VSCode编辑launch.json实现Debug调试Open-WebUI

A. 最终效果

  • 根据__init__.py配置launch.json

在这里插入图片描述

  • 根据中utils/chat.pyform_data'messages' = [{'role': 'user', 'content': '唐老鸭'}],可以找到用户输入,进而通过关键词或模型调用的方式,对敏感问题进行特殊处理。

在这里插入图片描述

在这里插入图片描述

  • 模型响应

utils/middleware.py
在这里插入图片描述

B. 文件配置

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

  • vscode 使用python虚拟环境,配置 fastapi 开发_vscode fastapi-CSDN博客
  • vscode调试进入第三方库,justMyCode无效问题!_vscode justmycode-CSDN博客
  • How to disable “just my code” setting in VSCode debugger? - Stack Overflow

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词