Skip to content

An AI-powered search engine with a generative UI

fix: add env flag to disable chat history saving

Yoshiki Miura78cc3a804fdd
diff --git a/lib/streaming/handle-stream-finish.ts b/lib/streaming/handle-stream-finish.ts
index d756816c..1398c61e 100644
--- a/lib/streaming/handle-stream-finish.ts
+++ b/lib/streaming/handle-stream-finish.ts
@@ -64,6 +64,10 @@ export async function handleStreamFinish({
...responseMessages.slice(-1)
] as ExtendedCoreMessage[]
+ if (process.env.NEXT_PUBLIC_ENABLE_SAVE_CHAT_HISTORY !== 'true') {
+ return
+ }
+
// Get the chat from the database if it exists, otherwise create a new one
const savedChat = (await getChat(chatId)) ?? {
messages: [],