DeepLearning101 commited on
Commit
6ad0311
·
verified ·
1 Parent(s): a61117a

UPDATE POST /v1/files/upload

Browse files

檔案上傳的 endpoint 其實是:POST /v1/files/upload

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -67,13 +67,14 @@ async def upload_file(LLM_URL, LLM_API, file_path, user_id):
67
  form_data.add_field('file', f, filename=file_path, content_type=mime_type)
68
  form_data.add_field('user', user_id)
69
  async with session.post(
70
- f"{LLM_URL}/files/upload",
71
  headers={"Authorization": f"Bearer {LLM_API}"},
72
  data=form_data
73
  ) as response:
74
  if response.status == 404:
75
  return "Error: Endpoint not found (404)"
76
  response_text = await response.text()
 
77
  try:
78
  return json.loads(response_text)
79
  except json.JSONDecodeError:
 
67
  form_data.add_field('file', f, filename=file_path, content_type=mime_type)
68
  form_data.add_field('user', user_id)
69
  async with session.post(
70
+ f"{LLM_URL}/v1/files/upload", # ✅ 加上 v1
71
  headers={"Authorization": f"Bearer {LLM_API}"},
72
  data=form_data
73
  ) as response:
74
  if response.status == 404:
75
  return "Error: Endpoint not found (404)"
76
  response_text = await response.text()
77
+ print("Upload response:", response_text) # 加這一行
78
  try:
79
  return json.loads(response_text)
80
  except json.JSONDecodeError: