Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -428,23 +428,23 @@ with col_main:
|
|
| 428 |
st.markdown("---")
|
| 429 |
# Distributor form
|
| 430 |
with st.form(key=f"order_form_{participant_id}", clear_on_submit=False):
|
| 431 |
-
|
| 432 |
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
|
| 449 |
st.markdown("---")
|
| 450 |
pending = st.session_state.get("pending_orders", {}).get(participant_id, None)
|
|
|
|
| 428 |
st.markdown("---")
|
| 429 |
# Distributor form
|
| 430 |
with st.form(key=f"order_form_{participant_id}", clear_on_submit=False):
|
| 431 |
+
st.write("### Your (Distributor) decision this week")
|
| 432 |
|
| 433 |
+
# 如果有 LLM 给的建议,就显示出来
|
| 434 |
+
last_log = state["logs"][-1] if state.get("logs") else None
|
| 435 |
+
if last_log and "llm_raw" in last_log and "distributor" in last_log["llm_raw"]:
|
| 436 |
+
suggestion = last_log["llm_raw"]["distributor"]
|
| 437 |
+
st.info(f"💡 AI suggests you order: **{suggestion}** units (you can follow or override)")
|
| 438 |
+
else:
|
| 439 |
+
st.info("💡 AI suggestion will appear after the first processed week.")
|
| 440 |
+
|
| 441 |
+
default_val = state["incoming_orders"].get("distributor", 4) or 4
|
| 442 |
+
distributor_order = st.number_input("Order to place to upstream (Wholesaler):", min_value=0, step=1, value=default_val)
|
| 443 |
+
submitted = st.form_submit_button("Submit Order (locks your decision)")
|
| 444 |
+
if submitted:
|
| 445 |
+
st.session_state.setdefault("pending_orders", {})
|
| 446 |
+
st.session_state["pending_orders"][participant_id] = int(distributor_order)
|
| 447 |
+
st.success(f"Order submitted: {distributor_order}. Now click 'Next Week' to process the week.")
|
| 448 |
|
| 449 |
st.markdown("---")
|
| 450 |
pending = st.session_state.get("pending_orders", {}).get(participant_id, None)
|