mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-17 22:43:42 +08:00
Merge branch 'main' of https://github.com/ChatGPTNextWeb/NextChat into feature-dsmodels-20250228
This commit is contained in:
@@ -29,11 +29,11 @@ type HTMLPreviewProps = {
|
||||
onLoad?: (title?: string) => void;
|
||||
};
|
||||
|
||||
export type HTMLPreviewHander = {
|
||||
export type HTMLPreviewHandler = {
|
||||
reload: () => void;
|
||||
};
|
||||
|
||||
export const HTMLPreview = forwardRef<HTMLPreviewHander, HTMLPreviewProps>(
|
||||
export const HTMLPreview = forwardRef<HTMLPreviewHandler, HTMLPreviewProps>(
|
||||
function HTMLPreview(props, ref) {
|
||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||
const [frameId, setFrameId] = useState<string>(nanoid());
|
||||
@@ -207,7 +207,7 @@ export function Artifacts() {
|
||||
const [code, setCode] = useState("");
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [fileName, setFileName] = useState("");
|
||||
const previewRef = useRef<HTMLPreviewHander>(null);
|
||||
const previewRef = useRef<HTMLPreviewHandler>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (id) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { showImageModal, FullScreen } from "./ui-lib";
|
||||
import {
|
||||
ArtifactsShareButton,
|
||||
HTMLPreview,
|
||||
HTMLPreviewHander,
|
||||
HTMLPreviewHandler,
|
||||
} from "./artifacts";
|
||||
import { useChatStore } from "../store";
|
||||
import { IconButton } from "./button";
|
||||
@@ -73,7 +73,7 @@ export function Mermaid(props: { code: string }) {
|
||||
|
||||
export function PreCode(props: { children: any }) {
|
||||
const ref = useRef<HTMLPreElement>(null);
|
||||
const previewRef = useRef<HTMLPreviewHander>(null);
|
||||
const previewRef = useRef<HTMLPreviewHandler>(null);
|
||||
const [mermaidCode, setMermaidCode] = useState("");
|
||||
const [htmlCode, setHtmlCode] = useState("");
|
||||
const { height } = useWindowSize();
|
||||
|
||||
@@ -75,6 +75,7 @@ import {
|
||||
ChatGLM,
|
||||
DeepSeek,
|
||||
SiliconFlow,
|
||||
AI302,
|
||||
Huawei,
|
||||
} from "../constant";
|
||||
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
|
||||
@@ -1458,6 +1459,46 @@ export function Settings() {
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
const ai302ConfigComponent = accessStore.provider === ServiceProvider["302.AI"] && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.AI302.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.AI302.Endpoint.SubTitle +
|
||||
AI302.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.AI302.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.ai302Url}
|
||||
placeholder={AI302.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.ai302Url = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.AI302.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.AI302.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.AI302.ApiKey.Title}
|
||||
value={accessStore.ai302ApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.AI302.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.ai302ApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
const huaweiConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.Huawei && (
|
||||
<>
|
||||
@@ -1864,6 +1905,7 @@ export function Settings() {
|
||||
{chatglmConfigComponent}
|
||||
{siliconflowConfigComponent}
|
||||
{huaweiConfigComponent}
|
||||
{ai302ConfigComponent}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user