chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

BUG/TEAMS Integration : Maintain Chat Session Context and Prevent New Thread on Each Message

Open dominpm opened this issue 9 months ago • 4 comments

When using Chainlit’s Microsoft Teams integration, each new user message currently reloads the chat and starts a new thread, causing a loss of conversation context. This makes it difficult to build conversational bots that rely on persistent sessions and memory.

I would be really good to have:

  • The ability to maintain a chat session within an existing Teams conversation, so that context is preserved across messages.
  • A memory feature that allows the bot to remember previous interactions within the same Teams chat.
  • Documentation or guidance on how a new session could be intentionally triggered (e.g., via a command or specific message), rather than starting a new session with every new message by default.

Questions:

  • Is there a recommended approach for session management and memory persistence with Teams integration?
  • How could developers override the current new-thread behavior to implement custom session logic?
  • Would it be possible to provide an example of how to programmatically start or reset a session when needed?

Any support, examples, or roadmap updates on this would be greatly appreciated!

dominpm avatar Apr 16 '25 10:04 dominpm

#1426

dominpm avatar Apr 16 '25 10:04 dominpm

Is this happening in group chats or dms? I think this is pretty easy to fix but I don't have a teams bot setup on my end

willydouhard avatar Apr 17 '25 13:04 willydouhard

It is happening in both ways, both dms and adding the app in a griup chat. Is there any more config to add to the chainlit app aside from the proper Teams envs?

dominpm avatar Apr 18 '25 15:04 dominpm

@willydouhard Is cl.user_session available when chatting through teams? And is there an alternative for fetch_slack_message_history for MS Teams?

dominpm avatar Apr 21 '25 11:04 dominpm

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Jul 27 '25 02:07 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Aug 04 '25 02:08 github-actions[bot]

I think I am faced with the same problem, but in slack. When I output print(f"[Chainlit] Session ID: {cl.user_session.get('id')}") I get a new id for every interaction, which means I loose my user state.

epugh avatar Nov 14 '25 19:11 epugh