Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.29k stars 960 forks source link

Use Jinja2 template for index.html instead of placeholders #1091

Open dokterbob opened 5 months ago

dokterbob commented 5 months ago

The current index.html uses custom placeholders for search and replace rather than a standardised template language.

Advantages

  1. Make the code more accessible to developers, they already know the language and so does their editor.
  2. Because of 1, will make it easier to extend the templates, e.g. allowing to add headers or parameters.
  3. Increase performance and security -- search and replace is really not the best way to do templating.

Question

Are there any reasons for not using Jinja2 or other production-grade templates?

Happy to contribute

I am happy to make a PR to this extend, my eventual goal being to allow injection of arbitrary headers -- but doing the template well seems a smell effort on the road. This ticket is to discuss the details before I'll make a go at it.

PS

❤️ ❤️ ❤️ chainlit. Great work, thanks for the Open Source love!

willydouhard commented 4 months ago

Hello, I think there is no reason to not use a templating language here, we just went for the quick and dirty approach on this one!