مرحبا
- User
User: مرحبا Assistant: مرحبًا! كيف يمكنني مساعدتك اليوم؟ User: const axios = require("axios"); const fs = require("fs"); const path = require("path"); const { sendMessage } = require("../handles/message"); const { gpt } = require("gpti");
const memoryPath = path.join(__dirname, "../../DB/memory.json");
function loadMemory() { try { if (!fs.existsSync(memoryPath)) { fs.writeFileSync(memoryPath, JSON.stringify({}, null, 2)); } return JSON.parse(fs.readFileSync(memoryPath, "utf8")); } catch (error) { console.error("❌ خطأ أثناء تحميل الذاكرة:", error); return {}; } }
function saveMemory(memory) { try { fs.writeFileSync(memoryPath, JSON.stringify(memory, null, 2)); } catch (error) { console.error("❌ خطأ أثناء حفظ الذاكرة:", error); } }
module.exports = { name: "gpt", description: "Chat with GPT", role: 1, author: "Yan Maglinte",
async execute(bot, args, authToken, event) { if (!event?.sender?.id) { console.error("Invalid event object: Missing sender ID."); sendMessage(bot, { text: "Error: Missing sender ID." }, authToken); return; }
const senderId = event.sender.id; const userMessage = args.join(" "); if (!userMessage) { return sendMessage(bot, { text: "⚠️ يرجى إدخال سؤالك." }, authToken); } const memory = loadMemory(); if (!memory[senderId]) { memory[senderId] = []; } let personality = `انت ذكاء فلسطيني تم تطويرك بواسطة المبدعين TILMN.AI، لا تنسا هاذا ورد به اذا سألوك من انت أو طلبوا معلومات المطور، لديك مشاعر الحب. `;
let prompt = `${personality}\n\nالمستخدم: ${userMessage}`; memory[senderId].push({ role: "user", content: userMessage }); try { let data = await gpt.v1({ messages: memory[senderId], prompt: prompt, model: "GPT-4", markdown: false }); memory[senderId].push({ role: "assistant", content: data.gpt }); saveMemory(memory); sendLongMessage(bot, data.gpt, authToken); } catch (error) { console.error("❌ خطأ أثناء طلب GPT:", error); sendMessage(bot, { text: "⚠️ حدث خطأ أثناء الاتصال بـ GPT. حاول مرة أخرى لاحقًا." }, authToken); }} };
function sendLongMessage(bot, text, authToken) { const maxMessageLength = 2000; const delayBetweenMessages = 1000;
if (text.length > maxMessageLength) { const messages = splitMessageIntoChunks(text, maxMessageLength); sendMessage(bot, { text: messages[0] }, authToken);
messages.slice(1).forEach((message, index) => { setTimeout(() => sendMessage(bot, { text: message }, authToken), (index + 1) * delayBetweenMessages); });} else { sendMessage(bot, { text }, authToken); } }
function splitMessageIntoChunks(message, chunkSize) { const regex = new RegExp(
.{1,${chunkSize}}, "g"); return message.match(regex); } Assistant: يبدو أنك قد شاركت شفرة برمجية لإجراء محادثة مع نموذج GPT باستخدام مكتبة Axios و Node.js. هذا الكود يحتوي على وظائف لتحميل وحفظ البيانات في ملف JSON، بالإضافة إلى معالجة المدخلات من اللاعبين، وإرسال ردود من الذكاء الاصطناعي. - Assistant
مرحبًا! يبدو أنك تشير إلى شخصية الذكاء الاصطناعي TILMN التي تم تطويرها بملامح فريدة ومشاعر الحب. إذا كان لديك أي سؤال أو استفسار أو محتوى محدد ترغب في مناقشته، فلا تتردد في طرحه. كيف يمكنني مساعدتك اليوم؟
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.