@@ -103,10 +103,36 @@ def render_data_source_section(config: Config | None = None) -> None:
103103 new_url = st .text_input (
104104 "URL" , value = existing .url , key = "dh_edit_url"
105105 )
106- new_faiss = st .text_input (
107- "FAISS 저장 경로(선택)" ,
108- value = existing .faiss_path or "" ,
109- key = "dh_edit_faiss" ,
106+ new_vdb_type = st .selectbox (
107+ "VectorDB 타입" ,
108+ options = ["faiss" , "pgvector" , "qdrant" ],
109+ index = (
110+ 0
111+ if existing .vectordb_type == "faiss"
112+ else (1 if existing .vectordb_type == "pgvector" else 2 )
113+ ),
114+ key = "dh_edit_vdb_type" ,
115+ )
116+ new_vdb_loc_placeholder = (
117+ "FAISS 디렉토리 경로 (예: ./dev/table_info_db)"
118+ if new_vdb_type == "faiss"
119+ else (
120+ "pgvector 연결 문자열 (postgresql://...)"
121+ if new_vdb_type == "pgvector"
122+ else "Qdrant URL (예: http://localhost:6333)"
123+ )
124+ )
125+ new_vdb_location = st .text_input (
126+ "VectorDB 위치" ,
127+ value = existing .vectordb_location or existing .faiss_path or "" ,
128+ key = "dh_edit_vdb_loc" ,
129+ placeholder = new_vdb_loc_placeholder ,
130+ )
131+ new_vdb_api_key = st .text_input (
132+ "VectorDB API Key (선택)" ,
133+ value = existing .vectordb_api_key or "" ,
134+ type = "password" ,
135+ key = "dh_edit_vdb_key" ,
110136 )
111137 new_note = st .text_input (
112138 "메모" , value = existing .note or "" , key = "dh_edit_note"
@@ -128,7 +154,14 @@ def render_data_source_section(config: Config | None = None) -> None:
128154 update_datahub_source (
129155 name = edit_dh ,
130156 url = new_url ,
131- faiss_path = (new_faiss or None ),
157+ faiss_path = (
158+ new_vdb_location
159+ if new_vdb_type == "faiss"
160+ else None
161+ ),
162+ vectordb_type = new_vdb_type ,
163+ vectordb_location = (new_vdb_location or None ),
164+ vectordb_api_key = (new_vdb_api_key or None ),
132165 note = (new_note or None ),
133166 )
134167 st .success ("저장되었습니다." )
@@ -147,10 +180,29 @@ def render_data_source_section(config: Config | None = None) -> None:
147180 dh_url = st .text_input (
148181 "URL" , key = "dh_url" , placeholder = "http://localhost:8080"
149182 )
150- dh_faiss = st .text_input (
151- "FAISS 저장 경로(선택)" ,
152- key = "dh_faiss" ,
153- placeholder = "예: ./dev/table_info_db" ,
183+ dh_vdb_type = st .selectbox (
184+ "VectorDB 타입" ,
185+ options = ["faiss" , "pgvector" , "qdrant" ],
186+ key = "dh_new_vdb_type" ,
187+ )
188+ dh_vdb_loc_placeholder = (
189+ "FAISS 디렉토리 경로 (예: ./dev/table_info_db)"
190+ if dh_vdb_type == "faiss"
191+ else (
192+ "pgvector 연결 문자열 (postgresql://...)"
193+ if dh_vdb_type == "pgvector"
194+ else "Qdrant URL (예: http://localhost:6333)"
195+ )
196+ )
197+ dh_vdb_location = st .text_input (
198+ "VectorDB 위치" ,
199+ key = "dh_new_vdb_loc" ,
200+ placeholder = dh_vdb_loc_placeholder ,
201+ )
202+ dh_vdb_api_key = st .text_input (
203+ "VectorDB API Key (선택)" ,
204+ type = "password" ,
205+ key = "dh_new_vdb_key" ,
154206 )
155207 dh_note = st .text_input ("메모" , key = "dh_note" , placeholder = "선택" )
156208
@@ -174,7 +226,12 @@ def render_data_source_section(config: Config | None = None) -> None:
174226 add_datahub_source (
175227 name = dh_name ,
176228 url = dh_url ,
177- faiss_path = (dh_faiss or None ),
229+ faiss_path = (
230+ dh_vdb_location if dh_vdb_type == "faiss" else None
231+ ),
232+ vectordb_type = dh_vdb_type ,
233+ vectordb_location = (dh_vdb_location or None ),
234+ vectordb_api_key = (dh_vdb_api_key or None ),
178235 note = dh_note or None ,
179236 )
180237 st .success ("추가되었습니다." )
@@ -216,21 +273,35 @@ def render_data_source_section(config: Config | None = None) -> None:
216273 if existing :
217274 new_type = st .selectbox (
218275 "타입" ,
219- options = ["faiss" , "pgvector" ],
220- index = (0 if existing .type == "faiss" else 1 ),
276+ options = ["faiss" , "pgvector" , "qdrant" ],
277+ index = (
278+ 0
279+ if existing .type == "faiss"
280+ else (1 if existing .type == "pgvector" else 2 )
281+ ),
221282 key = "vdb_edit_type" ,
222283 )
223284 new_loc_placeholder = (
224285 "FAISS 디렉토리 경로 (예: ./dev/table_info_db)"
225286 if new_type == "faiss"
226- else "pgvector 연결 문자열 (postgresql://user:pass@host:port/db)"
287+ else (
288+ "pgvector 연결 문자열 (postgresql://user:pass@host:port/db)"
289+ if new_type == "pgvector"
290+ else "Qdrant URL (예: http://localhost:6333)"
291+ )
227292 )
228293 new_location = st .text_input (
229294 "위치" ,
230295 value = existing .location ,
231296 key = "vdb_edit_location" ,
232297 placeholder = new_loc_placeholder ,
233298 )
299+ new_api_key = st .text_input (
300+ "API Key (선택)" ,
301+ value = existing .api_key or "" ,
302+ type = "password" ,
303+ key = "vdb_edit_key" ,
304+ )
234305 new_prefix = st .text_input (
235306 "컬렉션 접두사(선택)" ,
236307 value = existing .collection_prefix or "" ,
@@ -258,6 +329,7 @@ def render_data_source_section(config: Config | None = None) -> None:
258329 name = edit_vdb ,
259330 vtype = new_type ,
260331 location = new_location ,
332+ api_key = (new_api_key or None ),
261333 collection_prefix = (new_prefix or None ),
262334 note = (new_note or None ),
263335 )
@@ -275,16 +347,23 @@ def render_data_source_section(config: Config | None = None) -> None:
275347 st .write ("VectorDB 추가" )
276348 vdb_name = st .text_input ("이름" , key = "vdb_name" )
277349 vdb_type = st .selectbox (
278- "타입" , options = ["faiss" , "pgvector" ], key = "vdb_type"
350+ "타입" , options = ["faiss" , "pgvector" , "qdrant" ], key = "vdb_type"
279351 )
280352 vdb_loc_placeholder = (
281353 "FAISS 디렉토리 경로 (예: ./dev/table_info_db)"
282354 if vdb_type == "faiss"
283- else "pgvector 연결 문자열 (postgresql://user:pass@host:port/db)"
355+ else (
356+ "pgvector 연결 문자열 (postgresql://user:pass@host:port/db)"
357+ if vdb_type == "pgvector"
358+ else "Qdrant URL (예: http://localhost:6333)"
359+ )
284360 )
285361 vdb_location = st .text_input (
286362 "위치" , key = "vdb_location" , placeholder = vdb_loc_placeholder
287363 )
364+ vdb_api_key = st .text_input (
365+ "API Key (선택)" , type = "password" , key = "vdb_new_key"
366+ )
288367 vdb_prefix = st .text_input (
289368 "컬렉션 접두사(선택)" , key = "vdb_prefix" , placeholder = "예: app1_"
290369 )
@@ -312,6 +391,7 @@ def render_data_source_section(config: Config | None = None) -> None:
312391 name = vdb_name ,
313392 vtype = vdb_type ,
314393 location = vdb_location ,
394+ api_key = (vdb_api_key or None ),
315395 collection_prefix = (vdb_prefix or None ),
316396 note = (vdb_note or None ),
317397 )
0 commit comments