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,
ByteDance,
Alibaba,
Moonshot,
Google,
GoogleSafetySettingsThreshold,
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 ===
ServiceProvider.Stability && (
<>
@@ -1364,6 +1404,7 @@ export function Settings() {
{baiduConfigComponent}
{byteDanceConfigComponent}
{alibabaConfigComponent}
{moonshotConfigComponent}
{stabilityConfigComponent}
</>
)}