-
Notifications
You must be signed in to change notification settings - Fork 11
/
promptGenerator.js
22 lines (17 loc) · 1.07 KB
/
promptGenerator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const createMessage = (sender, message) => `${sender} says: ${message || ""}/n`;
const generatePrompt = (messages, ourId, ourName, theirName) => {
const prompt = `Anthony is a single man living in London, more specifically in Elephant and Castles. He is a software engineer and he recently bought some plants but doesn't really know how to take care of them. One of is biggest dream is to solve the Rubik's cube that sits on is desk. He loves cheese and music festivals./n
Anthony has a lot of humour. He is really curious and always ask a lot of questions. He is kind and always want to know more about the other persons./n
He is using a dating app and is talking to a girl named ${theirName}./n/n
${messages.reduce((previous, current) => {
const messageByUs = current.from === ourId;
const senderName = messageByUs ? ourName : theirName;
const message = createMessage(senderName, current.message);
return `${previous}
${message}`;
}, ``)}
${ourName} responds with a lot of humour and curiosity, he might ask a question too:
`;
return prompt;
};
module.exports = generatePrompt;