Skip to content

Commit 9611240

Browse files
committed
fix
1 parent ffd8c04 commit 9611240

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,6 @@ dist
128128
.yarn/build-state.yml
129129
.yarn/install-state.gz
130130
.pnp.*
131+
132+
133+
test*

assets/js/openai.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,14 @@ const app = {
122122
//总
123123
const total_granted = subscription.hard_limit_usd;
124124
//已用
125-
const total_used = usageData.total_usage / 100 || -1
125+
// const total_used = usageData.total_usage / 100 || -1
126+
const total_used = typeof usageData.total_usage === "number" ? usageData.total_usage / 100 : "查询失败";
127+
128+
// 剩余额度
129+
const total_available = typeof total_used === "number" ? total_granted - total_used : "查询失败";
130+
126131
//剩余额度
127-
const total_available = total_granted - total_used;
132+
// const total_available = total_granted - total_used;
128133

129134
if (!this.total) {
130135
this.total = [];

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<div class="page-header" x-data="{ origin: '' }" x-init="origin = window.location.origin">
4242
<h2>查询 OpenaiAPI 余额</h2>
4343
<p>API接口: <span class="proxy" x-text="origin" @click="copyToClipboard(origin)"></span>
44-
;支持批量查询,一行一个;点击清理可以清理失效的key。 (已用额度是-1时该key查询失败)</p>
44+
;支持批量查询,一行一个;点击清理可以清理失效的key。</p>
4545
</div>
4646
<main x-data="app" x-cloak>
4747
<p x-show.transition.opacity="alert" :class="alert?.type" x-text="alert?.message"></p>

0 commit comments

Comments
 (0)