Update app.py
Browse files
app.py
CHANGED
|
@@ -90,6 +90,10 @@ async def upload_file(LLM_URL, LLM_API, file_path, user_id):
|
|
| 90 |
return "Error: Invalid JSON response"
|
| 91 |
|
| 92 |
async def handle_input(file_path, category):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
upload_response = await upload_file(LLM_URL, LLM_API, file_path, USER_ID)
|
| 94 |
if isinstance(upload_response, str) and upload_response.startswith("Error"):
|
| 95 |
return upload_response
|
|
|
|
| 90 |
return "Error: Invalid JSON response"
|
| 91 |
|
| 92 |
async def handle_input(file_path, category):
|
| 93 |
+
# 如果 tmp 路徑不存在,改成 repo 內的 DEMO 路徑
|
| 94 |
+
if not os.path.exists(file_path):
|
| 95 |
+
file_path = os.path.join("DEMO", os.path.basename(file_path))
|
| 96 |
+
|
| 97 |
upload_response = await upload_file(LLM_URL, LLM_API, file_path, USER_ID)
|
| 98 |
if isinstance(upload_response, str) and upload_response.startswith("Error"):
|
| 99 |
return upload_response
|