Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bestony authored Feb 11, 2023
2 parents 10b8776 + 85191c4 commit 61a51ed
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions event.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,23 @@ async function reply(messageId, content) {
})
}

// 根据中英文设置不同的 prompt
function getPrompt(content) {
if(content.length == 0) {
return ''
}
if((content[0] >= 'a' && content[0] <= 'z') || (content[0] >= 'A' && content[0] <= 'Z')) {
return "You are ChatGPT, a LLM model trained by OpenAI. \nplease answer my following question\nQ: " + content + "\nA: ";
}

return "你是 ChatGPT, 一个由 OpenAI 训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。\n请回答我下面的问题\nQ: " + content + "\nA: ";
}


// 通过 OpenAI API 获取回复
async function getOpenAIReply(content) {
var prompt = "你是 ChatGPT, 一个由 OpenAI 训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。\n请回答我下面的问题\nQ: " + content + "\nA: ";

var prompt = getPrompt(content.trim());
var data = JSON.stringify({
"model": process.env.MODEL || "text-davinci-003",
"prompt": prompt,
Expand Down

0 comments on commit 61a51ed

Please sign in to comment.