From 966db1e4be2e8ac8351f5bb81cadb255d1970af4 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Thu, 1 Aug 2024 12:03:22 +0800 Subject: [PATCH] add moonshot settings --- app/components/settings.tsx | 41 +++++++++++++++++++++++++++++++++++++ app/locales/cn.ts | 11 ++++++++++ app/locales/en.ts | 11 ++++++++++ 3 files changed, 63 insertions(+) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index bde3a792ae7..76b12f7ffd0 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -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 && ( + <> + + + accessStore.update( + (access) => (access.moonshotUrl = e.currentTarget.value), + ) + } + > + + + { + accessStore.update( + (access) => (access.moonshotApiKey = e.currentTarget.value), + ); + }} + /> + + + ); + const stabilityConfigComponent = accessStore.provider === ServiceProvider.Stability && ( <> @@ -1364,6 +1404,7 @@ export function Settings() { {baiduConfigComponent} {byteDanceConfigComponent} {alibabaConfigComponent} + {moonshotConfigComponent} {stabilityConfigComponent} )} diff --git a/app/locales/cn.ts b/app/locales/cn.ts index cae41bfeeac..f632d1b751c 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -393,6 +393,17 @@ const cn = { SubTitle: "样例:", }, }, + Moonshot: { + ApiKey: { + Title: "接口密钥", + SubTitle: "使用自定义月之暗面API Key", + Placeholder: "Moonshot API Key", + }, + Endpoint: { + Title: "接口地址", + SubTitle: "样例:", + }, + }, Stability: { ApiKey: { Title: "接口密钥", diff --git a/app/locales/en.ts b/app/locales/en.ts index bfb383e8f0f..9a214ba5048 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -376,6 +376,17 @@ const en: LocaleType = { 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: { ApiKey: { Title: "Stability API Key",