Merge pull request #1364 from Yidadaa/client-side

feat: add model and time info to prompts
This commit is contained in:
Yifei Zhang 2023-05-10 00:52:44 +08:00 committed by GitHub
commit 1d489cfcea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -252,9 +252,20 @@ export const useChatStore = create<ChatStore>()(
model: modelConfig.model,
});
const systemInfo = createMessage({
role: "system",
content: `IMPRTANT: You are a virtual assistant powered by the ${
modelConfig.model
} model, now time is ${new Date().toLocaleString()}}`,
id: botMessage.id! + 1,
});
// get recent messages
const systemMessages = [systemInfo];
const recentMessages = get().getMessagesWithMemory();
const sendMessages = recentMessages.concat(userMessage);
const sendMessages = systemMessages.concat(
recentMessages.concat(userMessage),
);
const sessionIndex = get().currentSessionIndex;
const messageIndex = get().currentSession().messages.length + 1;