Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
•
a13de87
1
Parent(s):
d794500
增加使用额度的显示精度
Browse files- modules/openai_func.py +2 -2
modules/openai_func.py
CHANGED
@@ -46,8 +46,8 @@ def get_usage(openai_api_key):
|
|
46 |
except Exception as e:
|
47 |
logging.error(f"获取API使用情况失败:"+str(e))
|
48 |
return f"**获取API使用情况失败**"
|
49 |
-
|
50 |
-
return f"**本月使用金额** \u3000 ${
|
51 |
except requests.exceptions.ConnectTimeout:
|
52 |
status_text = standard_error_msg + connection_timeout_prompt + error_retrieve_prompt
|
53 |
return status_text
|
|
|
46 |
except Exception as e:
|
47 |
logging.error(f"获取API使用情况失败:"+str(e))
|
48 |
return f"**获取API使用情况失败**"
|
49 |
+
rounded_usage = "{:.5f}".format(usage_data['total_usage']/100)
|
50 |
+
return f"**本月使用金额** \u3000 ${rounded_usage}"
|
51 |
except requests.exceptions.ConnectTimeout:
|
52 |
status_text = standard_error_msg + connection_timeout_prompt + error_retrieve_prompt
|
53 |
return status_text
|