Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -185,20 +185,15 @@ def chat(
|
|
185 |
except Exception as e:
|
186 |
raise HTTPException(status_code=500, detail=f"Error processing chat query: {str(e)}")
|
187 |
|
188 |
-
# Optionally update the user's chat_histories with the new messages here
|
189 |
-
|
190 |
return StreamingResponse(stream_generator, media_type="text/event-stream")
|
191 |
|
192 |
# ----------------------- Remaining Endpoints -----------------------
|
193 |
@app.post("/add_document")
|
194 |
async def add_document(
|
195 |
-
file: Optional[
|
196 |
wiki_query: Optional[str] = Query(None),
|
197 |
wiki_url: Optional[str] = Query(None)
|
198 |
):
|
199 |
-
if not isinstance(file, UploadFile):
|
200 |
-
file = None
|
201 |
-
|
202 |
if file is None and wiki_query is None and wiki_url is None:
|
203 |
raise HTTPException(status_code=400, detail="No document input provided (file, wiki_query, or wiki_url).")
|
204 |
|
|
|
185 |
except Exception as e:
|
186 |
raise HTTPException(status_code=500, detail=f"Error processing chat query: {str(e)}")
|
187 |
|
|
|
|
|
188 |
return StreamingResponse(stream_generator, media_type="text/event-stream")
|
189 |
|
190 |
# ----------------------- Remaining Endpoints -----------------------
|
191 |
@app.post("/add_document")
|
192 |
async def add_document(
|
193 |
+
file: Optional[UploadFile] = File(None), # Changed type to UploadFile
|
194 |
wiki_query: Optional[str] = Query(None),
|
195 |
wiki_url: Optional[str] = Query(None)
|
196 |
):
|
|
|
|
|
|
|
197 |
if file is None and wiki_query is None and wiki_url is None:
|
198 |
raise HTTPException(status_code=400, detail="No document input provided (file, wiki_query, or wiki_url).")
|
199 |
|