A. 最終效果
-
根據
__init__.py
配置launch.json
-
根據中
utils/chat.py
中form_data
的'messages' = [{'role': 'user', 'content': '唐老鴨'}]
,可以找到用戶輸入,進而通過關鍵詞或模型調用的方式,對敏感問題進行特殊處理。
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