feat: 支持其他模型的提示词

This commit is contained in:
A-Cepheus 2024-04-24 10:26:30 +08:00
parent f0c3018ec7
commit d12cf44d06
No known key found for this signature in database
GPG Key ID: 02057AE4D52020B4
2 changed files with 18 additions and 4 deletions

View File

@ -112,7 +112,7 @@ export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lan
// Latex block: $$e=mc^2$$ // Latex block: $$e=mc^2$$
// `; // `;
export const DEFAULT_SYSTEM_TEMPLATE = ` export const DEFAULT_SYSTEM_TEMPLATE = `
You are ChatGPT, a large language model trained by {{ServiceProvider}}. You are {{model}}, a large language model trained by {{ServiceProvider}}.
Knowledge cutoff: {{cutoff}} Knowledge cutoff: {{cutoff}}
Current model: {{model}} Current model: {{model}}
Current time: {{time}} Current time: {{time}}
@ -135,6 +135,7 @@ export const KnowledgeCutOffDate: Record<string, string> = {
// it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously. // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously.
"gemini-pro": "2023-12", "gemini-pro": "2023-12",
"gemini-pro-vision": "2023-12", "gemini-pro-vision": "2023-12",
"Meta-Llama-3-8B-Instruct": "2023-12",
}; };
const openaiModels = [ const openaiModels = [
@ -174,6 +175,10 @@ const anthropicModels = [
"claude-3-haiku-20240307", "claude-3-haiku-20240307",
]; ];
const metaModels = [
"Meta-Llama-3-8B-Instruct",
];
export const DEFAULT_MODELS = [ export const DEFAULT_MODELS = [
...openaiModels.map((name) => ({ ...openaiModels.map((name) => ({
name, name,
@ -202,6 +207,15 @@ export const DEFAULT_MODELS = [
providerType: "anthropic", providerType: "anthropic",
}, },
})), })),
...metaModels.map((name) => ({
name,
available: true,
provider: {
id: "meta",
providerName: "Meta",
providerType: "meta",
},
})),
] as const; ] as const;
export const CHAT_PAGE_SIZE = 15; export const CHAT_PAGE_SIZE = 15;

View File

@ -437,9 +437,9 @@ export const useChatStore = createPersistStore(
const contextPrompts = session.mask.context.slice(); const contextPrompts = session.mask.context.slice();
// system prompts, to get close to OpenAI Web ChatGPT // system prompts, to get close to OpenAI Web ChatGPT
const shouldInjectSystemPrompts = const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts;
modelConfig.enableInjectSystemPrompts && // modelConfig.enableInjectSystemPrompts &&
session.mask.modelConfig.model.startsWith("gpt-"); // session.mask.modelConfig.model.startsWith("gpt-");
var systemPrompts: ChatMessage[] = []; var systemPrompts: ChatMessage[] = [];
systemPrompts = shouldInjectSystemPrompts systemPrompts = shouldInjectSystemPrompts