This commit is contained in:
wood 2023-10-20 20:17:00 +08:00
parent 99a615d707
commit 596978d35f
3 changed files with 40 additions and 34 deletions

View File

@ -40,8 +40,9 @@
onchange="toggleCustomUrlInput()"> onchange="toggleCustomUrlInput()">
<option value="https://api.openai.com">【官网线路】api.openai.com</option> <option value="https://api.openai.com">【官网线路】api.openai.com</option>
<option value="https://oapi.czl.net">【CZLoapi线路】oapi.czl.net</option> <option value="https://oapi.czl.net">【CZLoapi线路】oapi.czl.net</option>
<option value="https://gateway.ai.cloudflare.com/v1/feedd0aa8abd6875052d86a94f1baf83/test/openai">【Cloudflare网关】查不了已用量</option>
<option value="https://openai.996.lat">【群友提供公益CF反代,勿测重要key】openai.996.lat</option> <option value="https://openai.996.lat">【群友提供公益CF反代,勿测重要key】openai.996.lat</option>
<option value="custom">【已前置https】自定义 ...</option> <option value="custom">【已前置https】自定义</option>
</select> </select>
<input type="text" id="custom-url-input" placeholder="输入自定义API填域名即可无需https://" <input type="text" id="custom-url-input" placeholder="输入自定义API填域名即可无需https://"

View File

@ -8,7 +8,7 @@
} }
body { body {
background: url('https://cdn-img.czl.net/2023/05/23/pjbczr.webp') no-repeat center center fixed; background: url('https://cdn-img-r2.czl.net/2023/05/23/pjbczr.webp') no-repeat center center fixed;
/* 自定义背景图 */ /* 自定义背景图 */
background-size: cover; background-size: cover;
width: 90%; width: 90%;
@ -19,7 +19,7 @@ body {
padding-right: 2rem; padding-right: 2rem;
color: var(--body-color); color: var(--body-color);
/* background: var(--body-bg); */ /* background: var(--body-bg); */
font-family: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif; font-family: -apple-system,BlinkMacSystemFont,'Helvetica Neue',Helvetica,Segoe UI,Arial,Roboto,'PingFang SC',miui,'Hiragino Sans GB','Microsoft Yahei',sans-serif;
line-height: 1.5; line-height: 1.5;
-webkit-tap-highlight-color: rgb(252, 247, 247); -webkit-tap-highlight-color: rgb(252, 247, 247);
text-rendering: optimizelegibility; text-rendering: optimizelegibility;
@ -356,13 +356,15 @@ button.loading::before {
/* 在小于768px的屏幕上生效的样式 */ /* 在小于768px的屏幕上生效的样式 */
/* 可以减小字体和表格单元格的大小,使其适应小屏设备 */ /* 可以减小字体和表格单元格的大小,使其适应小屏设备 */
#result-table th, #result-table td { #result-table th,
#result-table td {
font-size: 8px; font-size: 8px;
padding: 5px 3px; padding: 5px 3px;
} }
/* 可以隐藏一些不是非常重要的列,以便更有效地利用屏幕空间 */ /* 可以隐藏一些不是非常重要的列,以便更有效地利用屏幕空间 */
#result-table th:nth-child(n+12), #result-table td:nth-child(n+12) { #result-table th:nth-child(n+12),
#result-table td:nth-child(n+12) {
display: none; display: none;
} }
} }
@ -388,7 +390,7 @@ button.loading::before {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
background-color: rgba(0,0,0,0.5); background-color: rgba(0, 0, 0, 0.5);
} }
.modal-content { .modal-content {
@ -404,11 +406,13 @@ button.loading::before {
border-radius: 12px; border-radius: 12px;
white-space: pre-wrap; white-space: pre-wrap;
} }
.modal h2{
margin:8px; .modal h2 {
margin: 8px;
} }
.modal p{
margin-block-start:0; .modal p {
margin-block-start: 0;
margin-block-end: 0; margin-block-end: 0;
} }
@ -417,7 +421,7 @@ button.loading::before {
font-size: 28px; font-size: 28px;
font-weight: bold; font-weight: bold;
align-self: flex-end; align-self: flex-end;
margin:8px; margin: 8px;
} }
.close:hover, .close:hover,
@ -444,10 +448,6 @@ button.loading::before {
align-items: flex-start; align-items: flex-start;
} }
#modalText{ #modalText {
margin: 0; margin: 0;
} }

View File

@ -45,13 +45,13 @@ async function checkBilling(apiKey, apiUrl) {
"Authorization": "Bearer " + apiKey, "Authorization": "Bearer " + apiKey,
"Content-Type": "application/json" "Content-Type": "application/json"
}; };
const modelsCheck = `${apiUrl}/v1/models`; const modelsCheck = `${apiUrl}/models`;
const urlSubscription = `${apiUrl}/v1/dashboard/billing/subscription`; const urlSubscription = `${apiUrl}/dashboard/billing/subscription`;
let urlUsage = `${apiUrl}/v1/dashboard/billing/usage?start_date=${formatDate(startDate)}&end_date=${formatDate(endDate)}`; let urlUsage = `${apiUrl}/dashboard/billing/usage?start_date=${formatDate(startDate)}&end_date=${formatDate(endDate)}`;
const urlsetid = apiUrl + '/v1/organizations'; const urlsetid = apiUrl + '/organizations';
const urlPaymentmethods = `${apiUrl}/v1/dashboard/billing/payment_methods`; const urlPaymentmethods = `${apiUrl}/dashboard/billing/payment_methods`;
const urlRatelimits = `${apiUrl}/v1/dashboard/rate_limits`; const urlRatelimits = `${apiUrl}/dashboard/rate_limits`;
const urlAdvanceData = apiUrl + '/dashboard/billing/credit_grants'; // 预付费查询接口 const urlAdvanceData = `${apiUrl}/dashboard/billing/credit_grants`; // 预付费查询接口
try { try {
let totalAmount, totalUsage, remaining, GPT35CheckResult, GPT4CheckResult, GPT432kCheckResult, setid, isSubscrible; let totalAmount, totalUsage, remaining, GPT35CheckResult, GPT4CheckResult, GPT432kCheckResult, setid, isSubscrible;
@ -77,7 +77,7 @@ async function checkBilling(apiKey, apiUrl) {
if (totalAmount > 6) { if (totalAmount > 6) {
startDate = subDate; startDate = subDate;
urlUsage = `${apiUrl}/v1/dashboard/billing/usage?start_date=${formatDate(startDate)}&end_date=${formatDate(endDate)}`; urlUsage = `${apiUrl}/dashboard/billing/usage?start_date=${formatDate(startDate)}&end_date=${formatDate(endDate)}`;
response = await fetch(urlUsage, { headers }); response = await fetch(urlUsage, { headers });
const usageData = await response.json(); const usageData = await response.json();
} }
@ -219,7 +219,7 @@ async function checkBilling(apiKey, apiUrl) {
errors['modelsCheck'] = error.message; errors['modelsCheck'] = error.message;
} }
async function checkCompletion(apiKey, apiUrl) { async function checkCompletion(apiKey, apiUrl) {
const urlCompletion = `${apiUrl}/v1/chat/completions`; const urlCompletion = `${apiUrl}/chat/completions`;
const headers = { const headers = {
"Authorization": "Bearer " + apiKey, "Authorization": "Bearer " + apiKey,
"Content-Type": "application/json" "Content-Type": "application/json"
@ -293,9 +293,14 @@ function sendRequest() {
if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) { if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) {
apiUrl = "https://" + apiUrl; apiUrl = "https://" + apiUrl;
} }
apiUrl += "/v1";
} }
} else { } else {
apiUrl = apiUrlSelect.value; apiUrl = apiUrlSelect.value;
// 检查选择的是否是"Cloudflare网关"选项
if (apiUrlSelect.value !== "https://gateway.ai.cloudflare.com/v1/feedd0aa8abd6875052d86a94f1baf83/test/openai") {
apiUrl += "/v1"; // 如果不是,则添加路径‘/v1
}
} }