chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

Backend changes not reflecting

Open parthdacoder opened this issue 1 year ago • 4 comments

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?

parthdacoder avatar Feb 15 '24 05:02 parthdacoder

For reference: Frontend Changes to the frontend section are taking place!

parthdacoder avatar Feb 15 '24 05:02 parthdacoder

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.

willydouhard avatar Feb 18 '24 11:02 willydouhard

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:

image

parthdacoder avatar Feb 19 '24 06:02 parthdacoder

I'm trying to understand exactly what's the issue, are you using the -w argument when launching Chainlit (file watcher)?

tpatel avatar Mar 05 '24 09:03 tpatel