mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-06-06 21:00:21 +09:00
fix: MYFILES_BROWSER_TOOLS_SYSTEM_PROMPT
This commit is contained in:
parent
cdbbcb6ac3
commit
a80ac42c92
@ -36,6 +36,7 @@ import { createEmptyMask, Mask } from "./mask";
|
|||||||
import { FileInfo, WebApi } from "../client/platforms/utils";
|
import { FileInfo, WebApi } from "../client/platforms/utils";
|
||||||
import { usePluginStore } from "./plugin";
|
import { usePluginStore } from "./plugin";
|
||||||
import { TavilySearchResponse } from "@tavily/core";
|
import { TavilySearchResponse } from "@tavily/core";
|
||||||
|
import { MYFILES_BROWSER_TOOLS_SYSTEM_PROMPT } from "../prompt";
|
||||||
|
|
||||||
export interface ChatToolMessage {
|
export interface ChatToolMessage {
|
||||||
toolName: string;
|
toolName: string;
|
||||||
@ -648,13 +649,23 @@ export const useChatStore = createPersistStore(
|
|||||||
session.mask.modelConfig.model.startsWith("chatgpt-"));
|
session.mask.modelConfig.model.startsWith("chatgpt-"));
|
||||||
|
|
||||||
var systemPrompts: ChatMessage[] = [];
|
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
|
systemPrompts = shouldInjectSystemPrompts
|
||||||
? [
|
? [
|
||||||
createMessage({
|
createMessage({
|
||||||
role: "system",
|
role: "system",
|
||||||
content: fillTemplateWith("", {
|
content: fillTemplateWith("", {
|
||||||
...modelConfig,
|
...modelConfig,
|
||||||
template: DEFAULT_SYSTEM_TEMPLATE,
|
template: template,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user