You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I'm saving the chat history to the postgresdb through data layer but when I'm doing the chat resume the history is not getting loaded but the chat title is coming up in the side bar and chat is also getting stored into the threads tables.
I have provided the code snippet which I'm using, please let me know if there are any issues in the approach or any changes needs to be done.
Hi
I'm saving the chat history to the postgresdb through data layer but when I'm doing the chat resume the history is not getting loaded but the chat title is coming up in the side bar and chat is also getting stored into the threads tables.
I have provided the code snippet which I'm using, please let me know if there are any issues in the approach or any changes needs to be done.
Code Snippet -
"""
connection_string = os.getenv('DB_CONNECTION_STRING')
cl_data._data_layer = SQLAlchemyDataLayer(conninfo=connection_string)
@cl.on_chat_start
async def start():
settings = await cl.ChatSettings(
[
Select(
id="model",
label="Large Language Model",
values=[
"gemini-1.5-flash",
"gpt-4o",
"llama3.2:3b"
],
initial_index=0,
),
]
).send()
setup_llm(settings)
@cl.on_chat_resume
async def on_chat_resume(thread: ThreadDict):
settings = await cl.ChatSettings(
[
Select(
id="model",
label="Large Language Model",
values=[
"gemini-1.5-flash",
"gpt-4o",
"llama3.2:3b"
],
initial_index=0,
),
]).send()
setup_llm(settings)
@cl.on_message
async def on_message(msg: cl.Message):
model_name = cl.user_session.get("model_name")
model = cl.user_session.get("model")
"""
The text was updated successfully, but these errors were encountered: