Backend changes not reflecting
I have an app.py file which as a demo was provided in one of your modules. I removed authentication, changed the welcome message and such changes are taking places at the react frontend too. But if I add a new function, no change appears on the frontend for example:
@cl.on_chat_start
async def on_chat_start():
await cl.Avatar(
name="Luminous Genie",
path="chainlit/libs/react-components/src/elements/images.png",
).send()
cl.user_session.set(
"message_history",
[{"role": "system", "content": "You are a helpful assistant."}],
)
await cl.Message(content="Connected with Lumie!").send()
Earlier the code was:
@cl.on_chat_start
async def on_chat_start():
cl.user_session.set(
"message_history",
[{"role": "system", "content": "You are a helpful assistant."}],
)
await cl.Message(content="Connected to Chainlit!").send()
And the earlier code was working fine and changes made to the content were also reflecting in runtime. Please tell what the issue is and how can it be resolved?
For reference:
Changes to the frontend section are taking place!
If I understand correctly you now have two on_chat_start functions? If that is the case, this is not supported, you should only declare one.
No that is not entirely the case. If I add the following part of the code then that part gets executed:
@cl.on_chat_start
async def on_chat_start():
cl.user_session.set(
"message_history",
[{"role": "system", "content": "You are a helpful assistant."}],
)
await cl.Message(content="Connected to Chainlit!").send()
But if I remove this and add another on_chat_start function, I just get the default screen by chainlit:
I'm trying to understand exactly what's the issue, are you using the -w argument when launching Chainlit (file watcher)?