Files
chatwoot/enterprise/app/models/response_source.rb
Sojan Jose 480f34803b feat: Response Bot using GPT and Webpage Sources (#7518)
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.
2023-07-21 18:11:51 +03:00

29 lines
911 B
Ruby

# == Schema Information
#
# Table name: response_sources
#
# id :bigint not null, primary key
# name :string not null
# source_link :string
# source_model_type :string
# source_type :integer default("external"), not null
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# inbox_id :bigint not null
# source_model_id :bigint
#
# Indexes
#
# index_response_sources_on_source_model (source_model_type,source_model_id)
#
class ResponseSource < ApplicationRecord
enum source_type: { external: 0, kbase: 1, inbox: 2 }
belongs_to :account
belongs_to :inbox
has_many :response_documents, dependent: :destroy
has_many :responses, through: :response_documents
accepts_nested_attributes_for :response_documents
end