Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
x-dr committed Jul 16, 2023
1 parent ffd8c04 commit 9611240
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*


test*
9 changes: 7 additions & 2 deletions assets/js/openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,14 @@ const app = {
//总
const total_granted = subscription.hard_limit_usd;
//已用
const total_used = usageData.total_usage / 100 || -1
// const total_used = usageData.total_usage / 100 || -1
const total_used = typeof usageData.total_usage === "number" ? usageData.total_usage / 100 : "查询失败";

// 剩余额度
const total_available = typeof total_used === "number" ? total_granted - total_used : "查询失败";

//剩余额度
const total_available = total_granted - total_used;
// const total_available = total_granted - total_used;

if (!this.total) {
this.total = [];
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="page-header" x-data="{ origin: '' }" x-init="origin = window.location.origin">
<h2>查询 OpenaiAPI 余额</h2>
<p>API接口: <span class="proxy" x-text="origin" @click="copyToClipboard(origin)"></span>
;支持批量查询,一行一个;点击清理可以清理失效的key。 (已用额度是-1时该key查询失败)</p>
;支持批量查询,一行一个;点击清理可以清理失效的key。</p>
</div>
<main x-data="app" x-cloak>
<p x-show.transition.opacity="alert" :class="alert?.type" x-text="alert?.message"></p>
Expand Down

0 comments on commit 9611240

Please sign in to comment.