✨ feat: 添加系统提示词对模型的不同叫法
This commit is contained in:
parent
d12cf44d06
commit
0d66756f61
|
@ -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 {{model}}, a large language model trained by {{ServiceProvider}}.
|
You are {{modelname}}, 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}}
|
||||||
|
@ -138,6 +138,13 @@ export const KnowledgeCutOffDate: Record<string, string> = {
|
||||||
"Meta-Llama-3-8B-Instruct": "2023-12",
|
"Meta-Llama-3-8B-Instruct": "2023-12",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ModelNameToName: Record<string, string> = {
|
||||||
|
default: "ChatGPT",
|
||||||
|
"gemini-pro": "Gemini",
|
||||||
|
"gemini-pro-vision": "Gemini",
|
||||||
|
"Meta-Llama-3-8B-Instruct": "Llama",
|
||||||
|
};
|
||||||
|
|
||||||
const openaiModels = [
|
const openaiModels = [
|
||||||
"gpt-3.5-turbo",
|
"gpt-3.5-turbo",
|
||||||
"gpt-3.5-turbo-0301",
|
"gpt-3.5-turbo-0301",
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
StoreKey,
|
StoreKey,
|
||||||
SUMMARIZE_MODEL,
|
SUMMARIZE_MODEL,
|
||||||
GEMINI_SUMMARIZE_MODEL,
|
GEMINI_SUMMARIZE_MODEL,
|
||||||
|
ModelNameToName,
|
||||||
} from "../constant";
|
} from "../constant";
|
||||||
import { ClientApi, RequestMessage, MultimodalContent } from "../client/api";
|
import { ClientApi, RequestMessage, MultimodalContent } from "../client/api";
|
||||||
import { ChatControllerPool } from "../client/controller";
|
import { ChatControllerPool } from "../client/controller";
|
||||||
|
@ -105,6 +106,8 @@ function countMessages(msgs: ChatMessage[]) {
|
||||||
function fillTemplateWith(input: string, modelConfig: ModelConfig) {
|
function fillTemplateWith(input: string, modelConfig: ModelConfig) {
|
||||||
const cutoff =
|
const cutoff =
|
||||||
KnowledgeCutOffDate[modelConfig.model] ?? KnowledgeCutOffDate.default;
|
KnowledgeCutOffDate[modelConfig.model] ?? KnowledgeCutOffDate.default;
|
||||||
|
const modelname =
|
||||||
|
ModelNameToName[modelConfig.model] ?? ModelNameToName.default;
|
||||||
// Find the model in the DEFAULT_MODELS array that matches the modelConfig.model
|
// Find the model in the DEFAULT_MODELS array that matches the modelConfig.model
|
||||||
const modelInfo = DEFAULT_MODELS.find((m) => m.name === modelConfig.model);
|
const modelInfo = DEFAULT_MODELS.find((m) => m.name === modelConfig.model);
|
||||||
|
|
||||||
|
@ -118,6 +121,7 @@ function fillTemplateWith(input: string, modelConfig: ModelConfig) {
|
||||||
|
|
||||||
const vars = {
|
const vars = {
|
||||||
ServiceProvider: serviceProvider,
|
ServiceProvider: serviceProvider,
|
||||||
|
modelname,
|
||||||
cutoff,
|
cutoff,
|
||||||
model: modelConfig.model,
|
model: modelConfig.model,
|
||||||
time: new Date().toString(),
|
time: new Date().toString(),
|
||||||
|
|
Loading…
Reference in New Issue