From 3b1bf7da6771bd1d6852d3dcc1f906d5ae5c95d1 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期三, 12 三月 2025 13:49:12 +0800
Subject: [PATCH] 增加内容优化
---
app/service/v2/app_driver/chat_base.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/app/service/v2/app_driver/chat_base.py b/app/service/v2/app_driver/chat_base.py
index baacbc9..47211d0 100644
--- a/app/service/v2/app_driver/chat_base.py
+++ b/app/service/v2/app_driver/chat_base.py
@@ -22,19 +22,27 @@
@staticmethod
async def http_post(url, data, headers, timeout=300):
async with httpx.AsyncClient(timeout=timeout) as client:
- response = client.post(url, json=data, headers=headers)
+ response = await client.post(url, json=data, headers=headers)
return response
@staticmethod
async def http_get(url, params, headers, timeout=300):
async with httpx.AsyncClient(timeout=timeout) as client:
- response = client.get(url, params=params, headers=headers)
+ response = await client.get(url, params=params, headers=headers)
return response
@staticmethod
+ async def http_upload_file(url, data, files, headers, timeout=300):
+ async with httpx.AsyncClient(timeout=timeout) as client:
+ response = await client.post(url, headers=headers, files=files, data=data)
+ return response
+
+
+ @staticmethod
async def get_headers(token):
- headers = {
- # 'Content-Type': 'application/json',
+ return {
+ 'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
+
--
Gitblit v1.8.0