I561043 commited on
Commit
2819245
·
1 Parent(s): 17c13db

fix format

Browse files
examples/lightrag_api_ollama_demo.py CHANGED
@@ -24,7 +24,6 @@ WORKING_DIR = os.environ.get("RAG_DIR", f"{DEFAULT_RAG_DIR}")
24
  print(f"WORKING_DIR: {WORKING_DIR}")
25
 
26
 
27
-
28
  if not os.path.exists(WORKING_DIR):
29
  os.mkdir(WORKING_DIR)
30
 
@@ -81,6 +80,7 @@ async def query_endpoint(request: QueryRequest):
81
  except Exception as e:
82
  raise HTTPException(status_code=500, detail=str(e))
83
 
 
84
  # insert by text
85
  @app.post("/insert", response_model=Response)
86
  async def insert_endpoint(request: InsertRequest):
@@ -91,6 +91,7 @@ async def insert_endpoint(request: InsertRequest):
91
  except Exception as e:
92
  raise HTTPException(status_code=500, detail=str(e))
93
 
 
94
  # insert by file in payload
95
  @app.post("/insert_file", response_model=Response)
96
  async def insert_file(file: UploadFile = File(...)):
@@ -113,6 +114,7 @@ async def insert_file(file: UploadFile = File(...)):
113
  except Exception as e:
114
  raise HTTPException(status_code=500, detail=str(e))
115
 
 
116
  # insert by local default file
117
  @app.post("/insert_default_file", response_model=Response)
118
  @app.get("/insert_default_file", response_model=Response)
@@ -133,6 +135,7 @@ async def insert_default_file():
133
  except Exception as e:
134
  raise HTTPException(status_code=500, detail=str(e))
135
 
 
136
  @app.get("/health")
137
  async def health_check():
138
  return {"status": "healthy"}
@@ -140,6 +143,7 @@ async def health_check():
140
 
141
  if __name__ == "__main__":
142
  import uvicorn
 
143
  uvicorn.run(app, host="0.0.0.0", port=8020)
144
 
145
  # Usage example
 
24
  print(f"WORKING_DIR: {WORKING_DIR}")
25
 
26
 
 
27
  if not os.path.exists(WORKING_DIR):
28
  os.mkdir(WORKING_DIR)
29
 
 
80
  except Exception as e:
81
  raise HTTPException(status_code=500, detail=str(e))
82
 
83
+
84
  # insert by text
85
  @app.post("/insert", response_model=Response)
86
  async def insert_endpoint(request: InsertRequest):
 
91
  except Exception as e:
92
  raise HTTPException(status_code=500, detail=str(e))
93
 
94
+
95
  # insert by file in payload
96
  @app.post("/insert_file", response_model=Response)
97
  async def insert_file(file: UploadFile = File(...)):
 
114
  except Exception as e:
115
  raise HTTPException(status_code=500, detail=str(e))
116
 
117
+
118
  # insert by local default file
119
  @app.post("/insert_default_file", response_model=Response)
120
  @app.get("/insert_default_file", response_model=Response)
 
135
  except Exception as e:
136
  raise HTTPException(status_code=500, detail=str(e))
137
 
138
+
139
  @app.get("/health")
140
  async def health_check():
141
  return {"status": "healthy"}
 
143
 
144
  if __name__ == "__main__":
145
  import uvicorn
146
+
147
  uvicorn.run(app, host="0.0.0.0", port=8020)
148
 
149
  # Usage example