youngtsai commited on
Commit
737bba1
·
1 Parent(s): 2ab288e
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -2305,6 +2305,8 @@ def refresh_video_LLM_all_content_by_sheet(sheet_url, sheet_qa_column, video_ids
2305
  ids_to_set_oo_phase1 = [] # (video_id, row_number)
2306
  ids_to_refresh = [] # video_id
2307
  processed_ids = set() # 追蹤已處理的ID,避免重複
 
 
2308
 
2309
  print("開始檢查 GCS 檔案狀態...")
2310
  for video_id in video_ids_list:
@@ -2359,8 +2361,8 @@ def refresh_video_LLM_all_content_by_sheet(sheet_url, sheet_qa_column, video_ids
2359
  # 6. 逐一處理需要刷新的 Video ID,並即時更新 Sheet 狀態
2360
  if ids_to_refresh:
2361
  print(f"\n開始處理 {len(ids_to_refresh)} 個需要刷新的 Video ID (即時更新 Sheet)...")
2362
- successfully_refreshed_ids = [] # 初始化成功列表
2363
- failed_refresh_ids = [] # 初始化失敗列表
2364
  # 這個迴圈負責執行刷新,並在每次完成後立即更新 Sheet
2365
  for video_id in ids_to_refresh:
2366
  row_number = video_id_to_row_map[video_id] # 必定存在,前面已檢查 (1-based sheet row number)
@@ -2410,6 +2412,7 @@ def refresh_video_LLM_all_content_by_sheet(sheet_url, sheet_qa_column, video_ids
2410
 
2411
  # 7. 整理最終結果 (移除舊的批次更新邏輯)
2412
  print("\n=== 批次處理完成 ===")
 
2413
  final_success_ids = [item[0] for item in ids_to_set_oo_phase1] + [item[0] for item in successfully_refreshed_ids]
2414
  final_failed_ids = [item[0] for item in failed_refresh_ids]
2415
  # 將在工作表中找不到的 ID 也視為失敗
 
2305
  ids_to_set_oo_phase1 = [] # (video_id, row_number)
2306
  ids_to_refresh = [] # video_id
2307
  processed_ids = set() # 追蹤已處理的ID,避免重複
2308
+ successfully_refreshed_ids = [] # <--- 移到這裡初始化
2309
+ failed_refresh_ids = [] # <--- 移到這裡初始化
2310
 
2311
  print("開始檢查 GCS 檔案狀態...")
2312
  for video_id in video_ids_list:
 
2361
  # 6. 逐一處理需要刷新的 Video ID,並即時更新 Sheet 狀態
2362
  if ids_to_refresh:
2363
  print(f"\n開始處理 {len(ids_to_refresh)} 個需要刷新的 Video ID (即時更新 Sheet)...")
2364
+ # successfully_refreshed_ids = [] # <--- 從這裡移除
2365
+ # failed_refresh_ids = [] # <--- 從這裡移除
2366
  # 這個迴圈負責執行刷新,並在每次完成後立即更新 Sheet
2367
  for video_id in ids_to_refresh:
2368
  row_number = video_id_to_row_map[video_id] # 必定存在,前面已檢查 (1-based sheet row number)
 
2412
 
2413
  # 7. 整理最終結果 (移除舊的批次更新邏輯)
2414
  print("\n=== 批次處理完成 ===")
2415
+ # 現在這兩行應該總是安全的,因為 successfully_refreshed_ids 和 failed_refresh_ids 至少是 []
2416
  final_success_ids = [item[0] for item in ids_to_set_oo_phase1] + [item[0] for item in successfully_refreshed_ids]
2417
  final_failed_ids = [item[0] for item in failed_refresh_ids]
2418
  # 將在工作表中找不到的 ID 也視為失敗