|
@@ -401,22 +401,26 @@ export const useChatStore = createPersistStore(
|
|
|
|
|
|
// system prompts, to get close to OpenAI Web ChatGPT
|
|
|
const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts;
|
|
|
- const systemPrompts = shouldInjectSystemPrompts
|
|
|
- ? [
|
|
|
- createMessage({
|
|
|
- role: "system",
|
|
|
- content: fillTemplateWith("", {
|
|
|
- ...modelConfig,
|
|
|
- template: DEFAULT_SYSTEM_TEMPLATE,
|
|
|
- }),
|
|
|
- }),
|
|
|
- ]
|
|
|
- : [];
|
|
|
+ let systemPrompts = shouldInjectSystemPrompts ? [] : [];
|
|
|
+
|
|
|
if (shouldInjectSystemPrompts) {
|
|
|
- console.log(
|
|
|
- "[Global System Prompt] ",
|
|
|
- systemPrompts.at(0)?.content ?? "empty",
|
|
|
- );
|
|
|
+ const model = modelConfig.model;
|
|
|
+ let systemTemplate = DEFAULT_SYSTEM_TEMPLATE;
|
|
|
+
|
|
|
+ if (model === "gpt-4-1106-preview" || model === "gpt-4-vision-preview") {
|
|
|
+ systemTemplate = systemTemplate.replace("{{knowledgeCutoff}}", "2023-04");
|
|
|
+ } else {
|
|
|
+ systemTemplate = systemTemplate.replace("{{knowledgeCutoff}}", "2021-09");
|
|
|
+ }
|
|
|
+
|
|
|
+ const systemPrompt = createMessage({
|
|
|
+ role: "system",
|
|
|
+ content: fillTemplateWith("", {
|
|
|
+ ...modelConfig,
|
|
|
+ template: systemTemplate,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ console.log("[Global System Prompt] ", systemPrompt.content);
|
|
|
}
|
|
|
|
|
|
// long term memory
|