Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,6 +74,11 @@ SQLITE_DB_PATH = tempfile.gettempdir() + '/langgraph_checkpoints.sqlite'
|
|
| 74 |
|
| 75 |
# --- Checkpointer and Graph Compilation ---
|
| 76 |
global_memory_saver = None # Initialize to None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
try:
|
| 79 |
# Attempt to connect to SQLite
|
|
@@ -230,7 +235,7 @@ async def github_webhook(
|
|
| 230 |
print(f"pr_repo_name: {pr_repo_name} ")
|
| 231 |
|
| 232 |
# each graph invocation will have unique thread_id, it can be used to RESUME graph post human feedback.
|
| 233 |
-
new_thread_id = str(uuid.uuid4())
|
| 234 |
print(f"\n--- Starting New Graph Execution with thread_id: {new_thread_id} ---")
|
| 235 |
|
| 236 |
if not global_graph:
|
|
@@ -364,7 +369,7 @@ async def resume_review(payload: HumanInputPayload):
|
|
| 364 |
return
|
| 365 |
|
| 366 |
try:
|
| 367 |
-
current_state_snapshot = global_graph.get_state({"configurable": {"thread_id":
|
| 368 |
current_state_values = current_state_snapshot.values
|
| 369 |
|
| 370 |
current_state_values["human_approval_status"] = payload.approval_status
|
|
|
|
| 74 |
|
| 75 |
# --- Checkpointer and Graph Compilation ---
|
| 76 |
global_memory_saver = None # Initialize to None
|
| 77 |
+
new_thread_id = 1256
|
| 78 |
+
|
| 79 |
+
#----- thread_id is made global until below gradio issue is resolved
|
| 80 |
+
# gradio_issue: https://github.com/gradio-app/gradio/issues/10893
|
| 81 |
+
|
| 82 |
|
| 83 |
try:
|
| 84 |
# Attempt to connect to SQLite
|
|
|
|
| 235 |
print(f"pr_repo_name: {pr_repo_name} ")
|
| 236 |
|
| 237 |
# each graph invocation will have unique thread_id, it can be used to RESUME graph post human feedback.
|
| 238 |
+
#new_thread_id = str(uuid.uuid4())
|
| 239 |
print(f"\n--- Starting New Graph Execution with thread_id: {new_thread_id} ---")
|
| 240 |
|
| 241 |
if not global_graph:
|
|
|
|
| 369 |
return
|
| 370 |
|
| 371 |
try:
|
| 372 |
+
current_state_snapshot = global_graph.get_state({"configurable": {"thread_id": new_thread_id}})
|
| 373 |
current_state_values = current_state_snapshot.values
|
| 374 |
|
| 375 |
current_state_values["human_approval_status"] = payload.approval_status
|