mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-13 04:33:42 +08:00
feat: sync upstream code
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
import {
|
||||
ChatMessage,
|
||||
ModelType,
|
||||
useAccessStore,
|
||||
useAppConfig,
|
||||
useChatStore,
|
||||
} from "../store";
|
||||
import { ChatMessage, useAppConfig, useChatStore } from "../store";
|
||||
import Locale from "../locales";
|
||||
import styles from "./exporter.module.scss";
|
||||
import {
|
||||
@@ -524,18 +518,6 @@ export function ImagePreviewer(props: {
|
||||
}
|
||||
};
|
||||
|
||||
const markdownImageUrlCorsProcess = (markdownContent: string) => {
|
||||
const updatedContent = markdownContent.replace(
|
||||
/!\[.*?\]\((.*?)\)/g,
|
||||
(match, url) => {
|
||||
if (!url.startsWith("http")) return ``;
|
||||
const updatedURL = `/api/cors?url=${encodeURIComponent(url)}`;
|
||||
return ``;
|
||||
},
|
||||
);
|
||||
return updatedContent;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles["image-previewer"]}>
|
||||
<PreviewActions
|
||||
@@ -561,7 +543,7 @@ export function ImagePreviewer(props: {
|
||||
<div>
|
||||
<div className={styles["main-title"]}>NextChat</div>
|
||||
<div className={styles["sub-title"]}>
|
||||
github.com/Yidadaa/ChatGPT-Next-Web
|
||||
github.com/ChatGPTNextWeb/ChatGPT-Next-Web
|
||||
</div>
|
||||
<div className={styles["icons"]}>
|
||||
<ExportAvatar avatar={config.avatar} />
|
||||
@@ -603,6 +585,7 @@ export function ImagePreviewer(props: {
|
||||
<Markdown
|
||||
content={getMessageTextContent(m)}
|
||||
fontSize={config.fontSize}
|
||||
fontFamily={config.fontFamily}
|
||||
defaultShow
|
||||
/>
|
||||
{getMessageImages(m).length == 1 && (
|
||||
|
||||
@@ -9,6 +9,7 @@ interface InputRangeProps {
|
||||
min: string;
|
||||
max: string;
|
||||
step: string;
|
||||
aria: string;
|
||||
}
|
||||
|
||||
export function InputRange({
|
||||
@@ -19,11 +20,13 @@ export function InputRange({
|
||||
min,
|
||||
max,
|
||||
step,
|
||||
aria,
|
||||
}: InputRangeProps) {
|
||||
return (
|
||||
<div className={styles["input-range"] + ` ${className ?? ""}`}>
|
||||
{title || value}
|
||||
<input
|
||||
aria-label={aria}
|
||||
type="range"
|
||||
title={title}
|
||||
value={value}
|
||||
|
||||
@@ -48,14 +48,17 @@ import Locale, {
|
||||
changeLang,
|
||||
getLang,
|
||||
} from "../locales";
|
||||
import { copyToClipboard } from "../utils";
|
||||
import { copyToClipboard, clientUpdate, semverCompare } from "../utils";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
Anthropic,
|
||||
Azure,
|
||||
Baidu,
|
||||
Tencent,
|
||||
ByteDance,
|
||||
Alibaba,
|
||||
Moonshot,
|
||||
XAI,
|
||||
Google,
|
||||
GoogleSafetySettingsThreshold,
|
||||
OPENAI_BASE_URL,
|
||||
@@ -65,6 +68,9 @@ import {
|
||||
ServiceProvider,
|
||||
SlotID,
|
||||
UPDATE_URL,
|
||||
Stability,
|
||||
Iflytek,
|
||||
ChatGLM,
|
||||
} from "../constant";
|
||||
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
|
||||
import { ErrorBoundary } from "./error";
|
||||
@@ -245,6 +251,7 @@ function DangerItems() {
|
||||
subTitle={Locale.Settings.Danger.Reset.SubTitle}
|
||||
>
|
||||
<IconButton
|
||||
aria={Locale.Settings.Danger.Reset.Title}
|
||||
text={Locale.Settings.Danger.Reset.Action}
|
||||
onClick={async () => {
|
||||
if (await showConfirm(Locale.Settings.Danger.Reset.Confirm)) {
|
||||
@@ -259,6 +266,7 @@ function DangerItems() {
|
||||
subTitle={Locale.Settings.Danger.Clear.SubTitle}
|
||||
>
|
||||
<IconButton
|
||||
aria={Locale.Settings.Danger.Clear.Title}
|
||||
text={Locale.Settings.Danger.Clear.Action}
|
||||
onClick={async () => {
|
||||
if (await showConfirm(Locale.Settings.Danger.Clear.Confirm)) {
|
||||
@@ -512,6 +520,7 @@ function SyncItems() {
|
||||
>
|
||||
<div style={{ display: "flex" }}>
|
||||
<IconButton
|
||||
aria={Locale.Settings.Sync.CloudState + Locale.UI.Config}
|
||||
icon={<ConfigIcon />}
|
||||
text={Locale.UI.Config}
|
||||
onClick={() => {
|
||||
@@ -542,6 +551,7 @@ function SyncItems() {
|
||||
>
|
||||
<div style={{ display: "flex" }}>
|
||||
<IconButton
|
||||
aria={Locale.Settings.Sync.LocalState + Locale.UI.Export}
|
||||
icon={<UploadIcon />}
|
||||
text={Locale.UI.Export}
|
||||
onClick={() => {
|
||||
@@ -549,6 +559,7 @@ function SyncItems() {
|
||||
}}
|
||||
/>
|
||||
<IconButton
|
||||
aria={Locale.Settings.Sync.LocalState + Locale.UI.Import}
|
||||
icon={<DownloadIcon />}
|
||||
text={Locale.UI.Import}
|
||||
onClick={() => {
|
||||
@@ -576,7 +587,7 @@ export function Settings() {
|
||||
const [checkingUpdate, setCheckingUpdate] = useState(false);
|
||||
const currentVersion = updateStore.formatVersion(updateStore.version);
|
||||
const remoteId = updateStore.formatVersion(updateStore.remoteVersion);
|
||||
const hasNewVersion = currentVersion !== remoteId;
|
||||
const hasNewVersion = semverCompare(currentVersion, remoteId) === -1;
|
||||
const updateUrl = getClientConfig()?.isApp ? RELEASE_URL : UPDATE_URL;
|
||||
|
||||
function checkUpdate(force = false) {
|
||||
@@ -686,6 +697,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.CustomEndpoint.Title}
|
||||
type="checkbox"
|
||||
checked={accessStore.useCustomConfig}
|
||||
onChange={(e) =>
|
||||
@@ -705,6 +717,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.OpenAI.Endpoint.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.OpenAI.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.openaiUrl}
|
||||
placeholder={OPENAI_BASE_URL}
|
||||
@@ -720,6 +733,8 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.OpenAI.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria={Locale.Settings.ShowPassword}
|
||||
aria-label={Locale.Settings.Access.OpenAI.ApiKey.Title}
|
||||
value={accessStore.openaiApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.OpenAI.ApiKey.Placeholder}
|
||||
@@ -743,6 +758,7 @@ export function Settings() {
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Azure.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.azureUrl}
|
||||
placeholder={Azure.ExampleEndpoint}
|
||||
@@ -758,6 +774,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Azure.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Azure.ApiKey.Title}
|
||||
value={accessStore.azureApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Azure.ApiKey.Placeholder}
|
||||
@@ -773,6 +790,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Azure.ApiVerion.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Azure.ApiVerion.Title}
|
||||
type="text"
|
||||
value={accessStore.azureApiVersion}
|
||||
placeholder="2023-08-01-preview"
|
||||
@@ -797,6 +815,7 @@ export function Settings() {
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Google.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.googleUrl}
|
||||
placeholder={Google.ExampleEndpoint}
|
||||
@@ -812,6 +831,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Google.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Google.ApiKey.Title}
|
||||
value={accessStore.googleApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Google.ApiKey.Placeholder}
|
||||
@@ -827,6 +847,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Google.ApiVersion.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Google.ApiVersion.Title}
|
||||
type="text"
|
||||
value={accessStore.googleApiVersion}
|
||||
placeholder="2023-08-01-preview"
|
||||
@@ -842,6 +863,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Google.GoogleSafetySettings.SubTitle}
|
||||
>
|
||||
<Select
|
||||
aria-label={Locale.Settings.Access.Google.GoogleSafetySettings.Title}
|
||||
value={accessStore.googleSafetySettings}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
@@ -872,6 +894,7 @@ export function Settings() {
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Anthropic.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.anthropicUrl}
|
||||
placeholder={Anthropic.ExampleEndpoint}
|
||||
@@ -887,6 +910,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Anthropic.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Anthropic.ApiKey.Title}
|
||||
value={accessStore.anthropicApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Anthropic.ApiKey.Placeholder}
|
||||
@@ -902,6 +926,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Anthropic.ApiVerion.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Anthropic.ApiVerion.Title}
|
||||
type="text"
|
||||
value={accessStore.anthropicApiVersion}
|
||||
placeholder={Anthropic.Vision}
|
||||
@@ -923,6 +948,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Baidu.Endpoint.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Baidu.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.baiduUrl}
|
||||
placeholder={Baidu.ExampleEndpoint}
|
||||
@@ -938,6 +964,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Baidu.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Baidu.ApiKey.Title}
|
||||
value={accessStore.baiduApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Baidu.ApiKey.Placeholder}
|
||||
@@ -953,6 +980,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Baidu.SecretKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Baidu.SecretKey.Title}
|
||||
value={accessStore.baiduSecretKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Baidu.SecretKey.Placeholder}
|
||||
@@ -966,6 +994,60 @@ export function Settings() {
|
||||
</>
|
||||
);
|
||||
|
||||
const tencentConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.Tencent && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Tencent.Endpoint.Title}
|
||||
subTitle={Locale.Settings.Access.Tencent.Endpoint.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Tencent.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.tencentUrl}
|
||||
placeholder={Tencent.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.tencentUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Tencent.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.Tencent.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Tencent.ApiKey.Title}
|
||||
value={accessStore.tencentSecretId}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Tencent.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.tencentSecretId = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Tencent.SecretKey.Title}
|
||||
subTitle={Locale.Settings.Access.Tencent.SecretKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Tencent.SecretKey.Title}
|
||||
value={accessStore.tencentSecretKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Tencent.SecretKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.tencentSecretKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
const byteDanceConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.ByteDance && (
|
||||
<>
|
||||
@@ -977,6 +1059,7 @@ export function Settings() {
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.ByteDance.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.bytedanceUrl}
|
||||
placeholder={ByteDance.ExampleEndpoint}
|
||||
@@ -992,6 +1075,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.ByteDance.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.ByteDance.ApiKey.Title}
|
||||
value={accessStore.bytedanceApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.ByteDance.ApiKey.Placeholder}
|
||||
@@ -1016,6 +1100,7 @@ export function Settings() {
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Alibaba.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.alibabaUrl}
|
||||
placeholder={Alibaba.ExampleEndpoint}
|
||||
@@ -1031,6 +1116,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Alibaba.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Alibaba.ApiKey.Title}
|
||||
value={accessStore.alibabaApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Alibaba.ApiKey.Placeholder}
|
||||
@@ -1044,6 +1130,225 @@ export function Settings() {
|
||||
</>
|
||||
);
|
||||
|
||||
const moonshotConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.Moonshot && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Moonshot.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.Moonshot.Endpoint.SubTitle +
|
||||
Moonshot.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Moonshot.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.moonshotUrl}
|
||||
placeholder={Moonshot.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.moonshotUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Moonshot.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.Moonshot.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Moonshot.ApiKey.Title}
|
||||
value={accessStore.moonshotApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Moonshot.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.moonshotApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
const XAIConfigComponent = accessStore.provider === ServiceProvider.XAI && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.XAI.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.XAI.Endpoint.SubTitle + XAI.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.XAI.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.xaiUrl}
|
||||
placeholder={XAI.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.xaiUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.XAI.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.XAI.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.XAI.ApiKey.Title}
|
||||
value={accessStore.xaiApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.XAI.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.xaiApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
const chatglmConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.ChatGLM && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.ChatGLM.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.ChatGLM.Endpoint.SubTitle +
|
||||
ChatGLM.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.ChatGLM.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.chatglmUrl}
|
||||
placeholder={ChatGLM.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.chatglmUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.ChatGLM.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.ChatGLM.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.ChatGLM.ApiKey.Title}
|
||||
value={accessStore.chatglmApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.ChatGLM.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.chatglmApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
const stabilityConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.Stability && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Stability.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.Stability.Endpoint.SubTitle +
|
||||
Stability.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Stability.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.stabilityUrl}
|
||||
placeholder={Stability.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.stabilityUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Stability.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.Stability.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Stability.ApiKey.Title}
|
||||
value={accessStore.stabilityApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Stability.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.stabilityApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
const lflytekConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.Iflytek && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Iflytek.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.Iflytek.Endpoint.SubTitle +
|
||||
Iflytek.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.Iflytek.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.iflytekUrl}
|
||||
placeholder={Iflytek.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.iflytekUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Iflytek.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.Iflytek.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Iflytek.ApiKey.Title}
|
||||
value={accessStore.iflytekApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Iflytek.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.iflytekApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.Iflytek.ApiSecret.Title}
|
||||
subTitle={Locale.Settings.Access.Iflytek.ApiSecret.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.Iflytek.ApiSecret.Title}
|
||||
value={accessStore.iflytekApiSecret}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.Iflytek.ApiSecret.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.iflytekApiSecret = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<div className="window-header" data-tauri-drag-region>
|
||||
@@ -1060,6 +1365,7 @@ export function Settings() {
|
||||
<div className="window-action-button"></div>
|
||||
<div className="window-action-button">
|
||||
<IconButton
|
||||
aria={Locale.UI.Close}
|
||||
icon={<CloseIcon />}
|
||||
onClick={() => navigate(Path.Home)}
|
||||
bordered
|
||||
@@ -1083,6 +1389,8 @@ export function Settings() {
|
||||
open={showEmojiPicker}
|
||||
>
|
||||
<div
|
||||
aria-label={Locale.Settings.Avatar}
|
||||
tabIndex={0}
|
||||
className={styles.avatar}
|
||||
onClick={() => {
|
||||
setShowEmojiPicker(!showEmojiPicker);
|
||||
@@ -1106,9 +1414,17 @@ export function Settings() {
|
||||
{checkingUpdate ? (
|
||||
<LoadingIcon />
|
||||
) : hasNewVersion ? (
|
||||
<Link href={updateUrl} target="_blank" className="link">
|
||||
{Locale.Settings.Update.GoToUpdate}
|
||||
</Link>
|
||||
clientConfig?.isApp ? (
|
||||
<IconButton
|
||||
icon={<ResetIcon></ResetIcon>}
|
||||
text={Locale.Settings.Update.GoToUpdate}
|
||||
onClick={() => clientUpdate()}
|
||||
/>
|
||||
) : (
|
||||
<Link href={updateUrl} target="_blank" className="link">
|
||||
{Locale.Settings.Update.GoToUpdate}
|
||||
</Link>
|
||||
)
|
||||
) : (
|
||||
<IconButton
|
||||
icon={<ResetIcon></ResetIcon>}
|
||||
@@ -1120,6 +1436,7 @@ export function Settings() {
|
||||
|
||||
<ListItem title={Locale.Settings.SendKey}>
|
||||
<Select
|
||||
aria-label={Locale.Settings.SendKey}
|
||||
value={config.submitKey}
|
||||
onChange={(e) => {
|
||||
updateConfig(
|
||||
@@ -1138,6 +1455,7 @@ export function Settings() {
|
||||
|
||||
<ListItem title={Locale.Settings.Theme}>
|
||||
<Select
|
||||
aria-label={Locale.Settings.Theme}
|
||||
value={config.theme}
|
||||
onChange={(e) => {
|
||||
updateConfig(
|
||||
@@ -1155,6 +1473,7 @@ export function Settings() {
|
||||
|
||||
<ListItem title={Locale.Settings.Lang.Name}>
|
||||
<Select
|
||||
aria-label={Locale.Settings.Lang.Name}
|
||||
value={getLang()}
|
||||
onChange={(e) => {
|
||||
changeLang(e.target.value as any);
|
||||
@@ -1173,6 +1492,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.FontSize.SubTitle}
|
||||
>
|
||||
<InputRange
|
||||
aria={Locale.Settings.FontSize.Title}
|
||||
title={`${config.fontSize ?? 14}px`}
|
||||
value={config.fontSize}
|
||||
min="12"
|
||||
@@ -1187,11 +1507,29 @@ export function Settings() {
|
||||
></InputRange>
|
||||
</ListItem>
|
||||
|
||||
<ListItem
|
||||
title={Locale.Settings.FontFamily.Title}
|
||||
subTitle={Locale.Settings.FontFamily.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.FontFamily.Title}
|
||||
type="text"
|
||||
value={config.fontFamily}
|
||||
placeholder={Locale.Settings.FontFamily.Placeholder}
|
||||
onChange={(e) =>
|
||||
updateConfig(
|
||||
(config) => (config.fontFamily = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
|
||||
<ListItem
|
||||
title={Locale.Settings.AutoGenerateTitle.Title}
|
||||
subTitle={Locale.Settings.AutoGenerateTitle.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.AutoGenerateTitle.Title}
|
||||
type="checkbox"
|
||||
disabled={!!process.env.NEXT_PUBLIC_DISABLE_AUTOGENERATETITLE}
|
||||
checked={
|
||||
@@ -1212,6 +1550,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.SendPreviewBubble.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.SendPreviewBubble.Title}
|
||||
type="checkbox"
|
||||
checked={config.sendPreviewBubble}
|
||||
onChange={(e) =>
|
||||
@@ -1265,6 +1604,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Mask.Splash.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Mask.Splash.Title}
|
||||
type="checkbox"
|
||||
checked={!config.dontShowMaskSplashScreen}
|
||||
onChange={(e) =>
|
||||
@@ -1282,6 +1622,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Mask.Builtin.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Mask.Builtin.Title}
|
||||
type="checkbox"
|
||||
checked={config.hideBuiltinMasks}
|
||||
onChange={(e) =>
|
||||
@@ -1300,6 +1641,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Prompt.Disable.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Prompt.Disable.Title}
|
||||
type="checkbox"
|
||||
checked={config.disablePromptHint}
|
||||
onChange={(e) =>
|
||||
@@ -1319,6 +1661,7 @@ export function Settings() {
|
||||
)}
|
||||
>
|
||||
<IconButton
|
||||
aria={Locale.Settings.Prompt.List + Locale.Settings.Prompt.Edit}
|
||||
icon={<EditIcon />}
|
||||
text={Locale.Settings.Prompt.Edit}
|
||||
onClick={() => setShowPromptModal(true)}
|
||||
@@ -1340,6 +1683,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.Provider.SubTitle}
|
||||
>
|
||||
<Select
|
||||
aria-label={Locale.Settings.Access.Provider.Title}
|
||||
value={accessStore.provider}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
@@ -1364,6 +1708,12 @@ export function Settings() {
|
||||
{baiduConfigComponent}
|
||||
{byteDanceConfigComponent}
|
||||
{alibabaConfigComponent}
|
||||
{tencentConfigComponent}
|
||||
{moonshotConfigComponent}
|
||||
{stabilityConfigComponent}
|
||||
{lflytekConfigComponent}
|
||||
{XAIConfigComponent}
|
||||
{chatglmConfigComponent}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
@@ -1400,6 +1750,7 @@ export function Settings() {
|
||||
subTitle={Locale.Settings.Access.CustomModel.SubTitle}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.CustomModel.Title}
|
||||
type="text"
|
||||
value={config.customModels}
|
||||
placeholder="model1,model2,model3"
|
||||
|
||||
Reference in New Issue
Block a user