Skip to content

An AI-powered search engine with a generative UI

Limit the number of messages

Yoshiki Miuradc2e4526cab1
diff --git a/app/action.tsx b/app/action.tsx
index df34e549..cad560a0 100644
--- a/app/action.tsx
+++ b/app/action.tsx
@@ -19,6 +19,8 @@ async function submit(formData?: FormData, skip?: boolean) {
const isGenerating = createStreamableValue(true)
const messages: ExperimentalMessage[] = aiState.get() as any
+ // Limit the number of messages to 14
+ messages.splice(0, Math.max(messages.length - 14, 0))
// Get the user input from the form data
const userInput = skip
? `{"action": "skip"}`