From 58858d51ac642d4010b0901a55a7a08272667621 Mon Sep 17 00:00:00 2001 From: akira0245 <33274390+akira0245@users.noreply.github.com> Date: Sat, 25 Mar 2023 00:16:22 +0800 Subject: [PATCH] feat: not adding first system message if default system message is empty (#129) * feat: not adding first system message if default system message is empty * formatting --------- Co-authored-by: Jing Hua <59118459+ztjhz@users.noreply.github.com> --- src/constants/chat.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/constants/chat.ts b/src/constants/chat.ts index 9d9b1c4..68b0958 100644 --- a/src/constants/chat.ts +++ b/src/constants/chat.ts @@ -47,9 +47,10 @@ export const _defaultChatConfig: ConfigInterface = { export const generateDefaultChat = (title?: string): ChatInterface => ({ title: title ? title : 'New Chat', - messages: [ - { role: 'system', content: useStore.getState().defaultSystemMessage }, - ], + messages: + useStore.getState().defaultSystemMessage.length > 0 + ? [{ role: 'system', content: useStore.getState().defaultSystemMessage }] + : [], config: { ...useStore.getState().defaultChatConfig }, titleSet: false, });