Mustafa-albakkar commited on
Commit
9c1af9c
·
verified ·
1 Parent(s): 9fbd769

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -352,31 +352,31 @@ class GaiaRunner:
352
  except Exception as 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}")
381
  return "Error: unable to process this question."
382
 
 
352
  except Exception as 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}")
381
  return "Error: unable to process this question."
382