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

How to make the app built by chainlit run completely offline? #1444

Open
Valdanitooooo opened this issue Oct 17, 2024 · 2 comments
Open

How to make the app built by chainlit run completely offline? #1444

Valdanitooooo opened this issue Oct 17, 2024 · 2 comments
Labels
frontend Pertains to the frontend.

Comments

@Valdanitooooo
Copy link

I noticed that there will be access to external CSS resources here

href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"

Copy link

dosubot bot commented Oct 17, 2024

To make a Chainlit app run completely offline, you need to replace external resources with local ones. Here's how you can do it:

  1. Download External Resources Locally: Download the CSS files from the external links, such as the KaTeX library and Google Fonts, and save them in your project's directory.

  2. Update index.html: Modify the index.html file to reference these local files instead of the external URLs. For example, replace:

    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">

    with:

    <link href="/path/to/local/katex.min.css" rel="stylesheet">
    <link href="/path/to/local/inter.css" rel="stylesheet">
  3. Serve Local Files: Ensure that your local server is configured to serve these files correctly.

  4. Configure Chainlit: Use the config.toml file to specify any custom CSS or JavaScript if needed. You can use custom_css and custom_js settings to point to your local resources.

By following these steps, you can ensure that your Chainlit app does not rely on external resources and can run offline.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the frontend Pertains to the frontend. label Oct 17, 2024
@Valdanitooooo
Copy link
Author

My current solution is to replace index.html when deploying the Chainlit application on the server using docker compose.

volumes:
	- ${VOLUME_DIR_PROD}/html/index.html:/root/.local/lib/python3.11/site-packages/chainlit/frontend/dist/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Pertains to the frontend.
Projects
None yet
Development

No branches or pull requests

1 participant