File size: 621 Bytes
9692fe7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { getSettings } from "./pubSub";

/**
 * Generates a system prompt by replacing placeholders with actual values
 * @param searchResults - The search results to inject into the prompt
 * @returns The formatted system prompt with current date and search results
 */
export function getSystemPrompt(searchResults: string) {
  const currentDate = new Intl.DateTimeFormat("en-CA", {
    year: "numeric",
    month: "2-digit",
    day: "2-digit",
  }).format(new Date());

  return getSettings()
    .systemPrompt.replace("{{searchResults}}", searchResults)
    .replace(/{{dateTime}}|{{currentDate}}/g, currentDate);
}