|
|
@@ -32,6 +32,11 @@ async def analyze(req: AnalyzeRequest):
|
|
|
graph = get_graph()
|
|
|
import uuid
|
|
|
trace_id = str(uuid.uuid4())
|
|
|
+ # MemorySaver/AsyncSqliteSaver 均要求 config 提供 thread_id,缺省会抛
|
|
|
+ # "Checkpointer requires one or more of the following 'configurable' keys"
|
|
|
+ config = {
|
|
|
+ "configurable": {"thread_id": f"analyze_{req.user_id}_{trace_id}"},
|
|
|
+ }
|
|
|
result = await graph.ainvoke({
|
|
|
"report_id": req.report_id,
|
|
|
"user_id": req.user_id,
|
|
|
@@ -41,5 +46,5 @@ async def analyze(req: AnalyzeRequest):
|
|
|
"dimension_scores": None,
|
|
|
"analysis": None,
|
|
|
"recommendations": [],
|
|
|
- })
|
|
|
+ }, config)
|
|
|
return AnalyzeResponse(analysis=result.get("analysis", ""), trace_id=trace_id)
|