|
1 | 1 | """Lang2SQL CLI 프로그램입니다. |
2 | | -이 프로그램은 Datahub GMS 서버 URL을 설정하고, 필요 시 Streamlit 인터페이스를 실행합니다. |
| 2 | +이 프로그램은 환경 초기화와 Streamlit 실행을 제공합니다. |
3 | 3 |
|
4 | | -명령어 예시: lang2sql --datahub_server http://localhost:8080 --run-streamlit |
| 4 | +주의: --datahub_server 옵션은 더 이상 사용되지 않습니다(deprecated). |
| 5 | +DataHub 설정은 UI의 설정 > 데이터 소스 탭에서 관리하세요. |
5 | 6 | """ |
6 | 7 |
|
7 | 8 | import click |
|
11 | 12 | from cli.core.environment import initialize_environment |
12 | 13 | from cli.core.streamlit_runner import run_streamlit_command |
13 | 14 | from cli.utils.logger import configure_logging |
14 | | -from infra.monitoring.check_server import CheckServer |
15 | | -from llm_utils.tools import set_gms_server |
| 15 | + |
16 | 16 | from version import __version__ |
17 | 17 |
|
18 | 18 | logger = configure_logging() |
|
24 | 24 | @click.pass_context |
25 | 25 | @click.option( |
26 | 26 | "--datahub_server", |
27 | | - default="http://localhost:8080", |
28 | | - help=( |
29 | | - "Datahub GMS 서버의 URL을 설정합니다. " |
30 | | - "기본값은 'http://localhost:8080'이며, " |
31 | | - "운영 환경 또는 테스트 환경에 맞게 변경할 수 있습니다." |
32 | | - ), |
| 27 | + default=None, |
| 28 | + help=("[Deprecated] DataHub GMS URL. 이제는 UI 설정 > 데이터 소스에서 관리하세요."), |
33 | 29 | ) |
34 | 30 | @click.option( |
35 | 31 | "--run-streamlit", |
|
61 | 57 | ) |
62 | 58 | @click.option( |
63 | 59 | "--vectordb-type", |
64 | | - type=click.Choice(["faiss", "pgvector"]), |
65 | | - default="faiss", |
66 | | - help="사용할 벡터 데이터베이스 타입 (기본값: faiss)", |
| 60 | + default=None, |
| 61 | + help="[Deprecated] VectorDB 타입. 이제는 UI 설정 > 데이터 소스에서 관리하세요.", |
67 | 62 | ) |
68 | 63 | @click.option( |
69 | 64 | "--vectordb-location", |
70 | | - help=( |
71 | | - "VectorDB 위치 설정\n" |
72 | | - "- FAISS: 디렉토리 경로 (예: ./my_vectordb)\n" |
73 | | - "- pgvector: 연결 문자열 (예: postgresql://user:pass@host:port/db)\n" |
74 | | - "기본값: FAISS는 './dev/table_info_db', pgvector는 환경변수 사용" |
75 | | - ), |
| 65 | + default=None, |
| 66 | + help="[Deprecated] VectorDB 위치. 이제는 UI 설정 > 데이터 소스에서 관리하세요.", |
76 | 67 | ) |
77 | 68 | def cli( |
78 | 69 | ctx: click.Context, |
79 | | - datahub_server: str, |
| 70 | + datahub_server: str | None, |
80 | 71 | run_streamlit: bool, |
81 | 72 | port: int, |
82 | 73 | env_file_path: str | None = None, |
83 | 74 | prompt_dir_path: str | None = None, |
84 | | - vectordb_type: str = "faiss", |
85 | | - vectordb_location: str = None, |
| 75 | + vectordb_type: str | None = None, |
| 76 | + vectordb_location: str | None = None, |
86 | 77 | ) -> None: |
87 | 78 | """Lang2SQL CLI 엔트리포인트. |
88 | 79 |
|
89 | 80 | - 환경 변수 및 VectorDB 설정 초기화 |
90 | | - - GMS 서버 연결 및 헬스체크 |
91 | 81 | - 필요 시 Streamlit 애플리케이션 실행 |
92 | 82 | """ |
93 | 83 |
|
94 | 84 | try: |
95 | 85 | initialize_environment( |
96 | | - env_file_path=env_file_path, |
97 | | - prompt_dir_path=prompt_dir_path, |
98 | | - vectordb_type=vectordb_type, |
99 | | - vectordb_location=vectordb_location, |
| 86 | + env_file_path=env_file_path, prompt_dir_path=prompt_dir_path |
100 | 87 | ) |
101 | 88 | except Exception: |
102 | 89 | logger.error("Initialization failed.", exc_info=True) |
103 | 90 | ctx.exit(1) |
104 | 91 |
|
105 | 92 | logger.info( |
106 | | - "Initialization started: GMS server = %s, run_streamlit = %s, port = %d", |
107 | | - datahub_server, |
| 93 | + "Initialization started: run_streamlit = %s, port = %d", |
108 | 94 | run_streamlit, |
109 | 95 | port, |
110 | 96 | ) |
111 | 97 |
|
112 | | - if CheckServer.is_gms_server_healthy(url=datahub_server): |
113 | | - set_gms_server(datahub_server) |
114 | | - logger.info("GMS server URL successfully set: %s", datahub_server) |
115 | | - else: |
116 | | - logger.error("GMS server health check failed. URL: %s", datahub_server) |
117 | | - # ctx.exit(1) |
| 98 | + # Deprecated 안내: CLI에서 DataHub 설정은 더 이상 처리하지 않습니다 |
| 99 | + if datahub_server: |
| 100 | + click.secho( |
| 101 | + "[Deprecated] --datahub_server 옵션은 더 이상 사용되지 않습니다. 설정 > 데이터 소스 탭에서 설정하세요.", |
| 102 | + fg="yellow", |
| 103 | + ) |
| 104 | + |
| 105 | + # Deprecated 안내: CLI에서 VectorDB 설정은 더 이상 처리하지 않습니다 |
| 106 | + if vectordb_type or vectordb_location: |
| 107 | + click.secho( |
| 108 | + "[Deprecated] --vectordb-type/--vectordb-location 옵션은 더 이상 사용되지 않습니다. 설정 > 데이터 소스 탭에서 설정하세요.", |
| 109 | + fg="yellow", |
| 110 | + ) |
118 | 111 |
|
119 | 112 | if run_streamlit: |
120 | 113 | run_streamlit_command(port) |
|
0 commit comments