chainlit
chainlit copied to clipboard
Copilot doesn´t work 'TypeError: window.mountChainlitWidget'
I am trying to build a chainlit app with copilot, but I can't get the copilot.
I only installed chainlit and run the file following the tutorial.
Uncaught TypeError: Failed to construct 'URL': Invalid URL at index.js:275:3885 at index.js:4208:91586 index.html:12 Uncaught TypeError: window.mountChainlitWidget is not a function at index.html:12:12
Code:
import chainlit as cl
@cl.on_message
async def on_message(msg: cl.Message):
if cl.context.session.client_type == "copilot":
fn = cl.CopilotFunction(name="test", args={"msg": msg.content})
res = await fn.acall()
await cl.Message(content=res).send()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</script>
<script src="http://localhost:8000/copilot/index.js"></script>
<script>
window.mountChainlitWidget({
chainlitServer: "http://localhost:8000",
});
</script>
</body>
</html>
can you share your running script from the bash, how do you are running the app ? I dont have your problem with the last version of chainlit.
I'm running like this and did not have any issue:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="http://192.168.0.150:8889/copilot/index.js"></script>
...
I can reproduce it, but only if the <meta charset="UTF-8">
is missing.