Spaces:
Paused
Paused
Correction unpacking reflection, ajout popup réflexion IA
Browse files
main.py
CHANGED
|
@@ -529,9 +529,20 @@ if prompt := st.chat_input("Posez votre question..."):
|
|
| 529 |
with st.chat_message("assistant", avatar="kibali_logo.svg"):
|
| 530 |
response = st.write_stream(generate_response_stream(prompt, geo, thinking_mode, st.session_state.messages))
|
| 531 |
if thinking_mode:
|
| 532 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 533 |
else:
|
| 534 |
-
images
|
|
|
|
| 535 |
if images:
|
| 536 |
for img_url in images:
|
| 537 |
st.image(img_url)
|
|
|
|
| 529 |
with st.chat_message("assistant", avatar="kibali_logo.svg"):
|
| 530 |
response = st.write_stream(generate_response_stream(prompt, geo, thinking_mode, st.session_state.messages))
|
| 531 |
if thinking_mode:
|
| 532 |
+
reflection_result = execute_reflection_plan(response, geo)
|
| 533 |
+
if reflection_result.get("strategy", {}).get("use_web", False):
|
| 534 |
+
search_query = f"{response[:50]} {geo.get('city', 'Gabon')}"
|
| 535 |
+
search_results = web_search(search_query)
|
| 536 |
+
images = [img for result in search_results.get("results", []) for img in result.get("images", [])]
|
| 537 |
+
else:
|
| 538 |
+
images = []
|
| 539 |
+
context_info = reflection_result
|
| 540 |
+
# Afficher la réflexion dans un popup
|
| 541 |
+
with st.expander("🧠 Réflexion IA (Orchestration pensée)"):
|
| 542 |
+
st.json(reflection_result)
|
| 543 |
else:
|
| 544 |
+
images = []
|
| 545 |
+
context_info = {}
|
| 546 |
if images:
|
| 547 |
for img_url in images:
|
| 548 |
st.image(img_url)
|