Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jinja2 index template #1196

Closed
wants to merge 3 commits into from

Conversation

dokterbob
Copy link
Collaborator

@dokterbob dokterbob commented Aug 8, 2024

Jinja2 (rather than custom template) in index view. Would allow future overrides of headers, including arbitrary JS and meta tags (analytics, ads, Twitter cards, whatever) which we'll submit as a second patch.

Right now, the backend reads a file from the frontend dist folder and the index.html from the frontend is not valid HTML anymore.

Many creds to @dhruvsyos who did the heavy lifting on this one.

@dokterbob dokterbob force-pushed the jinja2_index_template branch from b6f23ee to 2934913 Compare August 8, 2024 10:12
@synergyai-os
Copy link

Exciting! Can't wait for this to be approved and add tracking into my chainlit app with amplitude

@dokterbob
Copy link
Collaborator Author

@willydouhard Curious to hear your opinion on the question from above, as it's a non-trivial design decision:

Right now, the backend reads a file from the frontend folder and the index.html from the frontend is not valid HTML anymore.

Question to the maintainer: should we keep a default index.html in the frontend (as valid HTML), then have a Jinja2 template in the backend which allows overrides?

@dokterbob dokterbob force-pushed the jinja2_index_template branch from 2934913 to 56a8769 Compare August 19, 2024 14:03
@dokterbob dokterbob added the backend Pertains to the Python backend. label Aug 22, 2024
@dokterbob dokterbob force-pushed the jinja2_index_template branch from 56a8769 to c880032 Compare August 27, 2024 10:41
@dokterbob dokterbob marked this pull request as ready for review August 27, 2024 11:11
@dokterbob
Copy link
Collaborator Author

Please don't review yet, I'd still like to add unit tests and think really well about where and how to place this index.html -- the current strategy seems rather inelegant.

@ahmadmayahi
Copy link

Any updates on this PR?

@dokterbob dokterbob added debate Under open debate. enhancement New feature or request labels Sep 3, 2024
@dokterbob dokterbob marked this pull request as draft September 7, 2024 10:33
@dokterbob dokterbob self-assigned this Sep 7, 2024
@dokterbob
Copy link
Collaborator Author

Any updates on this PR?

I'm working on test coverage for unit test views and considering to properly implement this following #1268.
In addition, I want to make it possible for people to install chainlit as --editable through #1224.

@dokterbob dokterbob closed this Oct 22, 2024
@dokterbob dokterbob deleted the jinja2_index_template branch October 22, 2024 09:09
@dokterbob dokterbob restored the jinja2_index_template branch October 22, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Pertains to the Python backend. debate Under open debate. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants