yangdx commited on
Commit
6b0b65e
·
1 Parent(s): 05ed568

Fix linting

Browse files
lightrag/api/routers/graph_routes.py CHANGED
@@ -41,7 +41,9 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
41
  except Exception as e:
42
  logger.error(f"Error getting graph labels: {str(e)}")
43
  logger.error(traceback.format_exc())
44
- raise HTTPException(status_code=500, detail=f"Error getting graph labels: {str(e)}")
 
 
45
 
46
  @router.get("/graphs", dependencies=[Depends(combined_auth)])
47
  async def get_knowledge_graph(
@@ -72,7 +74,9 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
72
  except Exception as e:
73
  logger.error(f"Error getting knowledge graph for label '{label}': {str(e)}")
74
  logger.error(traceback.format_exc())
75
- raise HTTPException(status_code=500, detail=f"Error getting knowledge graph: {str(e)}")
 
 
76
 
77
  @router.get("/graph/entity/exists", dependencies=[Depends(combined_auth)])
78
  async def check_entity_exists(
@@ -120,7 +124,9 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
120
  "data": result,
121
  }
122
  except ValueError as ve:
123
- logger.error(f"Validation error updating entity '{request.entity_name}': {str(ve)}")
 
 
124
  raise HTTPException(status_code=400, detail=str(ve))
125
  except Exception as e:
126
  logger.error(f"Error updating entity '{request.entity_name}': {str(e)}")
@@ -151,10 +157,14 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
151
  "data": result,
152
  }
153
  except ValueError as ve:
154
- logger.error(f"Validation error updating relation between '{request.source_id}' and '{request.target_id}': {str(ve)}")
 
 
155
  raise HTTPException(status_code=400, detail=str(ve))
156
  except Exception as e:
157
- logger.error(f"Error updating relation between '{request.source_id}' and '{request.target_id}': {str(e)}")
 
 
158
  logger.error(traceback.format_exc())
159
  raise HTTPException(
160
  status_code=500, detail=f"Error updating relation: {str(e)}"
 
41
  except Exception as e:
42
  logger.error(f"Error getting graph labels: {str(e)}")
43
  logger.error(traceback.format_exc())
44
+ raise HTTPException(
45
+ status_code=500, detail=f"Error getting graph labels: {str(e)}"
46
+ )
47
 
48
  @router.get("/graphs", dependencies=[Depends(combined_auth)])
49
  async def get_knowledge_graph(
 
74
  except Exception as e:
75
  logger.error(f"Error getting knowledge graph for label '{label}': {str(e)}")
76
  logger.error(traceback.format_exc())
77
+ raise HTTPException(
78
+ status_code=500, detail=f"Error getting knowledge graph: {str(e)}"
79
+ )
80
 
81
  @router.get("/graph/entity/exists", dependencies=[Depends(combined_auth)])
82
  async def check_entity_exists(
 
124
  "data": result,
125
  }
126
  except ValueError as ve:
127
+ logger.error(
128
+ f"Validation error updating entity '{request.entity_name}': {str(ve)}"
129
+ )
130
  raise HTTPException(status_code=400, detail=str(ve))
131
  except Exception as e:
132
  logger.error(f"Error updating entity '{request.entity_name}': {str(e)}")
 
157
  "data": result,
158
  }
159
  except ValueError as ve:
160
+ logger.error(
161
+ f"Validation error updating relation between '{request.source_id}' and '{request.target_id}': {str(ve)}"
162
+ )
163
  raise HTTPException(status_code=400, detail=str(ve))
164
  except Exception as e:
165
+ logger.error(
166
+ f"Error updating relation between '{request.source_id}' and '{request.target_id}': {str(e)}"
167
+ )
168
  logger.error(traceback.format_exc())
169
  raise HTTPException(
170
  status_code=500, detail=f"Error updating relation: {str(e)}"