add moonshot settings

This commit is contained in:
lloydzhou 2024-08-01 12:03:22 +08:00
parent b8bbc37b8e
commit 966db1e4be
3 changed files with 63 additions and 0 deletions

View File

@ -56,6 +56,7 @@ import {
Baidu, Baidu,
ByteDance, ByteDance,
Alibaba, Alibaba,
Moonshot,
Google, Google,
GoogleSafetySettingsThreshold, GoogleSafetySettingsThreshold,
OPENAI_BASE_URL, OPENAI_BASE_URL,
@ -1042,6 +1043,45 @@ 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
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
value={accessStore.moonshotApiKey}
type="text"
placeholder={Locale.Settings.Access.Moonshot.ApiKey.Placeholder}
onChange={(e) => {
accessStore.update(
(access) => (access.moonshotApiKey = e.currentTarget.value),
);
}}
/>
</ListItem>
</>
);
const stabilityConfigComponent = accessStore.provider === const stabilityConfigComponent = accessStore.provider ===
ServiceProvider.Stability && ( ServiceProvider.Stability && (
<> <>
@ -1364,6 +1404,7 @@ export function Settings() {
{baiduConfigComponent} {baiduConfigComponent}
{byteDanceConfigComponent} {byteDanceConfigComponent}
{alibabaConfigComponent} {alibabaConfigComponent}
{moonshotConfigComponent}
{stabilityConfigComponent} {stabilityConfigComponent}
</> </>
)} )}

View File

@ -393,6 +393,17 @@ const cn = {
SubTitle: "样例:", SubTitle: "样例:",
}, },
}, },
Moonshot: {
ApiKey: {
Title: "接口密钥",
SubTitle: "使用自定义月之暗面API Key",
Placeholder: "Moonshot API Key",
},
Endpoint: {
Title: "接口地址",
SubTitle: "样例:",
},
},
Stability: { Stability: {
ApiKey: { ApiKey: {
Title: "接口密钥", Title: "接口密钥",

View File

@ -376,6 +376,17 @@ const en: LocaleType = {
SubTitle: "Example: ", SubTitle: "Example: ",
}, },
}, },
Moonshot: {
ApiKey: {
Title: "Moonshot API Key",
SubTitle: "Use a custom Moonshot API Key",
Placeholder: "Moonshot API Key",
},
Endpoint: {
Title: "Endpoint Address",
SubTitle: "Example: ",
},
},
Stability: { Stability: {
ApiKey: { ApiKey: {
Title: "Stability API Key", Title: "Stability API Key",