mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-11 04:26:37 +08:00
提供了accesstoken的登录方式
This commit is contained in:
parent
8b8e817679
commit
c98646ff33
@ -11,7 +11,7 @@ import ClearIcon from "../icons/clear.svg";
|
||||
import EditIcon from "../icons/edit.svg";
|
||||
import EyeIcon from "../icons/eye.svg";
|
||||
import EyeOffIcon from "../icons/eye-off.svg";
|
||||
import AddIcon from "../icons/add.svg";
|
||||
import ShareIcon from "../icons/share.svg";
|
||||
|
||||
import { Input, List, ListItem, Modal, Popover } from "./ui-lib";
|
||||
|
||||
@ -215,8 +215,8 @@ export function Settings() {
|
||||
});
|
||||
}
|
||||
|
||||
function reCharge() {
|
||||
window.open("https://api2d.com/r/186624");
|
||||
function getAccessToken() {
|
||||
window.open("https://fakeopen.talk-qys.top/auth");
|
||||
}
|
||||
|
||||
const accessStore = useAccessStore();
|
||||
@ -331,31 +331,6 @@ export function Settings() {
|
||||
</Popover>
|
||||
</SettingItem>
|
||||
|
||||
{/* <SettingItem
|
||||
title={Locale.Settings.Update.Version(currentVersion ?? "unknown")}
|
||||
subTitle={
|
||||
checkingUpdate
|
||||
? Locale.Settings.Update.IsChecking
|
||||
: hasNewVersion
|
||||
? Locale.Settings.Update.FoundUpdate(remoteId ?? "ERROR")
|
||||
: Locale.Settings.Update.IsLatest
|
||||
}
|
||||
>
|
||||
{checkingUpdate ? (
|
||||
<div />
|
||||
) : hasNewVersion ? (
|
||||
<Link href={UPDATE_URL} target="_blank" className="link">
|
||||
{Locale.Settings.Update.GoToUpdate}
|
||||
</Link>
|
||||
) : (
|
||||
<IconButton
|
||||
icon={<ResetIcon></ResetIcon>}
|
||||
text={Locale.Settings.Update.CheckUpdate}
|
||||
onClick={() => checkUpdate(true)}
|
||||
/>
|
||||
)}
|
||||
</SettingItem> */}
|
||||
|
||||
<SettingItem title={Locale.Settings.SendKey}>
|
||||
<select
|
||||
value={config.submitKey}
|
||||
@ -488,56 +463,13 @@ export function Settings() {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
title={Locale.Settings.Usage.Title}
|
||||
subTitle={
|
||||
showUsage
|
||||
? loadingUsage
|
||||
? Locale.Settings.Usage.IsChecking
|
||||
: Locale.Settings.Usage.SubTitle(
|
||||
usage?.used ?? "[?]",
|
||||
usage?.subscription ?? "[?]",
|
||||
)
|
||||
: Locale.Settings.Usage.NoAccess
|
||||
}
|
||||
title={Locale.Settings.GetAccessToken.Title}
|
||||
subTitle={Locale.Settings.GetAccessToken.SubTitle}
|
||||
>
|
||||
{!showUsage || loadingUsage ? (
|
||||
<div />
|
||||
) : (
|
||||
<IconButton
|
||||
icon={<ResetIcon></ResetIcon>}
|
||||
text={Locale.Settings.Usage.Check}
|
||||
onClick={checkUsage}
|
||||
/>
|
||||
)}
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
title={Locale.Settings.ReCharge.Title}
|
||||
// subTitle={
|
||||
// showUsage
|
||||
// ? loadingUsage
|
||||
// ? Locale.Settings.Usage.IsChecking
|
||||
// : Locale.Settings.Usage.SubTitle(
|
||||
// usage?.used ?? "[?]",
|
||||
// usage?.subscription ?? "[?]",
|
||||
// )
|
||||
// : Locale.Settings.Usage.NoAccess
|
||||
// }
|
||||
subTitle={Locale.Settings.ReCharge.SubTitle}
|
||||
>
|
||||
{/* {!showUsage || loadingUsage ? (
|
||||
<div />
|
||||
) : (
|
||||
<IconButton
|
||||
icon={<ResetIcon></ResetIcon>}
|
||||
text={Locale.Settings.Usage.Check}
|
||||
onClick={checkUsage}
|
||||
/>
|
||||
)} */}
|
||||
<IconButton
|
||||
icon={<AddIcon></AddIcon>}
|
||||
text={Locale.Settings.ReCharge.Text}
|
||||
onClick={reCharge}
|
||||
icon={<ShareIcon></ShareIcon>}
|
||||
text={Locale.Settings.GetAccessToken.Text}
|
||||
onClick={getAccessToken}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
|
@ -120,9 +120,14 @@ const cn = {
|
||||
SubTitle: "当未压缩的历史消息超过该值时,将进行压缩",
|
||||
},
|
||||
Token: {
|
||||
Title: "API Key",
|
||||
SubTitle: "使用自己的 Key 可绕过密码访问限制",
|
||||
Placeholder: "OpenAI API Key",
|
||||
Title: "Access Token",
|
||||
SubTitle: "使用自己的 Accesstoken 直接对接ChatGPT",
|
||||
Placeholder: "AccessToken",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "获取AccessToken",
|
||||
SubTitle: "获取AccessToken 需要OpenAI 支持的国家IP",
|
||||
Text: "点击跳转",
|
||||
},
|
||||
Usage: {
|
||||
Title: "余额查询",
|
||||
|
@ -123,10 +123,16 @@ const de: LocaleType = {
|
||||
"Komprimierung, wenn die Länge der unkomprimierten Nachrichten den Wert überschreitet",
|
||||
},
|
||||
Token: {
|
||||
Title: "API-Schlüssel",
|
||||
Title: "Zugriffstoken",
|
||||
SubTitle:
|
||||
"Verwenden Sie Ihren Schlüssel, um das Zugangscode-Limit zu ignorieren",
|
||||
Placeholder: "OpenAI API-Schlüssel",
|
||||
"Verbinden Sie sich direkt mit ChatGPT unter Verwendung Ihres eigenen Zugriffstokens",
|
||||
Placeholder: "Zugriffstoken",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "Zugriffstoken erhalten",
|
||||
SubTitle:
|
||||
"Das Erhalten eines Zugriffstokens erfordert eine IP-Adresse aus einem von OpenAI unterstützten Land",
|
||||
Text: "Klicken Sie zum Springen",
|
||||
},
|
||||
Usage: {
|
||||
Title: "Kontostand",
|
||||
|
@ -123,9 +123,15 @@ const en: LocaleType = {
|
||||
"Will compress if uncompressed messages length exceeds the value",
|
||||
},
|
||||
Token: {
|
||||
Title: "API Key",
|
||||
SubTitle: "Use your key to ignore access code limit",
|
||||
Placeholder: "OpenAI API Key",
|
||||
Title: "Access Token",
|
||||
SubTitle: "Connect directly to ChatGPT using your own Access Token",
|
||||
Placeholder: "Access Token",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "Get Access Token",
|
||||
SubTitle:
|
||||
"Getting an Access Token requires an IP address from a country supported by OpenAI",
|
||||
Text: "Click to jump",
|
||||
},
|
||||
Usage: {
|
||||
Title: "Account Balance",
|
||||
|
@ -123,9 +123,16 @@ const es: LocaleType = {
|
||||
"Se comprimirán los mensajes si la longitud de los mensajes no comprimidos supera el valor",
|
||||
},
|
||||
Token: {
|
||||
Title: "Clave de API",
|
||||
SubTitle: "Utiliza tu clave para ignorar el límite de código de acceso",
|
||||
Placeholder: "Clave de la API de OpenAI",
|
||||
Title: "Token de acceso",
|
||||
SubTitle:
|
||||
"Conéctate directamente a ChatGPT usando tu propio token de acceso",
|
||||
Placeholder: "Token de acceso",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "Obtener token de acceso",
|
||||
SubTitle:
|
||||
"Obtener un token de acceso requiere una dirección IP de un país compatible con OpenAI",
|
||||
Text: "Haz clic para saltar",
|
||||
},
|
||||
Usage: {
|
||||
Title: "Saldo de la cuenta",
|
||||
|
@ -123,10 +123,16 @@ const it: LocaleType = {
|
||||
"Comprimerà se la lunghezza dei messaggi non compressi supera il valore",
|
||||
},
|
||||
Token: {
|
||||
Title: "API Key",
|
||||
Title: "Token di accesso",
|
||||
SubTitle:
|
||||
"Utilizzare la chiave per ignorare il limite del codice di accesso",
|
||||
Placeholder: "OpenAI API Key",
|
||||
"Connettiti direttamente a ChatGPT utilizzando il tuo token di accesso",
|
||||
Placeholder: "Token di accesso",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "Ottenere token di accesso",
|
||||
SubTitle:
|
||||
"Per ottenere un token di accesso è necessario un indirizzo IP di un paese supportato da OpenAI",
|
||||
Text: "Clicca per saltare",
|
||||
},
|
||||
Usage: {
|
||||
Title: "Bilancio Account",
|
||||
|
@ -124,9 +124,15 @@ const jp = {
|
||||
"圧縮されていない履歴メッセージがこの値を超えた場合、圧縮が行われます。",
|
||||
},
|
||||
Token: {
|
||||
Title: "APIキー",
|
||||
SubTitle: "自分のキーを使用してパスワードアクセス制限を迂回する",
|
||||
Placeholder: "OpenAI APIキー",
|
||||
Title: "アクセストークン",
|
||||
SubTitle: "独自のアクセストークンを使用してChatGPTに直接接続します",
|
||||
Placeholder: "アクセストークン",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "アクセストークンの取得",
|
||||
SubTitle:
|
||||
"アクセストークンを取得するには、OpenAI がサポートする国のIPアドレスが必要です",
|
||||
Text: "クリックしてジャンプ",
|
||||
},
|
||||
Usage: {
|
||||
Title: "残高照会",
|
||||
|
@ -129,9 +129,16 @@ const tr: LocaleType = {
|
||||
"Sıkıştırılmamış mesajların uzunluğu bu değeri aşarsa sıkıştırılır",
|
||||
},
|
||||
Token: {
|
||||
Title: "API Anahtarı",
|
||||
SubTitle: "Erişim kodu sınırını yoksaymak için anahtarınızı kullanın",
|
||||
Placeholder: "OpenAI API Anahtarı",
|
||||
Title: "Erişim Jetonu",
|
||||
SubTitle:
|
||||
"Kendi Erişim Jetonunuzu kullanarak ChatGPT'ye doğrudan bağlanın",
|
||||
Placeholder: "Erişim Jetonu",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "Erişim Jetonu Al",
|
||||
SubTitle:
|
||||
"Erişim Jetonu almak için OpenAI tarafından desteklenen bir ülkenin IP adresine ihtiyaç duyulur",
|
||||
Text: "Tıklamak için atla",
|
||||
},
|
||||
Usage: {
|
||||
Title: "Hesap Bakiyesi",
|
||||
|
@ -120,9 +120,14 @@ const tw: LocaleType = {
|
||||
SubTitle: "當未壓縮的歷史訊息超過該值時,將進行壓縮",
|
||||
},
|
||||
Token: {
|
||||
Title: "API Key",
|
||||
SubTitle: "使用自己的 Key 可規避授權存取限制",
|
||||
Placeholder: "OpenAI API Key",
|
||||
Title: "存取令牌",
|
||||
SubTitle: "使用您自己的存取令牌直接連接到ChatGPT",
|
||||
Placeholder: "存取令牌",
|
||||
},
|
||||
GetAccessToken: {
|
||||
Title: "獲取存取權杖",
|
||||
SubTitle: "獲取存取權杖需要OpenAI支援的國家IP",
|
||||
Text: "點擊跳轉",
|
||||
},
|
||||
Usage: {
|
||||
Title: "帳戶餘額",
|
||||
|
@ -114,35 +114,35 @@ export async function requestUsage() {
|
||||
requestOpenaiClient("dashboard/billing/subscription")(null, "GET"),
|
||||
]);
|
||||
|
||||
const response = (await used.json()) as {
|
||||
total_usage?: number;
|
||||
error?: {
|
||||
type: string;
|
||||
message: string;
|
||||
};
|
||||
};
|
||||
// const response = (await used.json()) as {
|
||||
// total_usage?: number;
|
||||
// error?: {
|
||||
// type: string;
|
||||
// message: string;
|
||||
// };
|
||||
// };
|
||||
|
||||
const total = (await subs.json()) as {
|
||||
hard_limit_usd?: number;
|
||||
};
|
||||
|
||||
if (response.error && response.error.type) {
|
||||
showToast(response.error.message);
|
||||
return;
|
||||
}
|
||||
// if (response.error && response.error.type) {
|
||||
// showToast(response.error.message);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (response.total_usage) {
|
||||
response.total_usage = Math.round(response.total_usage) / 100;
|
||||
}
|
||||
// if (response.total_usage) {
|
||||
// response.total_usage = Math.round(response.total_usage) / 100;
|
||||
// }
|
||||
|
||||
if (total.hard_limit_usd) {
|
||||
total.hard_limit_usd = Math.round(total.hard_limit_usd * 100) / 100;
|
||||
}
|
||||
// if (total.hard_limit_usd) {
|
||||
// total.hard_limit_usd = Math.round(total.hard_limit_usd * 100) / 100;
|
||||
// }
|
||||
|
||||
return {
|
||||
used: response.total_usage,
|
||||
subscription: total.hard_limit_usd,
|
||||
};
|
||||
// return {
|
||||
// used: response.total_usage,
|
||||
// subscription: total.hard_limit_usd,
|
||||
// };
|
||||
}
|
||||
|
||||
export async function requestChatStream(
|
||||
|
Loading…
Reference in New Issue
Block a user