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

feat: Response Bot using GPT and Webpage Sources #7518

Merged
merged 41 commits into from
Jul 21, 2023

Conversation

sojan-official
Copy link
Member

@sojan-official sojan-official commented Jul 13, 2023

About

This PR lets you associate response sources to an inbox, ie: external webpages, which would be parsed by Chatwoot automatically. This information is then supplied to GPT to automatically triage customer queries

Testing the changes

  • Enable the feature: creates the tables and enables the extensions ( tables for this feature is managed separately from migrations )
Features::ResponseBotService.new.enable_in_installation
# enable feature for inbox account where you are testing
Inbox.find(id).account.enable_features('response_bot')
  • Add the OPENAI_API_KEY to your environment variable
  • Associate knowledge source / documents to an inbox using the following API call
## change the inbox id and API token in payload
## change the source and document links if  you wish


curl  -X POST \
  'http://localhost:3000/api/v1/accounts/1/response_sources' \
  --header 'Accept: */*' \
  --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \
  --header 'api_access_token: <your API token>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "response_source": {
    "name": "Chatwoot HelpCenter",
    "source_link": "https://www.chatwoot.com/help-center",
    "inbox_id":   '<your inbox id>',
    "response_documents_attributes": [
      { "document_link": "https://www.chatwoot.com/docs/self-hosted/deployment/architecture" },
      { "document_link": "https://www.chatwoot.com/docs/self-hosted/deployment/requirements"},
      { "document_link": "https://www.chatwoot.com/docs/self-hosted/deployment/troubleshooting"},
      { "document_link": "https://www.chatwoot.com/docs/contributing-guide"},
      { "document_link": "https://www.chatwoot.com/docs/contributing-guide/chatwoot-apis"},
      { "document_link": "https://www.chatwoot.com/docs/contributing-guide/code-of-conduct"}
    ]
  }
}
'


#### body payload
{
  "response_source": {
    "name": "Chatwoot HelpCenter",
    "source_link": "https://www.chatwoot.com/help-center",
    "inbox_id": 2,
    "response_documents_attributes": [
      { "document_link": "https://www.chatwoot.com/docs/self-hosted/deployment/architecture" },
      { "document_link": "https://www.chatwoot.com/docs/self-hosted/deployment/requirements"},
      { "document_link": "https://www.chatwoot.com/docs/self-hosted/deployment/troubleshooting"},
      { "document_link": "https://www.chatwoot.com/docs/contributing-guide"},
      { "document_link": "https://www.chatwoot.com/docs/contributing-guide/chatwoot-apis"},
      { "document_link": "https://www.chatwoot.com/docs/contributing-guide/code-of-conduct"}
    ]
  }
}

  • Check the console / db to see if Responses are generated and try Chating on the widget

Follow up from spike: #7162

@netlify
Copy link

netlify bot commented Jul 13, 2023

Deploy Preview for chatwoot-storybook canceled.

Name Link
🔨 Latest commit acf5b66
🔍 Latest deploy log https://app.netlify.com/sites/chatwoot-storybook/deploys/64ba93f694f0fc0008868df1

@sojan-official sojan-official marked this pull request as ready for review July 21, 2023 12:09
@sojan-official sojan-official merged commit 480f348 into develop Jul 21, 2023
@sojan-official sojan-official deleted the chore/response-sources-with-embeddings branch July 21, 2023 15:11
tejaswinichile pushed a commit that referenced this pull request Jul 27, 2023
This commit introduces the ability to associate response sources to an inbox, allowing external webpages to be parsed by Chatwoot. The parsed data is converted into embeddings for use with GPT models when managing customer queries.

The implementation relies on the `pgvector` extension for PostgreSQL. Database migrations related to this feature are handled separately by `Features::ResponseBotService`. A future update will integrate these migrations into the default rails migrations, once compatibility with Postgres extensions across all self-hosted installation options is confirmed.

Additionally, a new GitHub action has been added to the CI pipeline to ensure the execution of specs related to this feature.
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants