From 596978d35fbbc47b0c41ecef685ae166a68be1e0 Mon Sep 17 00:00:00 2001 From: wood Date: Fri, 20 Oct 2023 20:17:00 +0800 Subject: [PATCH] update --- index.html | 3 ++- static/css.css | 48 ++++++++++++++++++++++++------------------------ static/js.js | 23 ++++++++++++++--------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/index.html b/index.html index 15deb2f..e5917c0 100644 --- a/index.html +++ b/index.html @@ -40,8 +40,9 @@ onchange="toggleCustomUrlInput()"> + - + 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’ + } }