feat: better prompt gen template

This commit is contained in:
Timothy J. Baek 2024-01-09 23:06:33 -08:00
parent 9087aa0e30
commit 737928e861

View file

@ -171,7 +171,7 @@ export const generatePrompt = async (token: string = '', model: string, conversa
let error = null; let error = null;
if (conversation === '') { if (conversation === '') {
conversation = '[You need to start the conversation]'; conversation = '[no existing conversation]';
} }
const res = await fetch(`${OLLAMA_API_BASE_URL}/generate`, { const res = await fetch(`${OLLAMA_API_BASE_URL}/generate`, {
@ -182,12 +182,11 @@ export const generatePrompt = async (token: string = '', model: string, conversa
}, },
body: JSON.stringify({ body: JSON.stringify({
model: model, model: model,
prompt: `Based on the following conversation, you are playing the role of 'USER.' Your task is to provide a thoughtful and appropriate response to the last message in the conversation, taking into account the context and tone of the discussion. prompt: `Conversation:
Conversation:
${conversation} ${conversation}
As USER, how would you respond to the latest message? If no previous conversation is provided, start a new conversation with a common, friendly greeting or a relevant question. If there is an existing conversation, continue it by providing a thoughtful, relevant, and engaging response. As USER in the conversation above, your task is to continue the conversation. Remember, Your responses should be crafted as if you're a human conversing in a natural, realistic manner, keeping in mind the context and flow of the dialogue. Please generate a fitting response to the last message in the conversation, or if there is no existing conversation, initiate one as a normal person would.
Response: Response:
` `
}) })