From c0d1b18abb54ba41a92f92784e88d361a77dcefa Mon Sep 17 00:00:00 2001 From: Randy Date: Thu, 6 Apr 2023 02:42:48 +0000 Subject: [PATCH 1/2] change env variable name to NEXT_PUBLIC_SYSTEM_PROMPT --- app/store/app.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/store/app.ts b/app/store/app.ts index 60d0f932cbf..cc912b2f60c 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -383,9 +383,8 @@ export const useChatStore = create()( } //Add system prompt - const SYSTEM_PROMPT = process.env.SYSTEM_PROMPT?.toString() ?? ""; const systemMessage: Message = { - content: SYSTEM_PROMPT, + content: `${process.env.NEXT_PUBLIC_SYSTEM_PROMPT}`, role: "system", date: "", }; From a363275aae46ceab6c21a8ed17ff29126548c972 Mon Sep 17 00:00:00 2001 From: Randy Date: Thu, 6 Apr 2023 03:06:46 +0000 Subject: [PATCH 2/2] fix: Not appending system message if env var is not set --- app/store/app.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/store/app.ts b/app/store/app.ts index cc912b2f60c..05be1a139e8 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -383,13 +383,15 @@ export const useChatStore = create()( } //Add system prompt - const systemMessage: Message = { - content: `${process.env.NEXT_PUBLIC_SYSTEM_PROMPT}`, - role: "system", - date: "", - }; + if (process.env.NEXT_PUBLIC_SYSTEM_PROMPT != undefined) { + const systemMessage: Message = { + content: `${process.env.NEXT_PUBLIC_SYSTEM_PROMPT}`, + role: "system", + date: "", + }; - recentMessages.unshift(systemMessage); + recentMessages.unshift(systemMessage); + } return recentMessages; },