mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 06:28:48 +00:00 
			
		
		
		
	
		
			
	
	
		
			17 lines
		
	
	
		
			323 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
		
		
			
		
	
	
			17 lines
		
	
	
		
			323 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
|  | # frozen_string_literal: true | ||
|  | 
 | ||
|  | module ::DiscourseAi | ||
|  |   module Database | ||
|  |     class Connection | ||
|  |       def self.connect! | ||
|  |         pg_conn = PG.connect(SiteSetting.ai_embeddings_pg_connection_string) | ||
|  |         @@db = MiniSql::Connection.get(pg_conn) | ||
|  |       end | ||
|  | 
 | ||
|  |       def self.db | ||
|  |         @@db ||= connect! | ||
|  |       end | ||
|  |     end | ||
|  |   end | ||
|  | end |