mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-29 18:22:53 +00:00
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.
36 lines
1.3 KiB
Ruby
36 lines
1.3 KiB
Ruby
# When working with experimental extensions, which doesn't have support on all providers
|
|
# This monkey patch will help us to ignore the extensions when dumping the schema
|
|
# Additionally we will also ignore the tables associated with those features and exentions
|
|
|
|
# Once the feature stabilizes, we can remove the tables/extension from the ignore list
|
|
# Ensure you write appropriate migrations when you do that.
|
|
|
|
module ActiveRecord
|
|
module ConnectionAdapters
|
|
module PostgreSQL
|
|
class SchemaDumper < ConnectionAdapters::SchemaDumper
|
|
cattr_accessor :ignore_extentions, default: []
|
|
|
|
private
|
|
|
|
def extensions(stream)
|
|
extensions = @connection.extensions
|
|
return unless extensions.any?
|
|
|
|
stream.puts ' # These are extensions that must be enabled in order to support this database'
|
|
extensions.sort.each do |extension|
|
|
stream.puts " enable_extension #{extension.inspect}" unless ignore_extentions.include?(extension)
|
|
end
|
|
stream.puts
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
## Extentions / Tables to be ignored
|
|
ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper.ignore_extentions << 'vector'
|
|
ActiveRecord::SchemaDumper.ignore_tables << 'responses'
|
|
ActiveRecord::SchemaDumper.ignore_tables << 'response_sources'
|
|
ActiveRecord::SchemaDumper.ignore_tables << 'response_documents'
|