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()">
<option value="https://api.openai.com">【官网线路】api.openai.com</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="custom">【已前置https】自定义 ...</option>
<option value="custom">【已前置https】自定义</option>
</select>
<input type="text" id="custom-url-input" placeholder="输入自定义API填域名即可无需https://"

View File

@ -8,7 +8,7 @@
}
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;
width: 90%;
@ -19,7 +19,7 @@ body {
padding-right: 2rem;
color: var(--body-color);
/* 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;
-webkit-tap-highlight-color: rgb(252, 247, 247);
text-rendering: optimizelegibility;
@ -356,13 +356,15 @@ button.loading::before {
/* 在小于768px的屏幕上生效的样式 */
/* 可以减小字体和表格单元格的大小,使其适应小屏设备 */
#result-table th, #result-table td {
#result-table th,
#result-table td {
font-size: 8px;
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;
}
}
@ -388,13 +390,13 @@ button.loading::before {
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.5);
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
position: relative;
display: flex;
flex-direction: column;
display: flex;
flex-direction: column;
background-color: #fefefe;
color: #000000;
margin: auto;
@ -404,11 +406,13 @@ button.loading::before {
border-radius: 12px;
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;
}
@ -416,8 +420,8 @@ button.loading::before {
color: #FFF;
font-size: 28px;
font-weight: bold;
align-self: flex-end;
margin:8px;
align-self: flex-end;
margin: 8px;
}
.close:hover,
@ -428,26 +432,22 @@ button.loading::before {
}
.modal-header {
padding: 0px;
padding: 0px;
background-color: var(--color-primary);
color: white;
display: flex;
justify-content: space-between;
align-items: center;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 12px 12px 0px 0px;
}
.modal-body {
padding: 10px 16px;
overflow-y: auto;
overflow-y: auto;
display: flex;
align-items: flex-start;
}
#modalText{
#modalText {
margin: 0;
}
}

View File

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