slack-chatgpt icon indicating copy to clipboard operation
slack-chatgpt copied to clipboard

Support conversational context

Open robertu7 opened this issue 2 years ago • 1 comments

Thanks for building such an amazing Slack App, working well so far with ChatGPT API!

However, I found that it doesn't support conversational context (like thread or reply as context). Do you have any plans to support this or any thoughts? To my understanding, the implementation may need:

  • Slack API retrieves all messages from a given thread;
  • Cloudflare Workers KV to store conversation id and contents;
  • For DM, a new Slack command to start a new conversation;

robertu7 avatar Mar 07 '23 09:03 robertu7

@robertu7

Thanks for opening the issue and for your feedback!

We discussed building a feature similar to the feature you describe into the project but decided not to do it at this time. As you point out, it'll require that the bot starts reading messages other than those explicitly sent to it through direct messages, mentions, the shortcuts, or the slash command. We are not currently fully comfortable providing all these messages to OpenAI without explicit user approval.

All that said, I think it's perfectly reasonable to build this into slack-chatgpt. I do, however, think developers should have a way of opting out of this behavior when deploying the project, possibly through an environment variable or by leaving out some configuration of the app in the Slack workspace.

I think it should be fairly straightforward to support and you may be able to eliminate Cloudflare Workers KV from the equation. Remember that OpenAI's ChatGPT API only supports around 4.500 tokens in a request. Upon invoking the bot it could scan the Slack conversation to find those 4.500 tokens, send them to OpenAI's API, and forward the response to the Slack conversation. This way you would avoid storing any (potentially) sensitive data in Cloudflare.

I am happy to review and ultimately approve a PR with these changes, should you decide to look into it.

simonbs avatar Mar 07 '23 19:03 simonbs