Soumik555 commited on
Commit
c9feee8
·
1 Parent(s): 7403f2c

removed trailing from post

Browse files
Files changed (1) hide show
  1. controller.py +6 -4
controller.py CHANGED
@@ -74,7 +74,9 @@ async def root():
74
 
75
 
76
  # BASIC KNOWLEDGE BASED ON CSV
77
- @app.post("/api/basic_csv_data/")
 
 
78
  async def basic_csv_data(request: CsvUrlRequest):
79
  try:
80
  decoded_url = unquote(request.csv_url)
@@ -111,7 +113,7 @@ async def get_image(request: ImageRequest, authorization: str = Header(None)):
111
 
112
 
113
  # GET CSV DATA FOR GENERATING THE TABLE
114
- @app.post("/api/csv_data/")
115
  async def get_csv_data(request: CsvUrlRequest):
116
  try:
117
  decoded_url = unquote(request.csv_url)
@@ -238,7 +240,7 @@ def langchain_csv_chat(csv_url: str, question: str, chart_required: bool):
238
  return {"error": "All API keys exhausted"}
239
 
240
  # Async endpoint with non-blocking execution
241
- @app.post("/api/csv-chat/")
242
  async def csv_chat(request: Dict, authorization: str = Header(None)):
243
  # Authorization checks
244
  if not authorization or not authorization.startswith("Bearer "):
@@ -424,7 +426,7 @@ def langchain_csv_chart(csv_url: str, question: str, chart_required: bool):
424
 
425
  return "Chart generation failed after all retries"
426
 
427
- @app.post("/api/csv-chart/")
428
  async def csv_chart(request: dict, authorization: str = Header(None)):
429
  # Authorization verification
430
  if not authorization or not authorization.startswith("Bearer "):
 
74
 
75
 
76
  # BASIC KNOWLEDGE BASED ON CSV
77
+
78
+ # Remove trailing slash from the URL otherwise it will redirect to GET method
79
+ @app.post("/api/basic_csv_data")
80
  async def basic_csv_data(request: CsvUrlRequest):
81
  try:
82
  decoded_url = unquote(request.csv_url)
 
113
 
114
 
115
  # GET CSV DATA FOR GENERATING THE TABLE
116
+ @app.post("/api/csv_data")
117
  async def get_csv_data(request: CsvUrlRequest):
118
  try:
119
  decoded_url = unquote(request.csv_url)
 
240
  return {"error": "All API keys exhausted"}
241
 
242
  # Async endpoint with non-blocking execution
243
+ @app.post("/api/csv-chat")
244
  async def csv_chat(request: Dict, authorization: str = Header(None)):
245
  # Authorization checks
246
  if not authorization or not authorization.startswith("Bearer "):
 
426
 
427
  return "Chart generation failed after all retries"
428
 
429
+ @app.post("/api/csv-chart")
430
  async def csv_chart(request: dict, authorization: str = Header(None)):
431
  # Authorization verification
432
  if not authorization or not authorization.startswith("Bearer "):