Update app.py
Browse files
app.py
CHANGED
@@ -212,11 +212,14 @@ def wrapper_modified(keyword, korean_only, apply_main_keyword_option, exclude_ze
|
|
212 |
api_name="/process_search_results"
|
213 |
)
|
214 |
|
215 |
-
# API 응답 확인 및 처리
|
216 |
logger.info(f"API 응답 타입: {type(result)}, 길이: {len(result) if isinstance(result, (list, tuple)) else 'N/A'}")
|
217 |
|
218 |
-
if isinstance(result, (list, tuple)) and len(result) >=
|
|
|
|
|
219 |
table_html, cat_choices, vol_choices, selected_cat, download_file = result[:5]
|
|
|
220 |
else:
|
221 |
# 응답이 예상과 다른 경우 기본값 사용
|
222 |
logger.warning(f"예상과 다른 API 응답: {result}")
|
@@ -226,6 +229,23 @@ def wrapper_modified(keyword, korean_only, apply_main_keyword_option, exclude_ze
|
|
226 |
selected_cat = "전체 보기"
|
227 |
download_file = None
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
local_file = None
|
230 |
if download_file:
|
231 |
local_file = create_session_temp_file(session_id, '.xlsx')
|
|
|
212 |
api_name="/process_search_results"
|
213 |
)
|
214 |
|
215 |
+
# API 응답 확인 및 처리 (6개 값)
|
216 |
logger.info(f"API 응답 타입: {type(result)}, 길이: {len(result) if isinstance(result, (list, tuple)) else 'N/A'}")
|
217 |
|
218 |
+
if isinstance(result, (list, tuple)) and len(result) >= 6:
|
219 |
+
table_html, cat_choices, vol_choices, selected_cat, download_file, extra = result[:6]
|
220 |
+
elif isinstance(result, (list, tuple)) and len(result) >= 5:
|
221 |
table_html, cat_choices, vol_choices, selected_cat, download_file = result[:5]
|
222 |
+
extra = None
|
223 |
else:
|
224 |
# 응답이 예상과 다른 경우 기본값 사용
|
225 |
logger.warning(f"예상과 다른 API 응답: {result}")
|
|
|
229 |
selected_cat = "전체 보기"
|
230 |
download_file = None
|
231 |
|
232 |
+
# choices 형식 처리 (중첩 리스트인 경우 첫 번째 값만 사용)
|
233 |
+
if isinstance(cat_choices, dict) and 'choices' in cat_choices:
|
234 |
+
cat_choices = [choice[0] if isinstance(choice, list) else choice for choice in cat_choices['choices']]
|
235 |
+
elif isinstance(cat_choices, list) and cat_choices and isinstance(cat_choices[0], list):
|
236 |
+
cat_choices = [choice[0] for choice in cat_choices]
|
237 |
+
|
238 |
+
if isinstance(vol_choices, dict) and 'choices' in vol_choices:
|
239 |
+
vol_choices = [choice[0] if isinstance(choice, list) else choice for choice in vol_choices['choices']]
|
240 |
+
elif isinstance(vol_choices, list) and vol_choices and isinstance(vol_choices[0], list):
|
241 |
+
vol_choices = [choice[0] for choice in vol_choices]
|
242 |
+
|
243 |
+
# selected_cat 처리
|
244 |
+
if isinstance(selected_cat, dict) and 'value' in selected_cat:
|
245 |
+
selected_cat = selected_cat['value']
|
246 |
+
elif isinstance(selected_cat, list):
|
247 |
+
selected_cat = selected_cat[0] if selected_cat else "전체 보기"
|
248 |
+
|
249 |
local_file = None
|
250 |
if download_file:
|
251 |
local_file = create_session_temp_file(session_id, '.xlsx')
|