Update app.py
Browse files
app.py
CHANGED
|
@@ -213,11 +213,12 @@ builder.add_edge("execute_sql", "refine")
|
|
| 213 |
builder.add_edge("refine", END)
|
| 214 |
|
| 215 |
memory = SqliteSaver("graph_checkpoint")
|
| 216 |
-
graph = builder.compile(checkpointer=memory
|
| 217 |
|
| 218 |
async def async_chatbot_response(question, model_name):
|
| 219 |
inputs = {"question": question}
|
| 220 |
-
|
|
|
|
| 221 |
return result["result"]
|
| 222 |
|
| 223 |
def toggle_history():
|
|
|
|
| 213 |
builder.add_edge("refine", END)
|
| 214 |
|
| 215 |
memory = SqliteSaver("graph_checkpoint")
|
| 216 |
+
graph = builder.compile(checkpointer=memory)
|
| 217 |
|
| 218 |
async def async_chatbot_response(question, model_name):
|
| 219 |
inputs = {"question": question}
|
| 220 |
+
thread_id = str(uuid4()) # ← ID único da sessão para o checkpoint funcionar
|
| 221 |
+
result = await graph.ainvoke(inputs, {"configurable": {"thread_id": thread_id}})
|
| 222 |
return result["result"]
|
| 223 |
|
| 224 |
def toggle_history():
|