|
@@ -1,6 +1,6 @@
|
|
|
import { create } from "zustand";
|
|
|
import { persist } from "zustand/middleware";
|
|
|
-import { DEFAULT_API_HOST, StoreKey } from "../constant";
|
|
|
+import { DEFAULT_API_HOST, DEFAULT_MODELS, StoreKey } from "../constant";
|
|
|
import { getHeaders } from "../client/api";
|
|
|
import { BOT_HELLO } from "./chat";
|
|
|
import { getClientConfig } from "../config/client";
|
|
@@ -11,8 +11,10 @@ export interface AccessControlStore {
|
|
|
|
|
|
needCode: boolean;
|
|
|
hideUserApiKey: boolean;
|
|
|
- openaiUrl: string;
|
|
|
hideBalanceQuery: boolean;
|
|
|
+ disableGPT4: boolean;
|
|
|
+
|
|
|
+ openaiUrl: string;
|
|
|
|
|
|
updateToken: (_: string) => void;
|
|
|
updateCode: (_: string) => void;
|
|
@@ -35,8 +37,10 @@ export const useAccessStore = create<AccessControlStore>()(
|
|
|
accessCode: "",
|
|
|
needCode: true,
|
|
|
hideUserApiKey: false,
|
|
|
- openaiUrl: DEFAULT_OPENAI_URL,
|
|
|
hideBalanceQuery: false,
|
|
|
+ disableGPT4: false,
|
|
|
+
|
|
|
+ openaiUrl: DEFAULT_OPENAI_URL,
|
|
|
|
|
|
enabledAccessControl() {
|
|
|
get().fetch();
|
|
@@ -75,8 +79,10 @@ export const useAccessStore = create<AccessControlStore>()(
|
|
|
console.log("[Config] got config from server", res);
|
|
|
set(() => ({ ...res }));
|
|
|
|
|
|
- if ((res as any).botHello) {
|
|
|
- BOT_HELLO.content = (res as any).botHello;
|
|
|
+ if (res.disableGPT4) {
|
|
|
+ DEFAULT_MODELS.forEach(
|
|
|
+ (m: any) => (m.available = !m.name.startsWith("gpt-4")),
|
|
|
+ );
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|