fix: MYFILES_BROWSER_TOOLS_SYSTEM_PROMPT

This commit is contained in:
Hk-Gosuto 2025-02-26 17:27:00 +08:00
parent cdbbcb6ac3
commit a80ac42c92

View File

@ -36,6 +36,7 @@ import { createEmptyMask, Mask } from "./mask";
import { FileInfo, WebApi } from "../client/platforms/utils";
import { usePluginStore } from "./plugin";
import { TavilySearchResponse } from "@tavily/core";
import { MYFILES_BROWSER_TOOLS_SYSTEM_PROMPT } from "../prompt";
export interface ChatToolMessage {
toolName: string;
@ -648,13 +649,23 @@ export const useChatStore = createPersistStore(
session.mask.modelConfig.model.startsWith("chatgpt-"));
var systemPrompts: ChatMessage[] = [];
var template = DEFAULT_SYSTEM_TEMPLATE;
if (session.attachFiles && session.attachFiles.length > 0) {
template += MYFILES_BROWSER_TOOLS_SYSTEM_PROMPT;
session.attachFiles.forEach((file) => {
template += `filename: \`${file.originalFilename}\`
partialDocument: \`\`\`
${file.partial}
\`\`\``;
});
}
systemPrompts = shouldInjectSystemPrompts
? [
createMessage({
role: "system",
content: fillTemplateWith("", {
...modelConfig,
template: DEFAULT_SYSTEM_TEMPLATE,
template: template,
}),
}),
]