MCPcopy Create free account
hub / github.com/akdeb/ElatoAI / createSystemPrompt

Function createSystemPrompt

server/deno/supabase.ts:171–199  ·  view source on GitHub ↗
(
    chatHistory: IConversation[],
    payload: IPayload,
)

Source from the content-addressed store, hash-verified

169};
170
171export const createSystemPrompt = (
172 chatHistory: IConversation[],
173 payload: IPayload,
174): string => {
175 const { user, timestamp } = payload;
176 const chatHistoryString = composeChatHistory(chatHistory);
177 console.log("chatHistoryString", chatHistoryString);
178 const commonPrompt = getCommonPromptTemplate(
179 chatHistoryString,
180 user,
181 timestamp,
182 );
183
184 const isStory = user.personality?.is_story;
185 if (isStory) {
186 const storyPrompt = getStoryPromptTemplate(user, chatHistoryString);
187 return storyPrompt;
188 }
189
190 let systemPrompt: string;
191 switch (user.user_info.user_type) {
192 case "user":
193 systemPrompt = UserPromptTemplate(user);
194 break;
195 default:
196 throw new Error("Invalid user type");
197 }
198 return commonPrompt + systemPrompt;
199};
200
201export const addConversation = async (
202 supabase: SupabaseClient,

Callers 1

main.tsFile · 0.90

Calls 5

composeChatHistoryFunction · 0.85
logMethod · 0.80
getCommonPromptTemplateFunction · 0.70
getStoryPromptTemplateFunction · 0.70
UserPromptTemplateFunction · 0.70

Tested by

no test coverage detected