feat(ee): Add Captain features (#10665)

Migration Guide: https://chwt.app/v4/migration

This PR imports all the work related to Captain into the EE codebase. Captain represents the AI-based features in Chatwoot and includes the following key components:

- Assistant: An assistant has a persona, the product it would be trained on. At the moment, the data at which it is trained is from websites. Future integrations on Notion documents, PDF etc. This PR enables connecting an assistant to an inbox. The assistant would run the conversation every time before transferring it to an agent.
- Copilot for Agents: When an agent is supporting a customer, we will be able to offer additional help to lookup some data or fetch information from integrations etc via copilot.
- Conversation FAQ generator: When a conversation is resolved, the Captain integration would identify questions which were not in the knowledge base.
- CRM memory: Learns from the conversations and identifies important information about the contact.

---------

Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
Co-authored-by: Sojan <sojan@pepalo.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
Pranav
2025-01-14 16:15:47 -08:00
committed by GitHub
parent 7b31b5ad6e
commit d070743383
184 changed files with 6666 additions and 2242 deletions

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: @response

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @responses do |response|
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: response
end
end
json.meta do
json.total_count @responses_count
json.page @current_page
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: @response

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: @response

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: @assistant

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @assistants do |assistant|
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: assistant
end
end
json.meta do
json.total_count @assistants.count
json.page 1 # Pagination not yet support at the moment, structure is reserved for future use
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: @assistant

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: @assistant

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/document', formats: [:json], resource: @document

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @documents do |document|
json.partial! 'api/v1/models/captain/document', formats: [:json], resource: document
end
end
json.meta do
json.total_count @documents_count
json.page @current_page
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/document', formats: [:json], resource: @document

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/inbox', formats: [:json], resource: @captain_inbox.inbox

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @inboxes do |inbox|
json.partial! 'api/v1/models/inbox', formats: [:json], resource: inbox
end
end
json.meta do
json.total_count @inboxes.count
json.page 1
end

View File

@@ -0,0 +1,7 @@
json.account_id resource.account_id
json.config resource.config
json.created_at resource.created_at.to_i
json.description resource.description
json.id resource.id
json.name resource.name
json.updated_at resource.updated_at.to_i

View File

@@ -0,0 +1,16 @@
json.account_id resource.account_id
json.answer resource.answer
json.assistant do
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: resource.assistant
end
json.created_at resource.created_at.to_i
if resource.document
json.document do
json.id resource.document.id
json.external_link resource.document.external_link
json.name resource.document.name
end
end
json.id resource.id
json.question resource.question
json.updated_at resource.updated_at.to_i

View File

@@ -0,0 +1,11 @@
json.account_id resource.account_id
json.assistant do
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: resource.assistant
end
json.content resource.content
json.created_at resource.created_at.to_i
json.external_link resource.external_link
json.id resource.id
json.name resource.name
json.status resource.status
json.updated_at resource.updated_at.to_i