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 · 7 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.

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