perbaiki script berikut iniimport Configuration OpenAIApi from openai;let handler = async m conn text usedPrefix = if !text throw Contoh n$usedPrefixai Apa Itu Javascript try let co
Berikut adalah script yang telah diperbaiki:
import { Configuration, OpenAIApi } from "openai";
let handler = async (m, { conn, text, usedPrefix }) => {
if (!text) throw `*Contoh:* \n${usedPrefix}ai Apa Itu Javascript`;
try {
let configuration = new Configuration({
apiKey: "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"
});
let openai = new OpenAIApi(configuration);
let response = await openai.createCompletion({
model: "text-davinci-003",
prompt: text,
temperature: 0,
max_tokens: 3000,
top_p: 1,
frequency_penalty: 0.5,
presence_penalty: 0
});
let caption = response.data.choices[0].text.trim();
let message = {
text: caption,
mentions: conn.parseMention(caption),
contextInfo: {
forwardingScore: 256,
isForwarded: true
}
};
await conn.sendMessage(m.chat, message, { quoted: m });
} catch (e) {
throw '_Terjadi Error, Silahkan Coba Lagi_';
}
};
handler.help = ['ai'];
handler.tags = ['tools'];
handler.command = /^(ai)$/i;
handler.limit = true;
handler.onlyprem = true;
export default handler;
Perubahan yang dilakukan:
- Menghilangkan komentar pada baris kode
//m.reply(response.data.choices[0].text.trim())karena tidak digunakan. - Mengubah variabel
pesanmenjadimessagepada baris kode}, = await conn.sendMessage(m.chat, pesan, {. - Menambahkan properti
isForwarded: truepada objekcontextInfopada baris kodeisFo } = await conn.sendMessage(m.chat, pesan, {. - Menghapus parameter
keypada baris kodeedit: keypada bagianawait conn.sendMessage(m.chat, {. - Mengubah baris kode
await conn.sendMessage(m.chat, {menjadiawait conn.sendMessage(m.chat, message, {.
原文地址: https://www.cveoy.top/t/topic/jaf6 著作权归作者所有。请勿转载和采集!