Tuchuanhuhuhu commited on
Commit
a13de87
1 Parent(s): d794500

增加使用额度的显示精度

Browse files
Files changed (1) hide show
  1. 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
- usage_rounded = round(usage_data['total_usage'] / 100, 2)
50
- return f"**本月使用金额** \u3000 ${usage_rounded}"
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