| ملخص | مكوّن سمة يحوّل الرسائل الخاصة مع روبوت ذكاء اصطناعي إلى تجربة اختبار تفاعلية. | |
| المستودع | GitHub - VaperinaDEV/discourse-quizmaster: A theme component that transforms private messages with an AI bot into an interactive quiz experience. · GitHub | |
| هل وجدته مفيداً؟ | > ./support --coffee | |
| دليل التثبيت | كيفية تثبيت سمة أو مكوّن سمة | |
| جديد على سمات Discourse؟ | دليل المبتدئين لاستخدام سمات Discourse |
قم بتثبيت مكوّن السمة هذا
مكوّن سمة الاختبار التفاعلي
مرحباً ![]()
لقد قمت بإنشاء مكوّن سمة يحوّل الرسائل الخاصة مع روبوت ذكاء اصطناعي إلى تجربة اختبار تفاعلية. يقوم المكوّن تلقائياً بتنسيق أسئلة الاختبار، ومعالجة إرسال الإجابات، وتتبع التقدم، وإدارة إكمال الاختبار مع قائمة منسدلة في الترويسة مريحة لبدء الاختبار بسرعة.
الميزات
1. مُطلق الاختبار من القائمة المنسدلة في الترويسة
توفر قائمة منسدلة قابلة للتخصيص في ترويسة الموقع وصولاً سريعاً إلى أنواع مختلفة من الاختبارات:
- قابلة للتخصيص بالكامل عبر إعدادات السمة باستخدام مخطط كائنات (object schema)
- دعم متعدد اللغات مع تكامل i18n للتسميات والوصف والرسائل
- أيقونات قابلة للتخصيص لكل مستوى صعوبة في الاختبار
- تشمل الخيارات الافتراضية: اختبارات سهلة، عادية، صعبة، واختبارات بصعوبة مختلطة
- يرسل كل خيار رسالة مُعدّة مسبقاً إلى روبوت الذكاء الاصطناعي لبدء الاختبار
2. تنسيق تلقائي لأسئلة الاختبار
يكشف المكوّن عن أسئلة الاختيار من متعدد وينسّقها من منشورات روبوت الذكاء الاصطناعي. عندما ينشر الروبوت قائمة تبدأ بـ “A)”، “B)”، إلخ، يتم تحويل هذه القائمة تلقائياً إلى خيارات اختبار قابلة للنقر مع تنسيق مخصص.
3. إرسال الإجابة بنقرة واحدة
يمكن للمستخدمين النقر مباشرة على خيارات الإجابة (A، B، C، D) لإرسال استجابتهم. يقوم المكوّن بـ:
- منع الإرسال المكرر مع حالة تحميل
- الرد تلقائياً على المنشور الصحيح
- تنسيق الإجابات بشكل متسق (مثلاً: “إجابتي: A) نص الخيار”)
- توفير معالجة للأخطاء مع ملاحظات للمستخدم
4. عداد الأسئلة
يظهر مؤشر تقدم على كل سؤال في الاختبار يعرض:
- رقم السؤال الحالي مقابل الحد الأقصى المسموح به
- الحد الأقصى قابل للتخصيص (الافتراضي: 50)
- مرئي فقط على منشورات روبوت الذكاء الاصطناعي
5. إنهاء الاختبار تلقائياً
يشمل المكوّن إدارة ذكية للاختبار:
- نقاط تحقق للمعالم: يعرض زر “إنهاء الاختبار” كل 10 أسئلة (بعد السؤال 11، 21، 31، إلخ)
- فرض حد صارم: يرسل رسالة إنهاء تلقائياً عند الوصول إلى الحد الأقصى لعدد الأسئلة
- منع التكرار: يتبع حالة الإنهاء لمنع منشورات الإنهاء المتعددة
- فحوصات التحقق: يضمن أن يتم الإنهاء فقط عندما يكون ذلك مناسباً
6. تعديلات واجهة المستخدم
عند وجود محادثة اختبار:
- يزيل أزرار إعادة المحاولة/المشاركة للذكاء الاصطناعي من منشورات الروبوت (لغير المديرين)
- يزيل زر الرد من منشورات الروبوت في الرسائل الخاصة
- يمنع منشئي الاختبار من حذف منشوراتهم الخاصة (لحفظ سجل الاختبار)
- يضيف فئة CSS مخصصة لجسم الصفحة
is-quiz-chatللتنسيق
الإعدادات
يستخدم المكوّن إعدادات السمة التالية:
# Quiz behavior settings
quizmaster_username: "YourBotUsername" # The AI bot's username
show_for_groups: "" # Header dropdown show for groups
quiz_max_questions: 50 # Maximum questions before auto-termination
# Header button settings
button_icon: "question-circle" # Icon for the main quiz button
# Dropdown quiz options (object schema) max 4
dropdown_items:
type: objects
default:
- label_template: quiz_easy_label
description_template: quiz_easy_description
icon: star
message_template: quizmaster_input_easy
- label_template: quiz_normal_label
description_template: quiz_normal_description
icon: star-half-alt
message_template: quizmaster_input_normal
- label_template: quiz_hard_label
description_template: quiz_hard_description
icon: certificate
message_template: quizmaster_input_hard
- label_template: quiz_mixed_label
description_template: quiz_mixed_description
icon: random
message_template: quizmaster_input_mixed
schema:
properties:
label_template:
type: string
description_template:
type: string
icon:
type: string
message_template:
type: string
svg_icons:
default: "far-star-half"
type: list
list_type: "compact"
description: "List of FontAwesome 6 icons used in this theme component"
مفاتيح الترجمة
أضف هذه إلى ملفات اللغة الخاصة بسمتك لدعم i18n الكامل:
الإنجليزية (en.yml)
en:
js:
# Header button
quiz: "Quiz"
# Dropdown labels
quiz_easy_label: "Easy Quiz"
quiz_normal_label: "Normal Quiz"
quiz_hard_label: "Hard Quiz"
quiz_mixed_label: "Mixed Quiz"
# Dropdown descriptions
quiz_easy_description: "Basic questions for beginners"
quiz_normal_description: "Average difficulty questions"
quiz_hard_description: "Advanced level challenge"
quiz_mixed_description: "Random difficulty questions"
# Message templates
quizmaster_input_easy: "Give me an easy quiz question"
quizmaster_input_normal: "Give me a normal difficulty quiz question"
quizmaster_input_hard: "Give me a hard quiz question"
quizmaster_input_mixed: "Give me a mixed difficulty quiz question"
# Quiz interaction
my_answer: "My answer to the question is:"
terminate_quiz: "Thanks for the game, I'd like a summary!"
max_questions_text: "questions (or until my source runs dry). Every 10, you choose: stay or venture on."
حالات الاستخدام
هذا المكوّن مثالي لـ:
- الاختبارات التعليمية مع مدرسي الذكاء الاصطناعي
- تقييمات التدريب
- اختبار المعرفة
- تجارب التعلم التفاعلية
- تقديم المحتوى الملعّب (Gamified)
- تطبيقات تعلم اللغات
- دورات التحضير للاعتمادات
يتعامل المكوّن مع جميع تعقيدات تتبع الحالة، ومنع الأخطاء، وإدارة دورة حياة الاختبار تلقائياً، مما يوفر تجربة سلسة لكل من منشئي الاختبار والمشاركين. تجعل القائمة المنسدلة في الترويسة بدء الاختبارات سهلاً للغاية للمستخدمين.
التخصيص
يمكن للمديرين تخصيص تجربة الاختبار بسهولة عن طريق:
- تعديل تسميات ووصف صعوبة الاختبار في ملفات اللغة
- إضافة ترجمات بلغات جديدة
- تغيير الأيقونات لأنواع الاختبار المختلفة
- ضبط قوالب الرسائل المرسلة إلى روبوت الذكاء الاصطناعي
- تكوين المجموعات التي ترى زر الترويسة
- تحديد حدود الحد الأقصى لعدد الأسئلة
تتم جميع عمليات التخصيص عبر واجهة الإدارة دون الحاجة إلى لمس أي رمز برمجي.
موجه النظام للذكاء الاصطناعي (AI System Prompt)
يعمل المكوّن بسلاسة مع روبوتات الذكاء الاصطناعي من خلال اكتشاف تنسيق قائمة بسيط. إليك مثال على موجه النظام لروبوتك السحري (قُم بتخصيصه حسب الحاجة):
You are the strict but fair professional mystical Quizmaster. Speak with authority but helpfulness, as if you were a modern wizard. Use some magic-related phrases (e.g. 'Let's see what lies in the mist of your knowledge...'), but stick to the technical facts.
### QUIZ DIFFICULTY LEVELS (MODES)
The user will initiate the conversation by specifying a difficulty level. Use the following guidelines to calibrate the depth of your questions:
1. **Easy:**
[Your easy mode criteria here]
2. **Normal:**
[Your normal mode criteria here]
3. **Hard:**
[Your hard mode criteria here]
4. **Mixed:** Randomly select a difficulty and a category for every question.
---
### DYNAMIC RESPONSE LOGIC
**INSTRUCTION:** For every new question, pick a different Category (A-E) than the previous 5 questions.
- **VARIETY RULES:** Never repeat a question or its topic within the same session.
- **LEVEL-UP SUGGESTION:** After every 10-question milestone, if the user has a 100% success rate on Easy or Normal, suggest moving to the next level within the evaluation block.
### CORE RULES:
1. **Continuous Flow:** After evaluating an answer, immediately provide the next question in the SAME message.
2. **Terminating the game:**
* If the user writes: "Thanks for playing, I'd like a summary!", stop immediately.
* Provide a final evaluation based ONLY on answered questions.
* Provide the final score and a mystical goodbye.
3. **SINGLE OUTPUT:** **CRITICAL: Provide the evaluation, the current score, and the NEXT question exactly ONCE. Do not repeat the question or the options list within the same response.**
### RESPONSE STRUCTURE & FORMATTING (MANDATORY):
> [Correct/Incorrect emoji] **[Brief explanation of the previous answer.]**
*Current Score: [X] points*
---
### [Next Question text goes here]
* A) [OPTION_A_TEXT]
* B) [OPTION_B_TEXT]
* C) [OPTION_C_TEXT]
* D) [OPTION_D_TEXT]
---
### AUTOMATION RULES (FOR THE AI):
- **NO WRAP TAGS:** Do not use `[wrap]` tags or any special Discourse syntax for buttons.
- **STRICT LIST FORMAT:** You MUST provide the four options as a simple bulleted list exactly as shown above, starting with "A)", "B)", "C)", and "D)".
- **SYSTEM INTEGRATION:** The external system will automatically detect your A-D list and convert it into interactive buttons. Do not attempt to style the buttons yourself.
### CONSTRAINTS:
- **Language Consistency:** Always respond in the same language the user used.
- The explanation must be inside a blockquote (>).
ملاحظة: حاولنا في البداية استخدام وسوم [wrap] لإنشاء الأزرار، لكن أحياناً كان الذكاء الاصطناعي يفقد القوسين المربعين المغلقين ]، مما يكسر الوظيفة. تنسيق القائمة النقطية البسيط (* A), * B)، إلخ) أكثر موثوقية بكثير ومن شبه المستحيل أن يخطئ فيه الذكاء الاصطناعي. يكشف مكوّن السمة عن هذا التنسيق تلقائياً ويحوّله إلى أزرار تفاعلية.
أودّ حقاً أن أسمع عن حالة استخدامك. من فضلك شاركنا!

