From 14f40dda0e8b51e9aabd90656439fd58af58a47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=BD=87?= Date: Tue, 21 Oct 2025 16:58:06 +0800 Subject: [PATCH] fix: pgvector_store read connection_string from env (#2887) Co-authored-by: alanchen <40684202+chenliang15405@users.noreply.github.com> --- .../src/dbgpt_ext/storage/vector_store/pgvector_store.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/dbgpt-ext/src/dbgpt_ext/storage/vector_store/pgvector_store.py b/packages/dbgpt-ext/src/dbgpt_ext/storage/vector_store/pgvector_store.py index d1855c6e1..aeee34dde 100644 --- a/packages/dbgpt-ext/src/dbgpt_ext/storage/vector_store/pgvector_store.py +++ b/packages/dbgpt-ext/src/dbgpt_ext/storage/vector_store/pgvector_store.py @@ -1,6 +1,7 @@ """Postgres vector store.""" import logging +import os from dataclasses import dataclass, field from typing import Any, List, Optional @@ -99,8 +100,10 @@ class PGVectorStore(VectorStoreBase): max_chunks_once_load=max_chunks_once_load, max_threads=max_threads ) self._vector_store_config = vector_store_config + self.connection_string = vector_store_config.connection_string or os.getenv( + "PGVECTOR_CONNECTION_STRING" + ) - self.connection_string = vector_store_config.connection_string self.embeddings = embedding_fn self.collection_name = name