浏览代码

feat: better prompt gen template

Timothy J. Baek 1 年之前
父节点
当前提交
737928e861
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      src/lib/apis/ollama/index.ts

+ 4 - 5
src/lib/apis/ollama/index.ts

@@ -171,7 +171,7 @@ export const generatePrompt = async (token: string = '', model: string, conversa
 	let error = null;
 
 	if (conversation === '') {
-		conversation = '[You need to start the conversation]';
+		conversation = '[no existing conversation]';
 	}
 
 	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({
 			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.
-
-			Conversation:
+			prompt: `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:
 			`
 		})