Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
9310dbb
1
Parent(s):
a3e8551
次要改动:调整打印输出内容
Browse files- modules/openai_func.py +2 -3
modules/openai_func.py
CHANGED
@@ -51,7 +51,7 @@ def get_usage_response(openai_api_key):
|
|
51 |
def get_usage(openai_api_key):
|
52 |
try:
|
53 |
response=get_usage_response(openai_api_key=openai_api_key)
|
54 |
-
|
55 |
try:
|
56 |
balance = response.json().get("total_available") if response.json().get(
|
57 |
"total_available") else 0
|
@@ -60,7 +60,7 @@ def get_usage(openai_api_key):
|
|
60 |
except Exception as e:
|
61 |
logging.error(f"API使用情况解析失败:"+str(e))
|
62 |
balance = 0
|
63 |
-
total_used=0
|
64 |
return f"**API使用情况**(已用/余额)\u3000{total_used}$ / {balance}$"
|
65 |
except requests.exceptions.ConnectTimeout:
|
66 |
status_text = standard_error_msg + connection_timeout_prompt + error_retrieve_prompt
|
@@ -68,4 +68,3 @@ def get_usage(openai_api_key):
|
|
68 |
except requests.exceptions.ReadTimeout:
|
69 |
status_text = standard_error_msg + read_timeout_prompt + error_retrieve_prompt
|
70 |
return status_text
|
71 |
-
|
|
|
51 |
def get_usage(openai_api_key):
|
52 |
try:
|
53 |
response=get_usage_response(openai_api_key=openai_api_key)
|
54 |
+
logging.debug(response.json())
|
55 |
try:
|
56 |
balance = response.json().get("total_available") if response.json().get(
|
57 |
"total_available") else 0
|
|
|
60 |
except Exception as e:
|
61 |
logging.error(f"API使用情况解析失败:"+str(e))
|
62 |
balance = 0
|
63 |
+
total_used=0
|
64 |
return f"**API使用情况**(已用/余额)\u3000{total_used}$ / {balance}$"
|
65 |
except requests.exceptions.ConnectTimeout:
|
66 |
status_text = standard_error_msg + connection_timeout_prompt + error_retrieve_prompt
|
|
|
68 |
except requests.exceptions.ReadTimeout:
|
69 |
status_text = standard_error_msg + read_timeout_prompt + error_retrieve_prompt
|
70 |
return status_text
|
|