From a1e62ab422904660d6892df56d0924a97d5b4f1f Mon Sep 17 00:00:00 2001 From: Rain6435 Date: Thu, 14 Aug 2025 01:50:57 -0400 Subject: [PATCH] fix: Formatting --- .../open_webui/retrieval/vector/dbs/pgvector.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/retrieval/vector/dbs/pgvector.py b/backend/open_webui/retrieval/vector/dbs/pgvector.py index 4c5d1f7dcd..d978f0c824 100644 --- a/backend/open_webui/retrieval/vector/dbs/pgvector.py +++ b/backend/open_webui/retrieval/vector/dbs/pgvector.py @@ -112,26 +112,34 @@ class PgvectorClient(VectorDBBase): try: # Ensure the pgvector extension is available # Use a conditional check to avoid permission issues on Azure PostgreSQL - self.session.execute(text(""" + self.session.execute( + text( + """ DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector') THEN CREATE EXTENSION IF NOT EXISTS vector; END IF; END $$; - """)) + """ + ) + ) if PGVECTOR_PGCRYPTO: # Ensure the pgcrypto extension is available for encryption # Use a conditional check to avoid permission issues on Azure PostgreSQL - self.session.execute(text(""" + self.session.execute( + text( + """ DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pgcrypto') THEN CREATE EXTENSION IF NOT EXISTS pgcrypto; END IF; END $$; - """)) + """ + ) + ) if not PGVECTOR_PGCRYPTO_KEY: raise ValueError(