fix: 修复读取上传文件的路径错误
This commit is contained in:
2
main.py
2
main.py
@@ -31,7 +31,7 @@ async def main():
|
|||||||
|
|
||||||
start_scheduler()
|
start_scheduler()
|
||||||
|
|
||||||
# await SD().push()
|
await SD().push()
|
||||||
|
|
||||||
# 🔥启动FastAPI Web服务
|
# 🔥启动FastAPI Web服务
|
||||||
config = uvicorn.Config("app:app", host="0.0.0.0", port=8000, reload=True)
|
config = uvicorn.Config("app:app", host="0.0.0.0", port=8000, reload=True)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ async def upload_file(file_path: str, filename: str = "None") -> str:
|
|||||||
resp = await client.post(url, files=files, headers=headers)
|
resp = await client.post(url, files=files, headers=headers)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
return data.get("path", data.get("files", [None])[0])
|
return data.get("data", data.get("files", [None])[0])
|
||||||
|
|
||||||
|
|
||||||
async def send_webhook(group_id: str, file_url: str) -> dict:
|
async def send_webhook(group_id: str, file_url: str) -> dict:
|
||||||
@@ -52,7 +52,6 @@ async def send_webhook(group_id: str, file_url: str) -> dict:
|
|||||||
"""
|
"""
|
||||||
url = f"{config.WEBHOOK_API_URL}/webhook"
|
url = f"{config.WEBHOOK_API_URL}/webhook"
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Authorization": f"Bearer {config.WEBHOOK_API_TOKEN}",
|
"Authorization": f"Bearer {config.WEBHOOK_API_TOKEN}",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user