chainlit
chainlit copied to clipboard
Copilot Javascript Error - Invalid or unexpected token
Describe the bug Using a very minimal HTML file served up next to the instance, the following error occurs:
index.js:61 Uncaught SyntaxError: Invalid or unexpected token (at index.js:61:4443)
To Reproduce chainlit = "1.1.305"
HTML Source:
<html>
<head>
<title>Chainlit Test</title>
</head>
<body>
<h1> Test</h1>
<script src="https://<server>/copilot/index.js"></script>
<script>
window.mountChainlitWidget({
chainlitServer: "https://<server>/",
});
</script>
<h1>End Test</h1>
</body>
</html>
Expected behavior Copilot loads
Screenshots N/A. Console output:
Uncaught SyntaxError: Invalid or unexpected token test.html:9 Uncaught TypeError: window.mountChainlitWidget is not a function at test.html:9:18
Desktop (please complete the following information):
- Mac OS 14.5 (23F79)
- Chrome Version 127.0.6533.89 (Official Build) (arm64)
Found the issue myself. Digging into the JS, it appeared to be an issue within lodash, which was documented on the lodash issue tracker.
The <meta charset="UTF-8"> within the html head tag is essential.