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>
This commit is contained in:
akira0245 2023-03-25 00:16:22 +08:00 committed by GitHub
parent 39cb420122
commit 58858d51ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,9 +47,10 @@ export const _defaultChatConfig: ConfigInterface = {
export const generateDefaultChat = (title?: string): ChatInterface => ({ export const generateDefaultChat = (title?: string): ChatInterface => ({
title: title ? title : 'New Chat', title: title ? title : 'New Chat',
messages: [ messages:
{ role: 'system', content: useStore.getState().defaultSystemMessage }, useStore.getState().defaultSystemMessage.length > 0
], ? [{ role: 'system', content: useStore.getState().defaultSystemMessage }]
: [],
config: { ...useStore.getState().defaultChatConfig }, config: { ...useStore.getState().defaultChatConfig },
titleSet: false, titleSet: false,
}); });