mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-17 14:33:41 +08:00
Add new provider OpenRouter
This commit is contained in:
@@ -64,11 +64,17 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) {
|
||||
LlmIcon = BotIconGemini;
|
||||
} else if (modelName.startsWith("gemma")) {
|
||||
LlmIcon = BotIconGemma;
|
||||
} else if (modelName.startsWith("claude")) {
|
||||
} else if (
|
||||
modelName.startsWith("claude") ||
|
||||
modelName.startsWith("anthropic")
|
||||
) {
|
||||
LlmIcon = BotIconClaude;
|
||||
} else if (modelName.includes("llama")) {
|
||||
LlmIcon = BotIconMeta;
|
||||
} else if (modelName.startsWith("mixtral") || modelName.startsWith("codestral")) {
|
||||
} else if (
|
||||
modelName.startsWith("mixtral") ||
|
||||
modelName.startsWith("codestral")
|
||||
) {
|
||||
LlmIcon = BotIconMistral;
|
||||
} else if (modelName.includes("deepseek")) {
|
||||
LlmIcon = BotIconDeepseek;
|
||||
|
||||
@@ -75,6 +75,7 @@ import {
|
||||
ChatGLM,
|
||||
DeepSeek,
|
||||
SiliconFlow,
|
||||
OpenRouter,
|
||||
} from "../constant";
|
||||
import { Prompt, SearchService, usePromptStore } from "../store/prompt";
|
||||
import { ErrorBoundary } from "./error";
|
||||
@@ -1458,6 +1459,48 @@ export function Settings() {
|
||||
</>
|
||||
);
|
||||
|
||||
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={Locale.Settings.ShowPassword}
|
||||
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>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<div className="window-header" data-tauri-drag-region>
|
||||
@@ -1822,6 +1865,7 @@ export function Settings() {
|
||||
{XAIConfigComponent}
|
||||
{chatglmConfigComponent}
|
||||
{siliconflowConfigComponent}
|
||||
{openRouterConfigComponent}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user