diff --git a/app/config/server.ts b/app/config/server.ts
index 6eab9ebec..2df806fed 100644
--- a/app/config/server.ts
+++ b/app/config/server.ts
@@ -12,7 +12,8 @@ declare global {
DISABLE_GPT4?: string; // allow user to use gpt-4 or not
BUILD_MODE?: "standalone" | "export";
BUILD_APP?: string; // is building desktop app
- HIDE_BALANCE_QUERY?: string; // allow user to query balance or not
+ ENABLE_BALANCE_QUERY?: string; // allow user to query balance or not
+ DISABLE_FAST_LINK?: string; // disallow parse settings from url or not
}
}
}
@@ -47,6 +48,7 @@ export const getServerSideConfig = () => {
isVercel: !!process.env.VERCEL,
hideUserApiKey: !!process.env.HIDE_USER_API_KEY,
disableGPT4: !!process.env.DISABLE_GPT4,
- hideBalanceQuery: !!process.env.HIDE_BALANCE_QUERY,
+ hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY,
+ disableFastLink: !!process.env.DISABLE_FAST_LINK,
};
};
diff --git a/app/constant.ts b/app/constant.ts
index 7305f5e81..ba3561988 100644
--- a/app/constant.ts
+++ b/app/constant.ts
@@ -10,6 +10,7 @@ export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
export const DEFAULT_CORS_HOST = "https://ab.nextweb.fun";
export const DEFAULT_API_HOST = `${DEFAULT_CORS_HOST}/api/proxy`;
+export const OPENAI_BASE_URL = "https://api.openai.com";
export enum Path {
Home = "/",
@@ -68,12 +69,21 @@ export const OpenaiPath = {
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
export const DEFAULT_SYSTEM_TEMPLATE = `
-You are GPT, a large language model (LLM) trained by OpenAI.
+You are ChatGPT, a large language model trained by OpenAI.
+Knowledge cutoff: {{cutoff}}
Current model: {{model}}
-Current time: {{time}}`;
+Current time: {{time}}
+`;
export const SUMMARIZE_MODEL = "gpt-3.5-turbo-16k";
+export const KnowledgeCutOffDate: Record = {
+ default: "2021-09",
+ "gpt-3.5-turbo-1106": "2023-04",
+ "gpt-4-1106-preview": "2023-04",
+ "gpt-4-vision-preview": "2023-04",
+};
+
export const DEFAULT_MODELS = [
{
name: "gpt-4-1106-preview",
@@ -111,6 +121,14 @@ export const DEFAULT_MODELS = [
name: "gpt-4-32k-0613",
available: true,
},
+ {
+ name: "gpt-4-1106-preview",
+ available: true,
+ },
+ {
+ name: "gpt-4-vision-preview",
+ available: true,
+ },
{
name: "gpt-3.5-turbo",
available: true,
@@ -127,6 +145,10 @@ export const DEFAULT_MODELS = [
name: "gpt-3.5-turbo-0613",
available: true,
},
+ {
+ name: "gpt-3.5-turbo-1106",
+ available: true,
+ },
{
name: "gpt-3.5-turbo-16k",
available: true,
diff --git a/app/store/access.ts b/app/store/access.ts
index 9eaa81e5e..3d889f6e7 100644
--- a/app/store/access.ts
+++ b/app/store/access.ts
@@ -16,6 +16,7 @@ const DEFAULT_ACCESS_STATE = {
hideUserApiKey: false,
hideBalanceQuery: false,
disableGPT4: false,
+ disableFastLink: false,
openaiUrl: DEFAULT_OPENAI_URL,
};
@@ -29,15 +30,6 @@ export const useAccessStore = createPersistStore(
return get().needCode;
},
- updateCode(code: string) {
- set(() => ({ accessCode: code?.trim() }));
- },
- updateToken(token: string) {
- set(() => ({ token: token?.trim() }));
- },
- updateOpenAiUrl(url: string) {
- set(() => ({ openaiUrl: url?.trim() }));
- },
isAuthorized() {
this.fetch();
diff --git a/app/store/chat.ts b/app/store/chat.ts
index 56ac8db6c..95822c191 100644
--- a/app/store/chat.ts
+++ b/app/store/chat.ts
@@ -7,6 +7,7 @@ import { createEmptyMask, Mask } from "./mask";
import {
DEFAULT_INPUT_TEMPLATE,
DEFAULT_SYSTEM_TEMPLATE,
+ KnowledgeCutOffDate,
StoreKey,
SUMMARIZE_MODEL,
} from "../constant";
@@ -116,7 +117,11 @@ function countMessages(msgs: ChatMessage[]) {
}
function fillTemplateWith(input: string, modelConfig: ModelConfig) {
+ let cutoff =
+ KnowledgeCutOffDate[modelConfig.model] ?? KnowledgeCutOffDate.default;
+
const vars = {
+ cutoff,
model: modelConfig.model,
time: new Date().toLocaleString(),
lang: getLang(),