Mustafa-albakkar commited on
Commit
a9057ac
·
verified ·
1 Parent(s): 62430d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -353,28 +353,28 @@ class GaiaRunner:
353
  print(f"[⚠️] Failed to parse intermediate step: {e}")
354
 
355
  # إضافة الإجابة النهائية
356
- output = result.get("output", "")
357
- full_log.append(f"Final Answer: {output}\n")
358
 
359
  # دمج كل السجل في نص واحد
360
- conversation_log = "\n".join(full_log)
361
 
362
- print("\n🧠 === FULL REACT LOG ===")
363
- print(conversation_log)
364
- print("==========================")
365
 
366
  # ==========================
367
  # 4️⃣ إرسال السجل الكامل إلى وكيل الإجابة النهائية
368
  # ==========================
369
- final_out = None
370
- try:
371
  final_out = final_client.predict_text(conversation_log)
372
  print(f"✅ Final Answer Agent Output: {final_out}")
373
- except Exception as e:
374
  print(f"[⚠️] Failed to contact Final Answer Agent: {e}")
375
  final_out = output # fallback إلى الناتج المحلي إن فشل
376
 
377
- return final_out or output
378
 
379
  except Exception as e:
380
  print(f"[❌] Error while running on question: {e}")
 
353
  print(f"[⚠️] Failed to parse intermediate step: {e}")
354
 
355
  # إضافة الإجابة النهائية
356
+ output = result.get("output", "")
357
+ full_log.append(f"Final Answer: {output}\n")
358
 
359
  # دمج كل السجل في نص واحد
360
+ conversation_log = "\n".join(full_log)
361
 
362
+ print("\n🧠 === FULL REACT LOG ===")
363
+ print(conversation_log)
364
+ print("==========================")
365
 
366
  # ==========================
367
  # 4️⃣ إرسال السجل الكامل إلى وكيل الإجابة النهائية
368
  # ==========================
369
+ final_out = None
370
+ try:
371
  final_out = final_client.predict_text(conversation_log)
372
  print(f"✅ Final Answer Agent Output: {final_out}")
373
+ except Exception as e:
374
  print(f"[⚠️] Failed to contact Final Answer Agent: {e}")
375
  final_out = output # fallback إلى الناتج المحلي إن فشل
376
 
377
+ return final_out or output
378
 
379
  except Exception as e:
380
  print(f"[❌] Error while running on question: {e}")