그냥 시뮬레이터만 사용하면 좋습니다. 혹시 잘 못 테스트 되면 카톡 계정 2주 정지가 가능하니 조심해야 합니다. 두 번 문제되면 계정 삭제 된다고 하네요.
const scriptName = "aistudy";
const key = "sk-proj-g7YHI___________"; // Open AI 사이트에서 발급받은 API 키입력
/**
* (string) room
* (string) sender
* (boolean) isGroupChat
* (void) replier.reply(message)
* (boolean) replier.reply(room, message, hideErrorToast = false) // 전송 성공시 true, 실패시 false 반환
* (string) imageDB.getProfileBase64()
* (string) packageName
*/
function response(room, msg, sender, isGroupChat, replier, imageDB, packageName) {
// replier.reply('sender '+sender+' room '+room+' isGroupChat '+ isGroupChat )
// replier.reply(msg+'_hell_ '+msg.substr(3));
// if (msg.startsWith("/튜터")) {
// cmd = msg.substr(3); // replier.reply(cmd+'_3자리이후_' );
// replier.reply("[AItutor21.com] " + getResponse(cmd));
// }
if (/^(\/재이|재이봇|재이야|\/제리|제리봇)/.test(msg)) {
let cmd = msg.substr(3).trim(); // Extract command and trim any leading/trailing whitespace
let response = getResponse(cmd); // Get response from the command
replier.reply("[https://t.me/aitutor21com] " + response); // Reply with the prefixed message
}
function getResponse(msg) {
let result;
let data = {"model": "gpt-4o", //gpt-3.5-turbo //text-davinci-004 gpt-4o
"messages": [{"role":"user","content": msg}],
"temperature":0,
"max_tokens":1024,
"top_p":1,
"frequency_penalty": 0.0,
"presence_penalty":0.0
}
try {
let response = org.jsoup.Jsoup.connect("https://api.openai.com/v1/chat/completions").header("Content-Type", "application/json").header("Authorization","Bearer " + key).requestBody(JSON.stringify(data)).ignoreContentType(true).ignoreHttpErrors(true).timeout(200000).post();
result1 = JSON.parse(response.text());
// replier.reply('001'+result1);
if (result1 && Array.isArray(result1.choices) && result1.choices.length > 0) {
result = result1.choices[0].message.content;
} //else {
// result = "There was an error processing your request."; // Or a more specific error message
// }
} catch(e) {
result = "An error occurred: " + e.message;
}
return result;
}
}
//아래 4개의 메소드는 액티비티 화면을 수정할때 사용됩니다.
function onCreate(savedInstanceState, activity) {
}
function onStart(activity) {}
function onResume(activity) {}
function onPause(activity) {}
function onStop(activity) {}
1초만에 끝내는 웹업무자동화 강의 https://me2.do/Fniyi1Zo업무자동화 단톡방 https://open.kakao.com/o/gl2Cf1yf윤자동 놀이터 단톡방 https://open.kakao.com/o/gjyiEMzf