gptscript-ai / desktop

MIT License
22 stars 13 forks source link

Misleading to see oauth flow presented for tools unrelated to the query. #388

Open sangee2004 opened 2 months ago

sangee2004 commented 2 months ago

Electron build - 090c16f8

Steps to reproduce the problem:

Scenario1:

  1. Start a chat with Tildy
  2. Add 2 tools ( outlook mail and outlook calendar) (Make sure you dont have credentials relating to mail/calendar before this)
  3. Chat with the assistant and ask about some information about calendar I am presented with 2 oauth flows relating to outlook
Screenshot 2024-08-30 at 9 44 26 AM

Scenario 2:

  1. Create an assistant with any tool (outlook email tool in my case)
  2. Chat with this tool.
  3. Add slack tool.( (Make sure you dont have credentials relating to slack before this)
  4. Ask any email related question

I am presented with oauth flows relating to slack

Screenshot 2024-08-30 at 10 56 13 AM

Expected Behavior: User should not be presented with oauth flow for tools unrelated to the query.

g-linville commented 2 months ago

Both of these scenarios happen because the tools are dynamically added. The Outlook and Slack tools are tool sets that are shared as context tools, each of which has a Share Credential line in them. If you were to include these in an assistant ahead of time (instead of dynamically adding them), you would be prompted of all of the credentials before sending your first message. When dynamically adding them, you don't get prompted until after you send a message, at which point it looks through the context tools it needs to run and then executes them.

If the logic for dynamic tool adding has been implemented in core GPTScript, then this is something I could adjust to take care of either immediate (as soon at the tools are added) or only as needed. However, if the dynamic tool adding is still implemented either in only the SDK or only the UI, then this isn't really possible.

cc @cjellick