chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

How to debug a chainlit app

Open holleymcshan opened this issue 1 year ago • 5 comments

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

holleymcshan avatar Mar 02 '24 20:03 holleymcshan

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

maciejwojcik86 avatar Mar 07 '24 07:03 maciejwojcik86

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

That's exactly how we do it as well. I think it should be added to the documentation.

rauchrob avatar Mar 07 '24 08:03 rauchrob

I put in a PR.

Added this under 'advanced features' in the docs, although I also feel it should be in the cookbook as well.

dahifi avatar Mar 08 '24 17:03 dahifi

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.

fdaligand avatar May 17 '24 13:05 fdaligand

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. image

rauchrob avatar May 22 '24 07:05 rauchrob