feat(ai-onboarding): enhance conversation flow, prompt rules & update Postman environment port to 8001
This commit is contained in:
@@ -206,7 +206,8 @@ async def send_message(
|
||||
)
|
||||
t_ai_end = time.perf_counter()
|
||||
|
||||
# 7. Update state
|
||||
# 7. Update state using shared intelligent merge
|
||||
from app.ai.orchestrator import merge_state_updates
|
||||
current_state = json.loads(
|
||||
state.state_json
|
||||
)
|
||||
@@ -215,17 +216,17 @@ async def send_message(
|
||||
"state_updates",
|
||||
{},
|
||||
)
|
||||
if hasattr(updates, "model_dump"):
|
||||
updates = updates.model_dump()
|
||||
elif not isinstance(updates, dict):
|
||||
updates = {}
|
||||
|
||||
for key, value in updates.items():
|
||||
if value is not None:
|
||||
if isinstance(value, list) and len(value) == 0:
|
||||
continue
|
||||
current_state[key] = value
|
||||
merged_state = merge_state_updates(current_state, updates)
|
||||
|
||||
onboarding_service.update_state(
|
||||
db=db,
|
||||
state=state,
|
||||
data=current_state,
|
||||
data=merged_state,
|
||||
)
|
||||
|
||||
# 8. Update stage
|
||||
|
||||
Reference in New Issue
Block a user