Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dev support]: How to start a new turn with previous user message in the onUserSignInSuccess sign-in success callback #2091

Open
Benjiiim opened this issue Oct 7, 2024 · 9 comments
Labels
dev support Dev support tracking

Comments

@Benjiiim
Copy link
Contributor

Benjiiim commented Oct 7, 2024

Is there a way to start a new turn with previous user message in the onUserSignInSuccess sign-in success callback?

I know how to get the message through the context.activity.text but I don't know what to do with it.

Thanks a lot

@Benjiiim Benjiiim added the dev support Dev support tracking label Oct 7, 2024
@Benjiiim
Copy link
Contributor Author

Might be related to #885

@singhk97
Copy link
Collaborator

You could abstract away logic for the onMessage handler or handlers for message activity types and invoke them in the onUserSignInSuccess callback.

@Benjiiim
Copy link
Contributor Author

Benjiiim commented Nov 4, 2024

Thanks for your time @singhk97
That can be a workaround for bots that rely on message activity types, but as you know better than me, one benefit of using Teams AI Library is to pass the user input to the AI Module when no activity handler are registered.
Is there a way to leverage this capability with the user input that triggered the sign-in flow?

@lilyydu
Copy link
Contributor

lilyydu commented Nov 6, 2024

Hi @Benjiiim,

May I ask what you are planning to do with the turn and user input after the user is signed in? Another idea is registering an afterTurn handler for further processing. These handlers allow for the turn state to be modified/inspected after the turn is processed

@Benjiiim
Copy link
Contributor Author

Benjiiim commented Nov 6, 2024

I should have mentioned in my previous messages that I'm thinking about the auto sign in feature, which means that the app will trigger the sign in flow even if the user is sending a message not related to authentication at all.

That can lead to weird exchanges such as:

User > I need help to do something
Bot (from the sign-in success callback) > You have been signed in. What can you do for you?
User > Well... ok but what about the help I've asked in my previous message?
Bot > I'm sorry, I don't know what you are referring to. How can I help?

That's why I'm looking for a way to have the user message processed by the app after a successful sign-in.

Does that make more sense?

@lilyydu
Copy link
Contributor

lilyydu commented Nov 6, 2024

Yup, that makes more sense, thank you for clarifying

Unfortunately there is no straightforward way to begin a new turn during this callback. For auto-sign in, this scenario is primarily useful if the user should be signed in (by default) before they attempt to interact with the bot. I would suggest only following this route if that is the desired scenario

The only workaround I can think of as of now is to register some form of activity handler within the callback (though I know you mentioned you wanted to pipe this directly into the AI class)

@Benjiiim
Copy link
Contributor Author

Benjiiim commented Nov 7, 2024

auto-sign in is very important in the projects I'm working with: B2B SaaS ISVs/Startups' apps deployed through the Teams store.
As store apps are available to every Teams users out there, sign in is required before interacting to the bot in order not to expose the LLM to non-customers (mainly for cost reasons as the ISV would pay for the tokens used to chat with non-paying users).

you mentioned you wanted to pipe this directly into the AI class

And even before the AI class, as the logic that choose between the activity handlers and the AI Module might be needed. Even before that actually, to the Before Turn handler for example as it might be useful to be rerun now that the user is authenticated. That's why I talked about the need to create a new turn, hoping that it would be possible.

@lilyydu
Copy link
Contributor

lilyydu commented Nov 7, 2024

Gotcha, thank you for clarifying

For all sign-in flows, the final part is the signInVerifyState callback. As a result of this route being called, by default, the AI module does not run. You won't be able to generate a new turn during this. However, onUserSignInSuccess callback happens after this, so your best bet will still be using this callback

@Benjiiim
Copy link
Contributor Author

Benjiiim commented Dec 3, 2024

Hi @lilyydu,

The project I'm working (a multi-tenant ISV application published in the store) has just been approved for publication. :-)
However, the very first feedback received was the fact that the first interaction with the agent was weird, as it is ignoring the first message sent by the user. :-(
This is particularly awkward because it often involves conversation starters or prompt suggestions presented in the 1:1 starter screen.

From the user's perspective, these suggestions are rendered meaningless since the agent skips directly to the sign-in process. This creates confusion and frustration, especially for new users who may interpret this as a bug or a lack of responsiveness from the bot.

I understand that nothing can be done today but is there anything I can contribute to help prioritize the work needed to address this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev support Dev support tracking
Projects
None yet
Development

No branches or pull requests

3 participants