mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-13 21:43:42 +08:00
feat: Add service provider OpenRouter
This commit is contained in:
@@ -75,6 +75,7 @@ import {
|
||||
ChatGLM,
|
||||
DeepSeek,
|
||||
SiliconFlow,
|
||||
OpenRouter,
|
||||
} from "../constant";
|
||||
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
|
||||
import { ErrorBoundary } from "./error";
|
||||
@@ -1359,6 +1360,46 @@ export function Settings() {
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
const openrouterConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.OpenRouter && (
|
||||
<>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.OpenRouter.Endpoint.Title}
|
||||
subTitle={
|
||||
Locale.Settings.Access.OpenRouter.Endpoint.SubTitle +
|
||||
OpenRouter.ExampleEndpoint
|
||||
}
|
||||
>
|
||||
<input
|
||||
aria-label={Locale.Settings.Access.OpenRouter.Endpoint.Title}
|
||||
type="text"
|
||||
value={accessStore.openrouterUrl}
|
||||
placeholder={OpenRouter.ExampleEndpoint}
|
||||
onChange={(e) =>
|
||||
accessStore.update(
|
||||
(access) => (access.openrouterUrl = e.currentTarget.value),
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={Locale.Settings.Access.OpenRouter.ApiKey.Title}
|
||||
subTitle={Locale.Settings.Access.OpenRouter.ApiKey.SubTitle}
|
||||
>
|
||||
<PasswordInput
|
||||
aria-label={Locale.Settings.Access.OpenRouter.ApiKey.Title}
|
||||
value={accessStore.openrouterApiKey}
|
||||
type="text"
|
||||
placeholder={Locale.Settings.Access.OpenRouter.ApiKey.Placeholder}
|
||||
onChange={(e) => {
|
||||
accessStore.update(
|
||||
(access) => (access.openrouterApiKey = e.currentTarget.value),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</>
|
||||
);
|
||||
|
||||
const stabilityConfigComponent = accessStore.provider ===
|
||||
ServiceProvider.Stability && (
|
||||
@@ -1822,6 +1863,7 @@ export function Settings() {
|
||||
{XAIConfigComponent}
|
||||
{chatglmConfigComponent}
|
||||
{siliconflowConfigComponent}
|
||||
{openrouterConfigComponent}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
Reference in New Issue
Block a user