chainlit
chainlit copied to clipboard
How to debug a chainlit app
Hi there!
I've built my first chainlit app. It's very simple and it runs like this.
cd ./chainlit-backend
chainlit run app.py -h
Start the React app
cd ./frontend
npm i
npm run dev
How do I set it where I set break points in my IDE and debug? I'm currently using cursor but I have VS code and intellij as well. Any guidance would be amazing-- I would love to move forward but I think I'll be stumped until I can play around with breakpoints. Thank you
Hi,
In your main application script add:
if __name__ == "__main__":
from chainlit.cli import run_chainlit
run_chainlit(__file__)
Then run the script from your IDE in debug mode. I hope this will help. Best
In your main application script add:
if __name__ == "__main__":from chainlit.cli import run_chainlitrun_chainlit(__file__)Then run the script from your IDE in debug mode. I hope this will help. Best
That's exactly how we do it as well. I think it should be added to the documentation.
Added this under 'advanced features' in the docs, although I also feel it should be in the cookbook as well.
I believe this pull request (https://github.com/Chainlit/docs/pull/107) is merged. I'm new to GitHub project (and contributing also!), but in my experience, merged pull requests are automatically closed. Why is it not the case here? I can help if needed.
I believe this pull request (Chainlit/docs#107) is merged. I'm new to GitHub project (and contributing also!), but in my experience, merged pull requests are automatically closed. Why is it not the case here? I can help if needed.
I think the PR is not linked to this issue.