소스 검색

add moonshot settings

lloydzhou 1 년 전
부모
커밋
966db1e4be
3개의 변경된 파일63개의 추가작업 그리고 0개의 파일을 삭제
  1. 41 0
      app/components/settings.tsx
  2. 11 0
      app/locales/cn.ts
  3. 11 0
      app/locales/en.ts

+ 41 - 0
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 && (
+    <>
+      <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}
                 </>
               )}

+ 11 - 0
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: "接口密钥",

+ 11 - 0
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",