ganesh-vilje commited on
Commit
c770c10
·
1 Parent(s): fd9d0f9

fix: Replace remaining _push_pipeline_history calls with _create_pipeline_record

Browse files

- Fixed 'name _push_pipeline_history is not defined' error
- Replaced 3 orphaned calls in non-streaming and streaming endpoints
- Lines 1132, 1192, 1545 now use V3 _create_pipeline_record
- Pipeline generation now properly creates S3 files before execution

Files changed (1) hide show
  1. api_routes_v2.py +6 -3
api_routes_v2.py CHANGED
@@ -1129,7 +1129,8 @@ async def chat_unified(
1129
  )
1130
 
1131
  session_manager.update_session(chat_id, {"proposed_pipeline": pipeline, "state": "pipeline_proposed"})
1132
- _push_pipeline_history(chat_id, pipeline, created_from="request", message=message) # CHANGE
 
1133
 
1134
  pipeline_name = pipeline.get("pipeline_name", "Document Processing")
1135
  steps_list = pipeline.get("pipeline_steps", [])
@@ -1189,7 +1190,8 @@ async def chat_unified(
1189
  prefer_bedrock=bool(prefer_bedrock)
1190
  )
1191
  session_manager.update_session(chat_id, {"proposed_pipeline": new_pipeline, "state": "pipeline_proposed"})
1192
- _push_pipeline_history(chat_id, new_pipeline, created_from="edit", message=message) # CHANGE
 
1193
 
1194
  formatted = format_pipeline_for_display(new_pipeline)
1195
  friendly = formatted + f"\n\n```json\n{json.dumps(new_pipeline, indent=2)}\n```"
@@ -1542,7 +1544,8 @@ async def chat_unified_stream(
1542
  prefer_bedrock=bool(prefer_bedrock)
1543
  )
1544
  session_manager.update_session(chat_id, {"proposed_pipeline": new_pipeline, "state": "pipeline_proposed"})
1545
- _push_pipeline_history(chat_id, new_pipeline, created_from="edit", message=message) # CHANGE
 
1546
  formatted = format_pipeline_for_display(new_pipeline)
1547
  friendly = formatted + f"\n\n```json\n{json.dumps(new_pipeline, indent=2)}\n```"
1548
  _add_and_mirror_message(chat_id, "assistant", friendly)
 
1129
  )
1130
 
1131
  session_manager.update_session(chat_id, {"proposed_pipeline": pipeline, "state": "pipeline_proposed"})
1132
+ # V3: Create pipeline record in S3 and MongoDB
1133
+ pipeline_id = _create_pipeline_record(chat_id, pipeline, status="proposed", created_from="request")
1134
 
1135
  pipeline_name = pipeline.get("pipeline_name", "Document Processing")
1136
  steps_list = pipeline.get("pipeline_steps", [])
 
1190
  prefer_bedrock=bool(prefer_bedrock)
1191
  )
1192
  session_manager.update_session(chat_id, {"proposed_pipeline": new_pipeline, "state": "pipeline_proposed"})
1193
+ # V3: Create pipeline record for edited pipeline
1194
+ pipeline_id = _create_pipeline_record(chat_id, new_pipeline, status="proposed", created_from="edit")
1195
 
1196
  formatted = format_pipeline_for_display(new_pipeline)
1197
  friendly = formatted + f"\n\n```json\n{json.dumps(new_pipeline, indent=2)}\n```"
 
1544
  prefer_bedrock=bool(prefer_bedrock)
1545
  )
1546
  session_manager.update_session(chat_id, {"proposed_pipeline": new_pipeline, "state": "pipeline_proposed"})
1547
+ # V3: Create pipeline record for edited pipeline
1548
+ pipeline_id = _create_pipeline_record(chat_id, new_pipeline, status="proposed", created_from="edit")
1549
  formatted = format_pipeline_for_display(new_pipeline)
1550
  friendly = formatted + f"\n\n```json\n{json.dumps(new_pipeline, indent=2)}\n```"
1551
  _add_and_mirror_message(chat_id, "assistant", friendly)