zenaight commited on
Commit ·
fcf07bf
1
Parent(s): 646ae8e
Refine must-have features display in AI chat responses
Browse files- Updated the system message construction in the `chat_with_session_memory` function to improve the handling of must-have property features.
- Introduced a separate variable for must-have features to enhance readability and ensure that the display logic is clear and concise.
- This change ensures that if no must-have features are provided, the response defaults to '[none]', improving user experience and clarity in property inquiries.
- ai_chat.py +2 -1
ai_chat.py
CHANGED
|
@@ -29,11 +29,12 @@ def chat_with_session_memory(state):
|
|
| 29 |
)
|
| 30 |
|
| 31 |
intent_data = state.get("intent", {})
|
|
|
|
| 32 |
system_message += (
|
| 33 |
f" They're looking for a property in {intent_data.get('location_preference','[any area]')}, "
|
| 34 |
f"with a budget up to {intent_data.get('budget','[any amount]')} per month, "
|
| 35 |
f"around {intent_data.get('size_preference_sqm','[size]')} sqm, "
|
| 36 |
-
f"and must-haves: {', '.join(
|
| 37 |
)
|
| 38 |
|
| 39 |
# Build messages array with history
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
intent_data = state.get("intent", {})
|
| 32 |
+
must_have_list = intent_data.get('must_have', []) or []
|
| 33 |
system_message += (
|
| 34 |
f" They're looking for a property in {intent_data.get('location_preference','[any area]')}, "
|
| 35 |
f"with a budget up to {intent_data.get('budget','[any amount]')} per month, "
|
| 36 |
f"around {intent_data.get('size_preference_sqm','[size]')} sqm, "
|
| 37 |
+
f"and must-haves: {', '.join(must_have_list) if must_have_list else '[none]'}. "
|
| 38 |
)
|
| 39 |
|
| 40 |
# Build messages array with history
|