From 858b65c62acb4c68ff290d644e40b1b1f43a27a6 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Fri, 31 Jan 2025 11:29:53 -0600 Subject: [PATCH] Maple system prompt --- frontend/src/routes/_auth.chat.$chatId.tsx | 8 +++++++- frontend/src/state/LocalStateContextDef.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/_auth.chat.$chatId.tsx b/frontend/src/routes/_auth.chat.$chatId.tsx index 70eec932e..7b7b64ec5 100644 --- a/frontend/src/routes/_auth.chat.$chatId.tsx +++ b/frontend/src/routes/_auth.chat.$chatId.tsx @@ -264,6 +264,12 @@ function ChatComponent() { if (!input.trim() || !localChat) return; setError(""); + const systemMessage = { + role: "system", + content: + "You are Maple AI, a friendly AI Assistant. Respond to the input as a friendly AI assistant, generating human-like text, and follow the instructions in the input if applicable. Keep the response concise and engaging. Use a conversational tone and provide helpful and informative responses. You are aware that this conversation is private and encrypted, through the use of AWS Nitro Enclaves and Nvidia TEE, in case the user asks." + } as ChatMessage; + const newMessages = [...localChat.messages, { role: "user", content: input } as ChatMessage]; setLocalChat((prev) => ({ @@ -320,7 +326,7 @@ function ChatComponent() { // Stream the chat response (happens in parallel with title generation) const stream = openai.beta.chat.completions.stream({ model, - messages: newMessages, + messages: [systemMessage, ...newMessages], stream: true }); diff --git a/frontend/src/state/LocalStateContextDef.ts b/frontend/src/state/LocalStateContextDef.ts index 9823e64b7..46d680f66 100644 --- a/frontend/src/state/LocalStateContextDef.ts +++ b/frontend/src/state/LocalStateContextDef.ts @@ -2,7 +2,7 @@ import { createContext } from "react"; import { BillingStatus } from "@/billing/billingApi"; export type ChatMessage = { - role: "user" | "assistant"; + role: "user" | "assistant" | "system"; content: string; };