scipious commited on
Commit
c793402
·
verified ·
1 Parent(s): 0b4f95e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -74,10 +74,12 @@ except NameError:
74
  # TOGETHER_API_KEY가 정의되지 않은 경우 환경 변수 사용을 시도
75
  client = Together()
76
 
 
77
 
78
  # --- RAG 로딩 ---
79
  def load_rag_objects():
80
  global region_rag_objects
 
81
 
82
  # 📢 [수정]: 로딩 스레드 시작 로그를 추가하여 Gunicorn 로그에서 확인 가능하게 함
83
  logger.info(">>> [RAG_LOADER] RAG 로딩 스레드 시작 <<<")
@@ -91,6 +93,7 @@ def load_rag_objects():
91
 
92
  try:
93
  socketio.emit('message', {'message': f"[{region}] RAG 로딩 중..."})
 
94
 
95
  # NOTE: reg_embedding_system 모듈이 현재 환경에 설치/존재하는지 확인해야 합니다.
96
  ensemble_retriever, vectorstore, sqlite_conn = reg_embedding_system.load_embedding_from_faiss(path)
@@ -105,6 +108,7 @@ def load_rag_objects():
105
  }
106
  socketio.emit('message', {'message': f"[{region}] 로딩 완료"})
107
  logger.info(f"[{region}] RAG 로딩 완료")
 
108
 
109
  except Exception as e:
110
  error_msg = f"[{region}] 로딩 실패: {str(e)}"
@@ -171,6 +175,9 @@ def handle_connect():
171
  connected_clients += 1
172
  logger.info(f"클라이언트 연결: {connected_clients}명")
173
 
 
 
 
174
  @socketio.on('disconnect')
175
  def handle_disconnect():
176
  global connected_clients
 
74
  # TOGETHER_API_KEY가 정의되지 않은 경우 환경 변수 사용을 시도
75
  client = Together()
76
 
77
+ rag_connection_status_info = ""
78
 
79
  # --- RAG 로딩 ---
80
  def load_rag_objects():
81
  global region_rag_objects
82
+ global rag_connection_status_info
83
 
84
  # 📢 [수정]: 로딩 스레드 시작 로그를 추가하여 Gunicorn 로그에서 확인 가능하게 함
85
  logger.info(">>> [RAG_LOADER] RAG 로딩 스레드 시작 <<<")
 
93
 
94
  try:
95
  socketio.emit('message', {'message': f"[{region}] RAG 로딩 중..."})
96
+ rag_connection_status_info = f"[{region}] RAG 로딩 중..."
97
 
98
  # NOTE: reg_embedding_system 모듈이 현재 환경에 설치/존재하는지 확인해야 합니다.
99
  ensemble_retriever, vectorstore, sqlite_conn = reg_embedding_system.load_embedding_from_faiss(path)
 
108
  }
109
  socketio.emit('message', {'message': f"[{region}] 로딩 완료"})
110
  logger.info(f"[{region}] RAG 로딩 완료")
111
+ rag_connection_status_info = f"[{region}] RAG 로딩 완료"
112
 
113
  except Exception as e:
114
  error_msg = f"[{region}] 로딩 실패: {str(e)}"
 
175
  connected_clients += 1
176
  logger.info(f"클라이언트 연결: {connected_clients}명")
177
 
178
+ global rag_connection_status_info
179
+ socketio.emit('message', {'message': rag_connection_status_info})
180
+
181
  @socketio.on('disconnect')
182
  def handle_disconnect():
183
  global connected_clients